java类org.antlr.v4.runtime.ANTLRFileStream的实例源码

ParseTreeErrorListenerTest.java 文件源码 项目:athena 阅读 15 收藏 0 点赞 0 评论 0
/**
 * Checks that no exception is generated for YANG file with valid syntax.
 */
@Test
public void checkValidYangFileForNoSyntaxError() throws IOException {

    ANTLRInputStream input = new ANTLRFileStream("src/test/resources/YangFileWithoutSyntaxError.yang");

    // Create a lexer that feeds off of input char stream.
    GeneratedYangLexer lexer = new GeneratedYangLexer(input);
    // Create a buffer of tokens pulled from the lexer.
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    // Create a parser that feeds off the tokens buffer.
    GeneratedYangParser parser = new GeneratedYangParser(tokens);
    // Remove console error listener.
    parser.removeErrorListeners();
    // Create instance of customized error listener.
    ParseTreeErrorListener parseTreeErrorListener = new ParseTreeErrorListener();
    // Add customized error listener to catch errors during parsing.
    parser.addErrorListener(parseTreeErrorListener);
    // Begin parsing YANG file and generate parse tree.
    ParseTree tree = parser.yangfile();
}
ParseTreeErrorListenerTest.java 文件源码 项目:athena 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Checks that exception is generated for YANG file with invalid syntax.
 */
@Test
public void checkInvalidYangFileForSyntaxError() throws IOException {

    // Get the exception occurred during parsing.
    thrown.expect(ParserException.class);
    thrown.expect(CustomExceptionMatcher.errorLocation(3, 0));
    thrown.expectMessage("no viable alternative at input 'yang-version 1\\nnamespace'");

    ANTLRInputStream input = new ANTLRFileStream("src/test/resources/YangFileWithSyntaxError.yang");

    // Create a lexer that feeds off of input char stream.
    GeneratedYangLexer lexer = new GeneratedYangLexer(input);
    // Create a buffer of tokens pulled from the lexer.
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    // Create a parser that feeds off the tokens buffer.
    GeneratedYangParser parser = new GeneratedYangParser(tokens);
    // Remove console error listener.
    parser.removeErrorListeners();
    // Create instance of customized error listener.
    ParseTreeErrorListener parseTreeErrorListener = new ParseTreeErrorListener();
    // Add customized error listener to catch errors during parsing.
    parser.addErrorListener(parseTreeErrorListener);
    // Begin parsing YANG file and generate parse tree.
    ParseTree tree = parser.yangfile();
}
Test.java 文件源码 项目:exterminator 阅读 20 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws IOException {
    CoqLexer lexer = new CoqLexer(new ANTLRFileStream("../TestProgramC.v"));
    CoqFTParser parser = new CoqFTParser(new CommonTokenStream(lexer));

    //Listener listener = new Listener(parser);
    //parser.addParseListener(listener);
    //CoqParser.ProgContext ctx = parser.prog();
    //System.out.println(ctx.toStringTree(Arrays.asList(CoqParser.ruleNames)));

    Prog prog = parser.parseProg();
    for(Command command : prog) {
        if(command instanceof AssertionAndProof) {
            AssertionAndProof ap = (AssertionAndProof) command;
            System.out.println(ap.getAssertion());
            System.out.println("Proof:");
            for(Tactic tactic : ap.getProof().getTactics()) {
                System.out.println(tactic);
            }
        } else {
            System.out.println(command);
        }
    }
}
TPKB.java 文件源码 项目:TPKB 阅读 105 收藏 0 点赞 0 评论 0
/**
 * @param args
 * @throws IOException 
 * @throws SQLException 
 */
