Examples of parseCompilationUnit()


Examples of net.janino.Parser.parseCompilationUnit()

  private static class JaninoCompiller implements Compiller {

    public byte[] compile( String name, String source) throws Exception {
      // using janino embeddable compiller
      Parser p = new Parser( new Scanner( name, new StringReader( source)));
      CompilationUnit cu = p.parseCompilationUnit();
      IClassLoader cl = new ClassLoaderIClassLoader( new URLClassLoader( new URL[] {}));
      return cu.compile( cl, 0)[0].toByteArray();
    }
 
  }
View Full Code Here

Examples of net.janino.Parser.parseCompilationUnit()

        "";
   
    IClassLoader cl = new ClassLoaderIClassLoader( new URLClassLoader( new URL[] {}));

    Parser p = new Parser( new Scanner( "JPEGImageWriterDump", new StringReader( code)));
    CompilationUnit cu = p.parseCompilationUnit();
    cu.compile( cl, DebuggingInformation.NONE)[0].toByteArray();
   
  }
}
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit()

  parser.setStatementsRecovery((reconcileFlags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0);
 
  if (!computeProblems && !resolveBindings && !createAST) // disable javadoc parsing if not computing problems, not resolving and not creating ast
    parser.javadocParser.checkDocComment = false;
  requestor.parser = parser;
  CompilationUnitDeclaration unit = parser.parseCompilationUnit(
    new org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit() {
      public char[] getContents() {
        return contents;
      }
      public char[] getMainTypeName() {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit()

      // ignore
    }
    if (source == null || name == null) return; // could not retrieve document info (e.g. resource was discarded)
    CompilationUnit compilationUnit = new CompilationUnit(source, name);
    try {
      parser.parseCompilationUnit(compilationUnit, true/*full parse*/);
    } catch (Exception e) {
      if (JobManager.VERBOSE) {
        e.printStackTrace();
      }
    }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit()

      boolean doFullParse = hasToRetrieveSourceRangesForLocalClass(fullName);
      parser = new SourceElementParser(this, factory, new CompilerOptions(this.options), doFullParse, true/*optimize string literals*/);
      parser.javadocParser.checkDocComment = false; // disable javadoc parsing
      IJavaElement javaElement = this.binaryType.getCompilationUnit();
      if (javaElement == null) javaElement = this.binaryType.getParent();
      parser.parseCompilationUnit(
        new BasicCompilationUnit(contents, null, this.binaryType.sourceFileName(info), javaElement),
        doFullParse);
      if (elementToFind != null) {
        ISourceRange range = this.getNameRange(elementToFind);
        return range;
View Full Code Here

Examples of org.codehaus.janino.Parser.parseCompilationUnit()

        public byte[] compile(final String name, final String source)
                throws Exception
        {
            Parser p = new Parser(new Scanner(name, new StringReader(source)));
            UnitCompiler uc = new UnitCompiler(p.parseCompilationUnit(), CL);
            return uc.compileUnit(DebuggingInformation.ALL)[0].toByteArray();
        }
    }

    static class Filter extends ClassAdapter {
View Full Code Here

Examples of org.codehaus.janino.Parser.parseCompilationUnit()

        public static byte[] compile(final String name, final String source)
                throws Exception
        {
            Parser p = new Parser(new Scanner(name, new StringReader(source)));
            UnitCompiler uc = new UnitCompiler(p.parseCompilationUnit(), CL);
            return uc.compileUnit(DebuggingInformation.ALL)[0].toByteArray();
        }
    }
}
View Full Code Here

Examples of org.codehaus.janino.Parser.parseCompilationUnit()

        try {
            Parser parser = new Parser(new Scanner(sourceFile.getPath(), is, optionalCharacterEncoding));

            this.benchmark.beginReporting("Parsing \"" + sourceFile + "\"");
            try {
                return parser.parseCompilationUnit();
            } finally {
                this.benchmark.endReporting();
            }
        } finally {
            try { is.close(); } catch (IOException ex) { }
View Full Code Here

Examples of org.codehaus.janino.Parser.parseCompilationUnit()

        public byte[] compile(final String name, final String source)
                throws Exception
        {
            Parser p = new Parser(new Scanner(name, new StringReader(source)));
            UnitCompiler uc = new UnitCompiler(p.parseCompilationUnit(), CL);
            return uc.compileUnit(DebuggingInformation.ALL)[0].toByteArray();
        }
    }

    private static class Filter extends ClassAdapter {
View Full Code Here

Examples of org.codehaus.janino.Parser.parseCompilationUnit()

        public byte[] compile(final String name, final String source)
                throws Exception
        {
            Parser p = new Parser(new Scanner(name, new StringReader(source)));
            UnitCompiler uc = new UnitCompiler(p.parseCompilationUnit(), CL);
            return uc.compileUnit(DebuggingInformation.ALL)[0].toByteArray();
        }
    }
}
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.