Tabnine Logo
JavaCCompiler
Code IndexAdd Tabnine to your IDE (free)

How to use
JavaCCompiler
in
com.oracle.truffle.dsl.processor.java.compiler

Best Java code snippets using com.oracle.truffle.dsl.processor.java.compiler.JavaCCompiler (Showing top 6 results out of 315)

origin: com.oracle/truffle-dsl-processor

private static CharSequence getContent(Object treeAndTopLevel) throws Exception {
  /*
   * CharSequence content = treeAndTopLevel.snd.getSourceFile().getCharContent(true);
   */
  return (CharSequence) method(method(field(treeAndTopLevel, "snd"), "getSourceFile"), "getCharContent", getCharContentSignature, true);
}
origin: com.oracle/truffle-dsl-processor

public static Compiler getCompiler(Element currentElement) {
  if (JavaCCompiler.isValidElement(currentElement)) {
    if (javac == null) {
      javac = new JavaCCompiler();
    }
    return javac;
  } else if (JDTCompiler.isValidElement(currentElement)) {
    if (jdt == null) {
      jdt = new JDTCompiler();
    }
    return jdt;
  } else {
    throw new UnsupportedOperationException("Unsupported compiler for element " + currentElement.getClass().getName() + ".");
  }
}
origin: com.oracle/truffle-dsl-processor

@Override
public String getMethodBody(ProcessingEnvironment env, ExecutableElement method) {
  try {
    /*
     * if (false) { Pair<JCTree, JCCompilationUnit> treeAndTopLevel = ((JavacElements)
     * env.getElementUtils()).getTreeAndTopLevel(method, null, null); JCBlock block =
     * ((JCMethodDecl) treeAndTopLevel.fst).getBody(); int startPos = block.pos; int endPos
     * = block.endpos; String methodBody =
     * treeAndTopLevel.snd.getSourceFile().getCharContent(true).subSequence(startPos + 1,
     * endPos).toString(); return methodBody; }
     */
    Object treeAndTopLevel = getTreeAndTopLevel(env, method);
    Object block = method(field(treeAndTopLevel, "fst"), "getBody");
    int startPos = (int) field(block, "pos");
    int endPos = (int) field(block, "endpos");
    return getContent(treeAndTopLevel).subSequence(startPos + 1, endPos).toString();
  } catch (Exception e) {
    return ElementUtils.printException(e);
  }
}
origin: com.oracle/truffle-dsl-processor

@Override
public String getHeaderComment(ProcessingEnvironment env, Element type) {
  try {
    String content = getContent(getTreeAndTopLevel(env, type)).toString();
    return parseHeader(content);
  } catch (Exception e) {
    return ElementUtils.printException(e);
  }
}
origin: com.oracle/truffle-dsl-processor

private static Object getTreeAndTopLevel(ProcessingEnvironment env, Element element) throws Exception {
  /*
   * Pair<JCTree, JCCompilationUnit> treeAndTopLevel = ((JavacElements)
   * env.getElementUtils()).getTreeAndTopLevel(method, null, null);
   */
  return method(method(env, "getElementUtils"), "getTreeAndTopLevel", getTreeAndTopLevelSignature, element, null, null);
}
origin: com.oracle.truffle/truffle-dsl-processor

public static Compiler getCompiler(Element currentElement) {
  if (JavaCCompiler.isValidElement(currentElement)) {
    if (javac == null) {
      javac = new JavaCCompiler();
    }
    return javac;
  } else if (JDTCompiler.isValidElement(currentElement)) {
    if (jdt == null) {
      jdt = new JDTCompiler();
    }
    return jdt;
  } else {
    throw new UnsupportedOperationException("Unsupported compiler for element " + currentElement.getClass().getName() + ".");
  }
}
com.oracle.truffle.dsl.processor.java.compilerJavaCCompiler

Most used methods

  • <init>
  • isValidElement
  • field
  • getContent
  • getTreeAndTopLevel
  • method
  • parseHeader

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (Timer)
  • getSupportFragmentManager (FragmentActivity)
  • getExternalFilesDir (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JFrame (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now