public static void main(String[] args) throws IOException, SQLException {

       TPKBLexer lexer = new TPKBLexer(new ANTLRFileStream("test.kb"));
       TPKBParser parser = new TPKBParser(new CommonTokenStream(lexer));

       TPKBClassListener listener = new TPKBClassListener();

       ParseTree tree = parser.tpkb();
       ParseTreeWalker walker = new ParseTreeWalker();
       walker.walk(listener, tree);

       MySQLEngine engine = new MySQLEngine();
       engine.processTSubRaw();
       engine.processTIsRaw();

       double Z = engine.computeZ();
       System.out.println("Z = "+Z);

       Z = engine.computeZWithEvidence();
       System.out.println("Z(E) = "+Z);     
}
Load.java 文件源码 项目:cs652 阅读 34 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws IOException {
    ANTLRInputStream input = new ANTLRFileStream("colleges.csv");
    CSVLexer lexer = new CSVLexer(input);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    CSVParser parser = new CSVParser(tokens);
    ParseTree tree = parser.file();
    System.out.println(tree.toStringTree(parser));

    ParseTreeWalker walker = new ParseTreeWalker();
    CSVLoader loader = new CSVLoader();
    walker.walk(loader, tree);

    for (List<String> row : loader.data) {
        System.out.println(row);
    }
}
MiniJParserTest.java 文件源码 项目:MiniJCompiler 阅读 22 收藏 0 点赞 0 评论 0
@Test
public void testParseWorkingExamples() throws IOException {
    FileVisitor<Path> workingFilesVisitior = new SimpleFileVisitor<Path>() {
        @Override
        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
            System.out.println("Testing parser input from file \""+file.toString()+"\"");
            ANTLRFileStream antlrStream = new ANTLRFileStream(file.toString());
            MiniJLexer lexer = new MiniJLexer(antlrStream);
            TokenStream tokens = new CommonTokenStream(lexer);
            MiniJParser parser = new MiniJParser(tokens);
            parser.setErrorHandler(new BailErrorStrategy());
            parser.prog();
            return super.visitFile(file, attrs);
        }
    };
    Files.walkFileTree(EXAMPLE_PROGRAM_PATH_WORKING, workingFilesVisitior);
}
MiniJParserTest.java 文件源码 项目:MiniJCompiler 阅读 18 收藏 0 点赞 0 评论 0
@Test
public void testParseFailingExamples() throws IOException {
    FileVisitor<Path> workingFilesVisitior = new SimpleFileVisitor<Path>() {
        @Override
        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
            System.out.println("Testing parser input from file \""+file.toString()+"\"");
            ANTLRFileStream antlrStream = new ANTLRFileStream(file.toString());
            MiniJLexer lexer = new MiniJLexer(antlrStream);
            TokenStream tokens = new CommonTokenStream(lexer);
            MiniJParser parser = new MiniJParser(tokens);
            parser.setErrorHandler(new BailErrorStrategy());
            /*
             * Catch all exceptions first, to ensure that every single
             * compilation unit exits with an Exception. Otherwise, this
             * method will return after the first piece of code.
             */
            try {
                parser.prog();
                fail("The example "+file.toString()+" should have failed, but was accepted by the parser.");
            } catch (ParseCancellationException e) {
            }
            return super.visitFile(file, attrs);
        }
    };
    Files.walkFileTree(EXAMPLE_PROGRAM_PATH_FAILING, workingFilesVisitior);
}
TypeCheckVisitorTest.java 文件源码 项目:MiniJCompiler 阅读 20 收藏 0 点赞 0 评论 0
@Test
public void testVisitTypeErrorExamples() throws Exception {
    FileVisitor<Path> failingFilesVisitior = new SimpleFileVisitor<Path>() {
        @Override
        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
            if (file.toString().endsWith("LinkedListBUG.java")) {
                return super.visitFile(file, attrs);
            }
            System.out.println("Testing type checker with file \""+file.toString()+"\"");
            ANTLRFileStream reader = new ANTLRFileStream(file.toString());
            MiniJLexer lexer = new MiniJLexer((CharStream) reader);
            TokenStream tokens = new CommonTokenStream(lexer);
            MiniJParser parser = new MiniJParser(tokens);
            ParseTree parseTree = parser.prog();
            ASTVisitor astVisitor = new ASTVisitor();
            Program ast = (Program) astVisitor.visit(parseTree);
            TypeInferenceVisitor typeInferenceVisitor = new TypeInferenceVisitor();
            ast.accept(typeInferenceVisitor);
            TypeCheckVisitor visitor = new TypeCheckVisitor();
            boolean typesCorrect = ast.accept(visitor);
            assertFalse("\"" + file.toString() + "\" passed type check but it shouldn't", typesCorrect);
            return super.visitFile(file, attrs);
        }
    };
    Files.walkFileTree(EXAMPLE_PROGRAM_PATH_FAILING, failingFilesVisitior);
}
Main.java 文件源码 项目:Q-Programming-Language 阅读 15 收藏 0 点赞 0 评论 0
@Override
public String visitIncludeFile(QPLParser.IncludeFileContext ctx) {
    String filePath = ctx.path.getText().trim();
    filePath = filePath.substring(1, filePath.length() - 1);
    if (filePath.charAt(0) != '/') {
        filePath = Paths.get(__FILE_PATH__, filePath).toString();
    }
    try {
        ANTLRInputStream ais = new ANTLRFileStream(filePath);
        QPLLexer lex = new QPLLexer(ais);
        TokenStream toks = new CommonTokenStream(lex);
        QPLParser parse = new QPLParser(toks);
        ParseTree tree = parse.prog();
        return new ImpVisitor(filePath).visit(tree);
    } catch (IOException ex) {
        System.err.println(filePath + " cannot be found! Ignoring");
        return "";
    }
}
ZomicASTCompiler.java 文件源码 项目:vzome-core 阅读 25 收藏 0 点赞 0 评论 0
public static Walk compile( File file, IcosahedralSymmetry symm ) {
String fileName = file.getAbsolutePath();
Walk program = null;
ErrorHandler.Default errors = new ErrorHandler.Default();
ZomicASTCompiler compiler = new ZomicASTCompiler(symm );
try {
    ANTLRFileStream fileStream = new ANTLRFileStream(fileName);
    program = compiler.compile( fileStream, errors );
    if( program != null ) {
        program.setErrors( errors.getErrors() );
    }
} catch (IOException ex) {
    errors.parseError( ErrorHandler.UNKNOWN, ErrorHandler.UNKNOWN, ex.getMessage() );
}
      return program;
  }
