pep8analysis: enable analyzing from stream
authorAlexis Laferrière <alexis.laf@xymus.net>
Sun, 15 Jun 2014 13:27:21 +0000 (09:27 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 17 Jun 2014 18:53:20 +0000 (14:53 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

contrib/pep8analysis/src/ast/ast_base.nit
contrib/pep8analysis/src/ast/pretty_instructions.nit
contrib/pep8analysis/src/ast/rich_instructions.nit
contrib/pep8analysis/src/pep8analysis.nit

index 7054d29..6759fcc 100644 (file)
@@ -2,11 +2,15 @@ import backbone
 import parser
 
 redef class AnalysisManager
-       fun build_ast( filename : String ) : nullable AListing
+       fun build_ast_from_file( filename : String ) : nullable AListing
        do
                var file = new IFStream.open( filename )
+               return build_ast(filename, file)
+       end
 
-               var source = new SourceFile(filename, file)
+       fun build_ast(filename: String, stream: IStream): nullable AListing
+       do
+               var source = new SourceFile(filename, stream)
                var lexer = new Lexer(source)
                var parser = new Parser(lexer)
                var node_tree = parser.parse
index 7616b7e..488d382 100644 (file)
@@ -12,7 +12,7 @@ redef class AnalysisManager
                opts.add_option(opt_ast)
        end
 
-       redef fun build_ast(filename)
+       redef fun build_ast(filename, stream)
        do
                var ast = super
 
index 8049e34..947693e 100644 (file)
@@ -13,7 +13,7 @@ intrude import parser
 import ast_base
 
 redef class AnalysisManager
-       redef fun build_ast(filename)
+       redef fun build_ast(filename, stream)
        do
                var ast = super
                if ast != null then
index 1c334e6..c4d660f 100644 (file)
@@ -48,7 +48,7 @@ redef class AnalysisManager
                                        print "Target file \"{filename}\" does not exist."
                                        exit 1
                        end
-                       var ast = build_ast( filename )
+                       var ast = build_ast_from_file( filename )
                        assert ast != null
 
                        if failed then continue