Example #1
0
  @NotNull
  public ASTNode parse(IElementType root, PsiBuilder builder) {
    if (ALLOW_ONLY_ONE_THREAD) {
      try {
        SEMAPHORE.acquire();
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    }
    // builder.setDebugMode(true);
    final PsiBuilder.Marker rootMarker = builder.mark();
    if (!builder.eof()) { // Empty file is not an error
      final GLSLParsing theRealParser = new GLSLParsing(builder);

      theRealParser.parseTranslationUnit();
      while (!builder.eof()) // exhaust the file if unable to parse everything
      builder.advanceLexer();
    }

    rootMarker.done(root);

    if (ALLOW_ONLY_ONE_THREAD) {
      SEMAPHORE.release();
    }
    return builder.getTreeBuilt();
  }
 @NotNull
 public ASTNode parse(IElementType root, PsiBuilder builder) {
   myNewLines = new HashMap<PsiBuilder.Marker, Boolean>();
   myIndents = new HashMap<PsiBuilder.Marker, Integer>();
   myBuilder = builder;
   parseRoot(root);
   return myBuilder.getTreeBuilt();
 }
 public ASTNode parse(IElementType root_, PsiBuilder builder_) {
   boolean result_;
   builder_ = adapt_builder_(root_, builder_, this, null);
   Marker marker_ = enter_section_(builder_, 0, _COLLAPSE_, null);
   if (root_ == PROPERTY) {
     result_ = property(builder_, 0);
   } else {
     result_ = parse_root_(root_, builder_, 0);
   }
   exit_section_(builder_, 0, marker_, root_, result_, true, TRUE_CONDITION);
   return builder_.getTreeBuilt();
 }
 /**
  * @param root The file currently being parsed
  * @param builder used to build the parse tree
  * @return parsed tree
  */
 @NotNull
 @Override
 public ASTNode parse(IElementType root, PsiBuilder builder) {
   PsiBuilder.Marker rootMarker = builder.mark();
   PsiBuilder.Marker wrapperMarker = builder.mark();
   builder.setDebugMode(true);
   // Process all tokens
   parseTree(builder);
   wrapperMarker.done(SS_STATEMENTS);
   rootMarker.done(root);
   return builder.getTreeBuilt();
 }
Example #5
0
  @NotNull
  @Override
  public ASTNode parse(IElementType iElementType, PsiBuilder builder) {

    PsiBuilder.Marker rootMarker = builder.mark();

    // TODO Actual parsing not implemented

    while (!builder.eof()) {
      builder.advanceLexer();
    }

    rootMarker.done(iElementType);
    return builder.getTreeBuilt();
  }
  @Override
  public ASTNode parseContents(final ASTNode chameleon) {
    if (JavaParserDefinition.USE_NEW_PARSER) {
      final PsiBuilder builder = JavaParserUtil.createBuilder(chameleon);
      doParse(builder);
      return builder.getTreeBuilt().getFirstChildNode();
    }

    FileElement node = (FileElement) chameleon;
    final CharSequence seq = node.getChars();

    final PsiManager manager = node.getManager();
    final JavaLexer lexer = new JavaLexer(PsiUtil.getLanguageLevel(node.getPsi()));
    return FileTextParsing.parseFileText(manager, lexer, seq, 0, seq.length(), node.getCharTable());
  }
  @NotNull
  public ASTNode parse(IElementType root, PsiBuilder builder) {

    final PsiBuilder.Marker rootMarker = builder.mark();

    while (!builder.eof()) {
      IElementType token = builder.getTokenType();

      if (token != null) {
        builder.mark().done(token);
      }

      builder.advanceLexer();
    }

    rootMarker.done(root);
    return builder.getTreeBuilt();
  }
 protected ASTNode buildTree(
     final PsiBuilder.Marker fileMarker, final PsiBuilder builder, final IElementType root) {
   fileMarker.done(root);
   return builder.getTreeBuilt();
 }
 public ASTNode parse(IElementType t, PsiBuilder b) {
   parseLight(t, b);
   return b.getTreeBuilt();
 }