Package org.antlr.v4.runtime.tree

Examples of org.antlr.v4.runtime.tree.ParseTree


         */

    SerpentParser parser = ParserUtils.getParser(SerpentLexer.class,
        SerpentParser.class, code);
        ParseTree tree = parser.parse();

        String result = new SerpentToAssemblyCompiler().visit(tree);
        result = result.replaceAll("\\s+", " ");
        result = result.trim();

View Full Code Here


         */

    SerpentParser parser = ParserUtils.getParser(SerpentLexer.class,
        SerpentParser.class, code);
        ParseTree tree = parser.parse();

        String result = new SerpentToAssemblyCompiler().visit(tree);
        result = result.replaceAll("\\s+", " ");
        result = result.trim();

View Full Code Here

         */

    SerpentParser parser = ParserUtils.getParser(SerpentLexer.class,
        SerpentParser.class, code);
        ParseTree tree = parser.parse();

        String result = new SerpentToAssemblyCompiler().visit(tree);
        result = result.replaceAll("\\s+", " ");
        result = result.trim();

View Full Code Here

         */

    SerpentParser parser = ParserUtils.getParser(SerpentLexer.class,
        SerpentParser.class, code);
        ParseTree tree = parser.parse();

        String result = new SerpentToAssemblyCompiler().visit(tree);
        result = result.replaceAll("\\s+", " ");
        result = result.trim();

View Full Code Here

         */

    SerpentParser parser = ParserUtils.getParser(SerpentLexer.class,
        SerpentParser.class, code);
        ParseTree tree = parser.parse();

        String result = new SerpentToAssemblyCompiler().visit(tree);
        result = result.replaceAll("\\s+", " ");
        result = result.trim();

View Full Code Here

            bld.append("\n");

        }
        int count = start.getChildCount();
        for (int i = 0; i < count; i++) {
            ParseTree child = start.getChild(i);
            for (int t = 0; t < tabs; t++) {
                bld.append("  ");
            }

            bld.append(child.getClass().getSimpleName() + ":\n" + getExpressionMap(child, tabs + 1));
        }
        return bld.toString();
    }
View Full Code Here

    }
    int count = start.getChildCount();
    for (int i = 0; i < count; i++)
    {
      ParseTree child = start.getChild(i);
      for (int t = 0; t < tabs; t++)
      {
        bld.append("  ");
      }

      bld.append(child.getClass().getSimpleName() + ":\n" + getExpressionMap(child, tabs + 1));
    }
    return bld.toString();
  }
View Full Code Here

  void start() throws Exception {
    int line = 1; // track input expr line numbers
    do { // while we have more expressions
      prompt();
      String cmd = br.readLine(); // read a command
      ParseTree tree = parse(cmd, line);
      ParseTreeWalker walker = new ParseTreeWalker();
      walker.walk(this, tree); // walk parse tree
    } while (!quit);
  }
View Full Code Here

    JavaParser parser = new JavaParser(tokens);
    parser.removeErrorListeners();
   
    // start parsing at the compilationUnit rule
    ParserRuleContext t = parser.compilationUnit();
    ParseTreeWalker walker = new ParseTreeWalker();
    List<AutocompleteCandidate> q = new ArrayList<AutocompleteCandidate>();
         
    ImportDeclarationCompletion extractor = new ImportDeclarationCompletion(txt,cur,registry,cps,cu);
    NameBuilder extractor2 = new NameBuilder(registry,cu );
    NodeCompletion extractor3 = new NodeCompletion(txt,cur, registry, cu);
    walker.walk(extractor, t);
    if(extractor.getQuery()!=null)
      q.addAll(extractor.getQuery());
    walker.walk(extractor2, t);
    walker.walk(extractor3, t);
    if(extractor3.getQuery()!=null)
      q.addAll(extractor3.getQuery());
    List<String> ret = registry.searchCandidates(q);

    // this shows the GUI
View Full Code Here

    parser.setBuildParseTree(true);
    ParseTree tree = parser.mson();
    // show tree in text form
    // System.out.println(tree.toStringTree(parser));

    ParseTreeWalker walker = new ParseTreeWalker();
    SymbolTable symtab = new SymbolTable();
    DefPhase def = new DefPhase(symtab);
    walker.walk(def, tree);
    // create next phase and feed symbol table info from def to ref phase
    RefPhase ref = new RefPhase(symtab, def.scopes);
    walker.walk(ref, tree);
  }
View Full Code Here

TOP

Related Classes of org.antlr.v4.runtime.tree.ParseTree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.