Examples of JavaParser


Examples of AST.JavaParser

  public static boolean dumpGraph(String args[]) {
    boolean result = new ASTDotGraphDumper().process(
        args,
        new BytecodeParser(),
        new JavaParser() {
          @Override
          public CompilationUnit parse(java.io.InputStream is,
              String fileName) throws java.io.IOException,
              beaver.Parser.Exception {
View Full Code Here

Examples of AST.JavaParser

  public static boolean dumpGraph(String args[]) {
    boolean result = new DotGraphDumper().process(
        args,
        new BytecodeParser(),
        new JavaParser() {
          @Override
          public CompilationUnit parse(java.io.InputStream is,
              String fileName) throws java.io.IOException,
              beaver.Parser.Exception {
View Full Code Here

Examples of javancss.JavaParser

      metrics.incFileCount();
      metrics.incByteCount(file.length());
     
      InputStream in = new BufferedInputStream(new FileInputStream(file), 10240);
     
      JavaParser ncssParser = new JavaParser(in);
     
      ncssParser.CompilationUnit();
     
      metrics.incPackageCount(ncssParser.getPackage());
      metrics.incNCSSCount(ncssParser.getNcss());
      metrics.incLOCCount(ncssParser.getLOC());
      metrics.incJavaDocCount(ncssParser.getJvdc());
      metrics.incCycCount(ncssParser.getFunction());
     
      safeClose(in);
     
      return metrics;
    }
View Full Code Here

Examples of openbook.tools.parser.JavaParser

    private void render(InputStream is, TokenRenderer renderer, PrintStream out) throws Exception {
        ANTLRInputStream input = new ANTLRInputStream(is);
        JavaLexer lexer = new JavaLexer(input);
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        DebugEventListener builder = new ParseTokenListener(renderer, out);
        JavaParser parser = new JavaParser(tokens, builder);
        // launch the parser starting at compilation unit
        parser.compilationUnit();
    }
View Full Code Here

Examples of org.apache.ws.jaxme.js.util.JavaParser

  private void doProcess(File f, File output) throws RecognitionException,
      TokenStreamException, IOException {
    logger.info("processing " + f.getAbsolutePath() + " to output "
        + output.getAbsolutePath());
    JavaSourceFactory javaSourceFactory = new JavaSourceFactory();
    JavaParser javaParser = new JavaParser(javaSourceFactory);
    javaParser.parse(f);
    Iterator iter = javaSourceFactory.getJavaSources();
    while (iter.hasNext()) {
      JavaSource sourceClass = (JavaSource) iter.next();
      JavaQName classQualifiedName = sourceClass.getQName();
      if (pattern.matcher(classQualifiedName.toString()).matches()) {
View Full Code Here

Examples of org.apache.ws.jaxme.js.util.JavaParser

  private JavaSourceResolver getResolver()
      throws TokenStreamException, RecognitionException {
    final Map sourcesByName = new HashMap();
    final JavaSourceFactory jsf = new JavaSourceFactory();
    JavaParser parser = new JavaParser(jsf);
    for (int i = 0;  i < sources.length;  i++) {
      List list = parser.parse(new StringReader(sources[i]));
      for (int j = 0;  j < list.size();  j++) {
        JavaSource js = (JavaSource) list.get(i);
        register(sourcesByName, js);
      }
    }
View Full Code Here

Examples of org.apache.ws.jaxme.js.util.JavaParser

        if (file == null) {
            InputStream istream = null;
            try {
                istream = url.openStream();
                Reader r = new InputStreamReader(istream);
                result = new JavaParser(pFactory).parse(r);
                istream.close();
                istream = null;
            } finally {
                if (istream != null) { try { istream.close(); } catch (Throwable ignore) {} }
            }
        } else {
            Reader r = null;
            try {
                r = new FileReader(file);
                result = new JavaParser(pFactory).parse(r);
                r.close();
                r = null;
            } finally {
                if (r != null) { try { r.close(); } catch (Throwable ignore) {} }
            }
View Full Code Here

Examples of org.drools.compiler.rule.builder.dialect.java.parser.JavaParser

     *             If an error occurs in the parser.
     */
    @SuppressWarnings("unchecked")
    public JavaAnalysisResult analyzeExpression(final String expr,
                                                final BoundIdentifiers availableIdentifiers) throws RecognitionException {
        final JavaParser parser = parse( expr );
        parser.conditionalOrExpression();
       
        JavaAnalysisResult result = new JavaAnalysisResult();
        result.setAnalyzedExpr(expr);
        result.setIdentifiers(new HashSet<String>( parser.getIdentifiers() ) );
        return analyze( result,
                        availableIdentifiers );
    }
View Full Code Here

Examples of org.drools.compiler.rule.builder.dialect.java.parser.JavaParser

    }

    @SuppressWarnings("unchecked")
    public JavaAnalysisResult analyzeBlock(final String expr,
                                       final BoundIdentifiers availableIdentifiers) throws RecognitionException {
        final JavaParser parser = parse( "{" + expr + "}" );
        parser.block();

        JavaAnalysisResult result = new JavaAnalysisResult();
        result.setAnalyzedExpr(expr);
        result.setIdentifiers( new HashSet<String>( parser.getIdentifiers() ) );
        result.setLocalVariables( new HashMap<String,JavaLocalDeclarationDescr>() );
        if( parser.getRootBlockDescr().getInScopeLocalVars() != null ) {
            for( JavaLocalDeclarationDescr descr : parser.getRootBlockDescr().getInScopeLocalVars() ) {
                for (JavaLocalDeclarationDescr.IdentifierDescr ident : descr.getIdentifiers()) {
                    result.addLocalVariable(ident.getIdentifier(), descr);
                }
            }
        }
        result.setBlockDescrs( parser.getRootBlockDescr() );

        return analyze( result,
                        availableIdentifiers );
    }
View Full Code Here

Examples of org.drools.compiler.rule.builder.dialect.java.parser.JavaParser

    private JavaParser parse(final String expr) {
        final CharStream charStream = new ANTLRStringStream(expr);
        final JavaLexer lexer = new JavaLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        return new JavaParser( tokenStream );
    }
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.