Calculator.java 文件源码 项目:poly-ql 阅读 30 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception
 {
  String testFile = "";
// set test input
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new java.io.File("."));
chooser.setDialogTitle("Please choose the master file");
chooser.setAcceptAllFileFilterUsed(false);

if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
  testFile = chooser.getSelectedFile().getAbsolutePath();
} else {
  System.exit(0);
}

   Calculator4Lexer lexer = new Calculator4Lexer(new ANTLRFileStream(testFile));
   CommonTokenStream tokens = new CommonTokenStream(lexer);
   Calculator4Parser p = new Calculator4Parser(tokens);
   p.setBuildParseTree(true);
   p.addParseListener(new CalculatorListener());
   ParserRuleContext t = p.program();
 }
Form.java 文件源码 项目:poly-ql 阅读 21 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {

        String testFile = "";
        // set test input
        JFileChooser chooser = new JFileChooser();
        chooser.setCurrentDirectory(new java.io.File("."));
        chooser.setDialogTitle("Please choose the master file");
        chooser.setAcceptAllFileFilterUsed(false);

        if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
            testFile = chooser.getSelectedFile().getAbsolutePath();
        } else {
            System.exit(0);
        }

        FormLexer lexer = new FormLexer(
                new ANTLRFileStream(testFile));
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        System.out.println(tokens);
        FormParser p = new FormParser(tokens);
        p.setBuildParseTree(true);
        p.addParseListener(new FormListener());
        ParserRuleContext t = p.form();
    }
