Java Code Examples for com.intellij.lang.PsiBuilder.getLatestDoneMarker()

The following are Jave code examples for showing how to use getLatestDoneMarker() of the com.intellij.lang.PsiBuilder class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: TS-IJ   File: TSParserUtil.java   Source Code and License Vote up 6 votes
private static boolean assign_ref_expr(PsiBuilder b, int l) {
    //So this is rather wonky. What we do here is try to parse the incoming nodes as an expression,
    // as assign_ref_expr (and the below rules) need an expression as the first argument, but
    // you can chain them together. And calling expr will eat the assign_ref_expr when it parses.
    //So to get to the point here:
    // We run expr() and then see what it comes up with. If the last node (basically the expression
    // that it parsed from the call) is of our type, then we successfully parsed it.
    boolean r;
    PsiBuilder.Marker m = enter_section_(b);
    //Group -1 so we parse whatever expression is next
    r = expr(b, l + 1, -1);
    if (r) {
        //If we parsed an expression, check if we parsed the type we'ere looking for
        PsiBuilderImpl.ProductionMarker last = (PsiBuilderImpl.ProductionMarker) b.getLatestDoneMarker();
        r = last != null && last.getTokenType().equals(ASSIGN_REF_EXPR);
    }
    exit_section_(b, m, null, r);
    return r;
}
 
Example 2
Project: TS-IJ   File: TSParserUtil.java   Source Code and License Vote up 5 votes
private static boolean assign_ref_index_expr(PsiBuilder b, int l) {
    //See assign_ref_expr for explanation
    boolean r;
    PsiBuilder.Marker m = enter_section_(b);
    r = expr(b, l + 1, -1);
    if (r) {
        PsiBuilderImpl.ProductionMarker last = (PsiBuilderImpl.ProductionMarker)b.getLatestDoneMarker();
        r = last != null && last.getTokenType().equals(ASSIGN_REF_INDEX_EXPR);
    }
    exit_section_(b, m, null, r);
    return r;
}
 
Example 3
Project: TS-IJ   File: TSParserUtil.java   Source Code and License Vote up 5 votes
private static boolean call_method_expr(PsiBuilder b, int l) {
    //See assign_ref_expr for explanation
    boolean r;
    PsiBuilder.Marker m = enter_section_(b);
    r = expr(b, l + 1, -1);
    if (r) {
        PsiBuilderImpl.ProductionMarker last = (PsiBuilderImpl.ProductionMarker)b.getLatestDoneMarker();
        r = last != null && last.getTokenType().equals(CALL_METHOD_EXPR);
    }
    exit_section_(b, m, null, r);
    return r;
}
 
Example 4
Project: AppleScript-IDEA   File: AppleScriptGeneratedParserUtil.java   Source Code and License Vote up 4 votes
public static boolean isTreePrevSimpleReference(PsiBuilder b, int l) {
  return b.getLatestDoneMarker() != null && b.getLatestDoneMarker().getTokenType() == REFERENCE_EXPRESSION;
}
 
Example 5
Project: AppleScript-IDEA   File: AppleScriptGeneratedParserUtil.java   Source Code and License Vote up 4 votes
public static boolean isPossessivePpronoun(PsiBuilder b, int l) {
  LighterASTNode prevNode = b.getLatestDoneMarker();
  return prevNode != null && prevNode.getTokenType() == BUILT_IN_CONSTANT_LITERAL_EXPRESSION
          && prevNode.toString().equalsIgnoreCase("its");
}