Examples of CompilationUnit()


Examples of JavaRecognizer.compilationUnit()

      // Create a parser that reads from the scanner
      JavaRecognizer parser = new JavaRecognizer(lexer);
      parser.setFilename(f);

      // start parsing at the compilationUnit rule
      parser.compilationUnit();
     
      // do something with the tree
      doTreeAction(f, parser.getAST(), parser.getTokenNames());
    }
    catch (Exception e) {
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.compilationUnit()

    final GeneratedJavaRecognizer parser =
        new GeneratedJavaRecognizer(lexer);
    parser.setFilename(aContents.getFilename());
    parser.setASTNodeClass(DetailAST.class.getName());
    parser.compilationUnit();

    return (DetailAST) parser.getAST();
  }

  @Override
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.compilationUnit()

        final GeneratedJavaRecognizer parser =
            new GeneratedJavaRecognizer(lexer);
        parser.setFilename(aContents.getFilename());
        parser.setASTNodeClass(DetailAST.class.getName());
        parser.compilationUnit();

        return (DetailAST) parser.getAST();
    }

    /** {@inheritDoc} */
 
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.compilationUnit()

            aSilentlyConsumeErrors
                ? new SilentJavaRecognizer(lexer)
                : new GeneratedJavaRecognizer(lexer);
        parser.setFilename(aContents.getFilename());
        parser.setASTNodeClass(DetailAST.class.getName());
        parser.compilationUnit();

        return (DetailAST) parser.getAST();
    }

    /** {@inheritDoc} */
 
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.parser.CeylonParser.compilationUnit()

            //System.out.println("Parsing " + file.getName());
            CeylonLexer lexer = new CeylonLexer(new ANTLRInputStream(file.getInputStream(), getEncoding()));
            CommonTokenStream tokenStream = new CommonTokenStream(lexer);
            CeylonParser parser = new CeylonParser(tokenStream);
            Tree.CompilationUnit cu = parser.compilationUnit();
            List<CommonToken> tokens = new ArrayList<CommonToken>(tokenStream.getTokens().size());
            tokens.addAll(tokenStream.getTokens());
            PhasedUnit phasedUnit = new PhasedUnit(file, srcDir, cu,
                    moduleManager.getCurrentPackage(), moduleManager,
                    context, tokens);
View Full Code Here

Examples of com.sun.tools.javac.parser.Parser.compilationUnit()

        JavaFileObject fo = new StringJavaFileObject("Foo", text);
        log.useSource(fo);

        Scanner s = sfac.newScanner(fo.getCharContent(true));
        Parser parser = pfac.newParser(s, false, genEndPos);
        JCTree.JCCompilationUnit tree = parser.compilationUnit();
        log.setEndPosTable(fo, tree.endPositions);

        TreeScanner ts = new LogTester(log, tree.endPositions);
        ts.scan(tree);
View Full Code Here

Examples of fr.insalyon.citi.golo.compiler.parser.GoloOffsetParser.CompilationUnit()

  }

  @Test
  public void markdown_processor() throws Throwable {
    GoloParser parser = new GoloOffsetParser(new FileInputStream(SRC + "doc.golo"));
    ASTCompilationUnit compilationUnit = parser.CompilationUnit();

    MarkdownProcessor processor = new MarkdownProcessor();
    String result = processor.render(compilationUnit);
    assertThat(result, containsString("# Documentation for `Documented`"));
    assertThat(result, containsString("### `with_doc(a, b)`"));
View Full Code Here

Examples of fr.insalyon.citi.golo.compiler.parser.GoloOffsetParser.CompilationUnit()

  }

  @Test
  public void html_processor() throws Throwable {
    GoloParser parser = new GoloOffsetParser(new FileInputStream(SRC + "doc.golo"));
    ASTCompilationUnit compilationUnit = parser.CompilationUnit();

    HtmlProcessor processor = new HtmlProcessor();
    String result = processor.render(compilationUnit);
    assertThat(result, containsString("<h1>Documentation for Documented</h1>"));
    assertThat(result, containsString("<h3 id=\"with_doc_a_b\">with_doc(a, b)"));
View Full Code Here

Examples of fr.insalyon.citi.golo.compiler.parser.GoloOffsetParser.CompilationUnit()

  }

  @Test
  public void ctags_processor() throws Throwable {
    GoloParser parser = new GoloOffsetParser(new FileInputStream(SRC + "doc.golo"));
    ASTCompilationUnit compilationUnit = parser.CompilationUnit();

    CtagsProcessor processor = new CtagsProcessor();
    String result = processor.render(compilationUnit);
    assertThat(result, containsString("Documented\tfile\t/^module[:blank:]+Documented$/;\"\tp\tline:1\tlanguage:golo"));
    assertThat(result, containsString("Point\tfile\t/^struct[:blank:]+Point[:blank:]+=/;\"\ts\tline:59\tlanguage:golo"));
View Full Code Here

Examples of fr.insalyon.citi.golo.compiler.parser.GoloOffsetParser.CompilationUnit()

  public static final String SRC = "src/test/resources/for-parsing-and-compilation/";

  @Test
  public void check() throws Throwable {
    GoloParser parser = new GoloOffsetParser(new FileInputStream(SRC + "doc.golo"));
    ASTCompilationUnit compilationUnit = parser.CompilationUnit();
    ModuleDocumentation doc = new ModuleDocumentation(compilationUnit);

    assertThat(doc.moduleName(), is("Documented"));
    assertThat(doc.moduleDocumentation(), containsString("    let foo = \"bar\""));
    assertThat(doc.moduleDefLine(), is(1)); //Module doc is part of the module node
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.