WordSeparation.java 文件源码 项目:poly-ql 阅读 13 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {

        String testFile = "";
        // set test input
        JFileChooser chooser = new JFileChooser();
        chooser.setCurrentDirectory(new java.io.File("."));
        chooser.setDialogTitle("Please choose the master file");
        chooser.setAcceptAllFileFilterUsed(false);

        if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
            testFile = chooser.getSelectedFile().getAbsolutePath();
        } else {
            System.exit(0);
        }

        WordSeparationLexer lexer = new WordSeparationLexer(
                new ANTLRFileStream(testFile));
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        System.out.println(tokens);
        WordSeparationParser p = new WordSeparationParser(tokens);
        p.setBuildParseTree(true);
        p.addParseListener(new WordSeparationListener());
        ParserRuleContext t = p.program();
    }
Form2.java 文件源码 项目:poly-ql 阅读 16 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {

        String testFile = "";
        // set test input
        JFileChooser chooser = new JFileChooser();
        chooser.setCurrentDirectory(new java.io.File("."));
        chooser.setDialogTitle("Please choose the master file");
        chooser.setAcceptAllFileFilterUsed(false);

        if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
            testFile = chooser.getSelectedFile().getAbsolutePath();
        } else {
            System.exit(0);
        }

        // create lexer and perser
        Form2Lexer lexer = new Form2Lexer(new ANTLRFileStream(testFile));
        Form2Parser parser = new Form2Parser(new CommonTokenStream(lexer));

        // generate tree and visitor
        ParseTree tree = parser.form();
        Form2Visitor visitor = new Form2CustomVisitor();
        visitor.visit(tree);
    }
Load.java 文件源码 项目:cs652 阅读 22 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws IOException {
    ANTLRInputStream input = new ANTLRFileStream("colleges.csv");
    CSVLexer lexer = new CSVLexer(input);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    CSVParser parser = new CSVParser(tokens);
    ParseTree tree = parser.file();
    System.out.println(tree.toStringTree(parser));

    ParseTreeWalker walker = new ParseTreeWalker();
    CSVLoader loader = new CSVLoader();
    walker.walk(loader, tree);

    for (List<String> row : loader.data) {
        System.out.println(row);
    }
}
ProtoFiles.java 文件源码 项目:protobuf-el 阅读 20 收藏 0 点赞 0 评论 0
@SuppressWarnings("unused")
private ParsedContext parseFile(final File rootDir, final String protoName) {
  Throwable exception = null;

  try {
    final File file = new File(rootDir, protoName);
    final ANTLRFileStream ais = new ANTLRFileStream(file.getCanonicalPath());
    return parseProto(ais, protoName);
  } catch (final IOException e) {
    exception = e;
  } finally {
    if (exception != null) {
      throw new RuntimeException(exception);
    }
  }

  return null;
}
AbstractTemplatesTest.java 文件源码 项目:queryj 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Sets up the Java parser.
 * @param javaFile the Java contents to parse.
 * @return the {@link JavaParser} instance.
 * @throws RecognitionException if the comment cannot be parsed.
 * @throws IOException if the file could not be read.
 */
@SuppressWarnings("unchecked")
@NotNull
protected JavaParser setUpParser(@NotNull final File javaFile)
    throws RecognitionException,
           IOException
{
    @NotNull final JavaParser result;

    @NotNull final JavaLexer t_Lexer =
        new JavaLexer(new ANTLRFileStream(javaFile.getAbsolutePath()));

    @NotNull final CommonTokenStream t_Tokens = new CommonTokenStream(t_Lexer);

    result = new JavaParser(t_Tokens);

    return result;
}
AbstractTemplatesTest.java 文件源码 项目:queryj 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Sets up the Java parser.
 * @param javaFile the Java contents to parse.
 * @return the {@link JavaParser} instance.
 * @throws RecognitionException if the format is invalid.
 * @throws IOException if the source cannot be read.
 */
@SuppressWarnings("unchecked")
@NotNull
protected JavaParser setUpParser(@NotNull final File javaFile)
    throws RecognitionException,
           IOException
{
    @NotNull final JavaParser result;

    @NotNull final JavaLexer t_Lexer =
        new JavaLexer(new ANTLRFileStream(javaFile.getAbsolutePath()));

    @NotNull final ANTLRErrorListener errorListener = new PropagatingErrorListener(javaFile);

    t_Lexer.addErrorListener(errorListener);

    @NotNull final CommonTokenStream t_Tokens = new CommonTokenStream(t_Lexer);

    result = new JavaParser(t_Tokens);

    result.addErrorListener(errorListener);

    return result;
}
MethodFinder.java 文件源码 项目:antlr4-method-extractor 阅读 21 收藏 0 点赞 0 评论 0
private void parseFile(File child) {
    try {
        currentJavaFile = child;
        intervals = new ArrayList<Interval>();
        input = new ANTLRFileStream(child.getPath());
        Java7Lexer lexer = new Java7Lexer(input);
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        Java7Parser parser = new Java7Parser(tokens);
        ParserRuleContext tree = parser.compilationUnit();
        ParseTreeWalker walker = new ParseTreeWalker();
        walker.walk(this, tree);
        if (intervals.size()>0) {
            writeOutputFile();
        }
    } catch (IOException e) {
        System.err.println("Could not parse " + child.getPath());
        e.printStackTrace();
    }   
}
LLVMParserTest.java 文件源码 项目:io.alef.llvm 阅读 19 收藏 0 点赞 0 评论 0
@Test
public void parse() throws IOException {
    System.out.println(file.getName() + "-------------------------------");
    final LLVMLexer lexer = new LLVMLexer(new ANTLRFileStream(file.getAbsolutePath()));
    final CommonTokenStream stream = new CommonTokenStream(lexer);
    final LLVMParser parser = new LLVMParser(stream);
    parser.setErrorHandler(new BailErrorStrategy());
    final ModuleContext module = parser.module();
    System.out.println(Trees.toStringTree(module));
}
Dbg.java 文件源码 项目:codebuff 阅读 17 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    ANTLRv4Lexer lexer = new ANTLRv4Lexer(new ANTLRFileStream("grammars/org/antlr/codebuff/ANTLRv4Lexer.g4"));
    CommonTokenStream tokens = new CodeBuffTokenStream(lexer);
    ANTLRv4Parser parser = new ANTLRv4Parser(tokens);
    ANTLRv4Parser.GrammarSpecContext tree = parser.grammarSpec();
    System.out.println(tree.toStringTree(parser));
}
ProfileJava.java 文件源码 项目:codebuff 阅读 13 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
        Thread.sleep(10000);
        ANTLRFileStream input = new ANTLRFileStream(args[0]);
        JavaLexer lexer = new JavaLexer(input);
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        JavaParser parser = new JavaParser(tokens);
        JavaParser.CompilationUnitContext tree = parser.compilationUnit();
//      System.out.println(tree.toStringTree(parser));
        Thread.sleep(10000);
    }
Interpreter.java 文件源码 项目:Reo 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Parses a source file using ANTLR4, and walks over the parse tree to
 * interpret this source file as a Java object.
 * 
 * @param path
 *            location of the file
 * @return an interpreted source file, or null in case of an error.
 */
@Nullable
private ReoFile<T> parse(String path) {
    try {
        return parse(new ANTLRFileStream(path), path);
    } catch (IOException e) {
        m.add("Cannot open " + path + ".");
    }
    return null;
}
SaralCompilationUnitParser.java 文件源码 项目:saral 阅读 15 收藏 0 点赞 0 评论 0
public Init getCompilationUnit(File preprocessedTempFile, String className) throws IOException{
    String fileAbsPath = preprocessedTempFile.getAbsolutePath();

    CharStream charStream = new ANTLRFileStream(fileAbsPath);
    SaralLexer saralLexer = new SaralLexer(charStream);
    CommonTokenStream commonTokenStream  = new CommonTokenStream(saralLexer);
    SaralParser saralParser = new SaralParser(commonTokenStream);

    BaseErrorListener errorListener = new SaralTreeWalkErrorListener();
    saralParser.addErrorListener(errorListener);

    InitVisitor initVisitor = new InitVisitor(className);
    return saralParser.init().accept(initVisitor);
}
AstGen.java 文件源码 项目:arroba-lang 阅读 14 收藏 0 点赞 0 评论 0
public static ArrobaParser.CompilationUnitContext makeAst(String fileName) {
    try {
        ANTLRFileStream fileStream = new ANTLRFileStream(fileName);
        ArrobaLexer lexer = new ArrobaLexer(fileStream);
        CommonTokenStream tokenStream = new CommonTokenStream(lexer);
        ArrobaParser parser = new ArrobaParser(tokenStream);
        parser.setBuildParseTree(true);
        return parser.compilationUnit();
    } catch (IOException e) {
        System.err.println("fatal error: could not open file: " + fileName);
        //e.printStackTrace();
        return null;
    }
}
Main.java 文件源码 项目:oql2json 阅读 14 收藏 0 点赞 0 评论 0
public static void convert(String fn) throws Exception {

        ItnmDumpLexer lexer = new ItnmDumpLexer(new ANTLRFileStream(fn));

        CommonTokenStream tokens = new CommonTokenStream(lexer);

        ItnmDumpParser parser = new ItnmDumpParser(tokens);
        parser.setBuildParseTree(true);

        ParseContext parseContext = parser.parse();
        ParseTreeWalker walker = new ParseTreeWalker();
        ItnmDumpListener listener = new ItnmDumpJSONWriter();
        walker.walk(listener, parseContext);
    }
Test.java 文件源码 项目:cs652 阅读 20 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws IOException {
        ANTLRInputStream input = new ANTLRFileStream(args[0]);
        SimpleLexer l = new SimpleLexer(input);
        TokenStream tokens = new CommonTokenStream(l);

        SimpleParser parser = new SimpleParser(tokens);
        ParserRuleContext tree = parser.file();
        System.out.println(tree.toStringTree(parser));
//      tree.inspect(parser);

        DefSymbolsAndScopes def = new DefSymbolsAndScopes();
        ParseTreeWalker walker = new ParseTreeWalker();
        walker.walk(def, tree);
    }
TestFaLaLa.java 文件源码 项目:cs652 阅读 14 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    ANTLRInputStream input = new ANTLRFileStream("test.falala");
    FaLaLaLexer lexer = new FaLaLaLexer(input);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    FaLaLaParser parser = new FaLaLaParser(tokens);
    ParseTree tree = parser.prog();
    System.out.println(tree.toStringTree(parser));

    ParseTreeWalker walker = new ParseTreeWalker();
    DefSymbols def = new DefSymbols();
    walker.walk(def, tree);
}
TestLaLa.java 文件源码 项目:cs652 阅读 15 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    ANTLRInputStream input = new ANTLRFileStream("bad.lala");
    LaLaLexer lexer = new LaLaLexer(input);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    LaLaParser parser = new LaLaParser(tokens);
    ParseTree tree = parser.prog();
    System.out.println(tree.toStringTree(parser));

    ParseTreeWalker walker = new ParseTreeWalker();
    DefSymbols def = new DefSymbols();
    walker.walk(def, tree);

    System.out.println(def.globals.symbols);
}
Compiler.java 文件源码 项目:WAM 阅读 21 收藏 0 点赞 0 评论 0
public static Map<String, List<List<CompileToken>>> tokenizeFile(String file){
    try {
        ANTLRFileStream stream = new ANTLRFileStream(file);
        return visitor(stream).getTokens();
    } catch (IOException e) { 
        e.printStackTrace();
    }
    return null;
}


问题


面经


文章

微信
公众号

扫码关注公众号