com.intellij.lang.PsiBuilder.Marker Java Examples

The following examples show how to use com.intellij.lang.PsiBuilder.Marker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OclYaccParser.java    From reasonml-idea-plugin with MIT License 6 votes vote down vote up
static boolean declarations(@NotNull PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "declarations")) {
        return false;
    }
    boolean r;
    Marker m = enter_section_(b);
    r = declaration(b, l + 1);
    while (r) {
        int c = current_position_(b);
        if (!declaration(b, l + 1)) {
            break;
        }
        if (!empty_element_parsed_guard_(b, "declarations", c)) {
            break;
        }
    }
    exit_section_(b, m, null, r);
    return r;
}
 
Example #2
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 6 votes vote down vote up
public static boolean Mnemonic(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "Mnemonic")) return false;
  boolean r;
  Marker m = enter_section_(b, l, _NONE_, MNEMONIC, "<mnemonic>");
  r = consumeTokenSmart(b, GENERAL_OP);
  if (!r) r = consumeTokenSmart(b, SYSTEM_OP);
  if (!r) r = consumeTokenSmart(b, VIRTUALIZATION_OP);
  if (!r) r = consumeTokenSmart(b, X64_OP);
  if (!r) r = consumeTokenSmart(b, FPU_OP);
  if (!r) r = consumeTokenSmart(b, MMX_OP);
  if (!r) r = consumeTokenSmart(b, SSE_OP);
  if (!r) r = consumeTokenSmart(b, SSE2_OP);
  if (!r) r = consumeTokenSmart(b, SSE3_OP);
  if (!r) r = consumeTokenSmart(b, SSE4_OP);
  if (!r) r = consumeTokenSmart(b, AVX_OP);
  if (!r) r = consumeTokenSmart(b, AVX2_OP);
  if (!r) r = consumeTokenSmart(b, AVX512_OP);
  exit_section_(b, l, m, r, false, null);
  return r;
}
 
Example #3
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 6 votes vote down vote up
public static boolean Preprocessor(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "Preprocessor")) return false;
  boolean r;
  Marker m = enter_section_(b, l, _NONE_, PREPROCESSOR, "<preprocessor>");
  r = Include(b, l + 1);
  if (!r) r = Define(b, l + 1);
  if (!r) r = Assign(b, l + 1);
  if (!r) r = Macro(b, l + 1);
  if (!r) r = MacroDefCall(b, l + 1);
  if (!r) r = MacroCall(b, l + 1);
  if (!r) r = Strlen(b, l + 1);
  if (!r) r = Error(b, l + 1);
  if (!r) r = Conditional(b, l + 1);
  if (!r) r = PreprocessorExpr(b, l + 1);
  exit_section_(b, l, m, r, false, null);
  return r;
}
 
Example #4
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 6 votes vote down vote up
public static boolean Macro(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "Macro")) return false;
  if (!nextTokenIs(b, MACRO_TAG)) return false;
  boolean r, p;
  Marker m = enter_section_(b, l, _NONE_, MACRO, null);
  r = consumeToken(b, MACRO_TAG);
  p = r; // pin = 1
  r = r && report_error_(b, Identifier(b, l + 1));
  r = p && report_error_(b, MacroParams(b, l + 1)) && r;
  r = p && report_error_(b, Macro_3(b, l + 1)) && r;
  r = p && report_error_(b, Macro_4(b, l + 1)) && r;
  r = p && report_error_(b, Macro_5(b, l + 1)) && r;
  r = p && consumeToken(b, MACRO_END_TAG) && r;
  exit_section_(b, l, m, r, p, null);
  return r || p;
}
 
Example #5
Source File: OclYaccParser.java    From reasonml-idea-plugin with MIT License 6 votes vote down vote up
public static boolean rule_pattern(@NotNull PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "rule_pattern")) {
        return false;
    }
    if (!nextTokenIs(b, "<rule pattern>", IDENT, LBRACE)) {
        return false;
    }
    boolean r;
    Marker m = enter_section_(b, l, _NONE_, RULE_PATTERN, "<rule pattern>");
    r = rule_pattern_0(b, l + 1);
    r = r && consumeToken(b, LBRACE);
    r = r && semantic_action(b, l + 1);
    r = r && consumeToken(b, RBRACE);
    exit_section_(b, l, m, r, false, null);
    return r;
}
 
Example #6
Source File: OclYaccParser.java    From reasonml-idea-plugin with MIT License 6 votes vote down vote up
public static boolean declaration(@NotNull PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "declaration")) {
        return false;
    }
    boolean r;
    Marker m = enter_section_(b, l, _NONE_, DECLARATION, "<declaration>");
    r = token_dcl(b, l + 1);
    if (!r) {
        r = start_dcl(b, l + 1);
    }
    if (!r) {
        r = type_dcl(b, l + 1);
    }
    if (!r) {
        r = left_dcl(b, l + 1);
    }
    if (!r) {
        r = right_dcl(b, l + 1);
    }
    exit_section_(b, l, m, r, false, null);
    return r;
}
 
Example #7
Source File: OclYaccParser.java    From reasonml-idea-plugin with MIT License 6 votes vote down vote up
static boolean rules(@NotNull PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "rules")) {
        return false;
    }
    if (!nextTokenIs(b, IDENT)) {
        return false;
    }
    boolean r;
    Marker m = enter_section_(b);
    r = rule(b, l + 1);
    while (r) {
        int c = current_position_(b);
        if (!rule(b, l + 1)) {
            break;
        }
        if (!empty_element_parsed_guard_(b, "rules", c)) {
            break;
        }
    }
    exit_section_(b, m, null, r);
    return r;
}
 
Example #8
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
static boolean MacroParenthesis(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "MacroParenthesis")) return false;
  if (!nextTokenIs(b, ROUND_L)) return false;
  boolean r, p;
  Marker m = enter_section_(b, l, _NONE_);
  r = consumeToken(b, ROUND_L);
  p = r; // pin = 1
  r = r && report_error_(b, MacroParenthesis_1(b, l + 1));
  r = p && consumeToken(b, ROUND_R) && r;
  exit_section_(b, l, m, r, p, null);
  return r || p;
}
 
Example #9
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
public void parseLight(IElementType t, PsiBuilder b) {
  boolean r;
  b = adapt_builder_(t, b, this, EXTENDS_SETS_);
  Marker m = enter_section_(b, 0, _COLLAPSE_, null);
  r = parse_root_(t, b);
  exit_section_(b, 0, m, t, r, true, TRUE_CONDITION);
}
 
Example #10
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
private static boolean SegmentAddress_1_2(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "SegmentAddress_1_2")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = LabelDefMacro(b, l + 1);
  r = r && SegmentAddress_1_2_1(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example #11
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
public static boolean MapOption(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "MapOption")) return false;
  if (!nextTokenIs(b, SQUARE_L)) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, SQUARE_L);
  r = r && MapOption_1(b, l + 1);
  r = r && MapOption_2(b, l + 1);
  r = r && consumeTokens(b, 0, MAP_FILE, SQUARE_R);
  exit_section_(b, m, MAP_OPTION, r);
  return r;
}
 
Example #12
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
private static boolean Struc_3_0_0_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "Struc_3_0_0_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = Struc_3_0_0_0_0(b, l + 1);
  r = r && consumeToken(b, DATA_OP);
  r = r && Struc_3_0_0_0_2(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example #13
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
public static boolean Strlen(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "Strlen")) return false;
  if (!nextTokenIs(b, STRLEN_TAG)) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, STRLEN_TAG);
  r = r && Identifier(b, l + 1);
  r = r && Strlen_2(b, l + 1);
  r = r && Strlen_3(b, l + 1);
  exit_section_(b, m, STRLEN, r);
  return r;
}
 
Example #14
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
private static boolean Address_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "Address_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = Address_0_0(b, l + 1);
  r = r && AddressInternal(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example #15
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
private static boolean Struc_3_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "Struc_3_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = Struc_3_0_0(b, l + 1);
  r = r && Struc_3_0_1(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example #16
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
private static boolean Struc_3_0_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "Struc_3_0_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = Struc_3_0_0_0(b, l + 1);
  if (!r) r = Struc_3_0_0_1(b, l + 1);
  if (!r) r = Conditional(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example #17
Source File: DotEnvParser.java    From idea-php-dotenv-plugin with MIT License 5 votes vote down vote up
public static boolean property(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "property")) return false;
  if (!nextTokenIs(b, KEY_CHARS)) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = property_0(b, l + 1);
  if (!r) r = property_1(b, l + 1);
  exit_section_(b, m, PROPERTY, r);
  return r;
}
 
Example #18
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
private static boolean MapOption_2_0_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "MapOption_2_0_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, "all");
  if (!r) r = consumeToken(b, "ALL");
  exit_section_(b, m, null, r);
  return r;
}
 
Example #19
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
private static boolean MacroParams_0_2(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "MacroParams_0_2")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = NumericLiteral(b, l + 1);
  r = r && MacroParams_0_2_1(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example #20
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
private static boolean MacroParams_0_1(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "MacroParams_0_1")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = NumericLiteral(b, l + 1);
  r = r && consumeTokens(b, 0, MINUS, TIMES);
  exit_section_(b, m, null, r);
  return r;
}
 
Example #21
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
private static boolean MacroParams_0_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "MacroParams_0_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = NumericLiteral(b, l + 1);
  r = r && consumeToken(b, MINUS);
  r = r && NumericLiteral(b, l + 1);
  r = r && MacroParams_0_0_3(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example #22
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
private static boolean MacroParams_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "MacroParams_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = MacroParams_0_0(b, l + 1);
  if (!r) r = MacroParams_0_1(b, l + 1);
  if (!r) r = MacroParams_0_2(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example #23
Source File: SoyParserUtil.java    From bamboo-soy with Apache License 2.0 5 votes vote down vote up
/** Matches a closing tag iff there is frame in the stack which it may close. */
public static boolean parseEndOfStatementBlock(PsiBuilder builder, int level) {
  if (!nextTokenIs(builder, "", LBRACE_SLASH, LBRACE_LBRACE_SLASH)) {
    return false;
  }
  Marker marker = enter_section_(builder);
  boolean r = consumeToken(builder, LBRACE_SLASH) || consumeToken(builder, LBRACE_LBRACE_SLASH);

  IElementType block = null;
  for (IElementType token : closingTokenToBlock.keySet()) {
    if (consumeToken(builder, token)) {
      block = closingTokenToBlock.get(token);
      break;
    }
  }
  if (block == null) {
    // None of the expected closing tags found.
    exit_section_(builder, marker, null, false);
    return false;
  }

  Frame frame = ErrorState.get(builder).currentFrame;
  while (frame != null) {
    if (frame.elementType == block) {
      // Found a frame that matches the closing tag.
      exit_section_(builder, marker, null, true);
      return true;
    }
    frame = frame.parentFrame;
  }

  // No matching frame found.
  exit_section_(builder, marker, null, false);
  return false;
}
 
Example #24
Source File: DotEnvParser.java    From idea-php-dotenv-plugin with MIT License 5 votes vote down vote up
private static boolean item__0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "item__0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = item__0_0(b, l + 1);
  r = r && property(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example #25
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
public static boolean MacroParamReference(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "MacroParamReference")) return false;
  if (!nextTokenIsSmart(b, MACRO_PARAM_REF, SIZE_TYPE)) return false;
  boolean r;
  Marker m = enter_section_(b, l, _NONE_, MACRO_PARAM_REFERENCE, "<macro param reference>");
  r = MacroParamReference_0(b, l + 1);
  r = r && consumeToken(b, MACRO_PARAM_REF);
  exit_section_(b, l, m, r, false, null);
  return r;
}
 
Example #26
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
public static boolean Str(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "Str")) return false;
  if (!nextTokenIsSmart(b, STRING)) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeTokenSmart(b, STRING);
  exit_section_(b, m, STR, r);
  return r;
}
 
Example #27
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
public static boolean LabelDefMacro(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "LabelDefMacro")) return false;
  if (!nextTokenIs(b, ID)) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, ID);
  r = r && MacroParenthesis(b, l + 1);
  r = r && consumeToken(b, COLON);
  r = r && LabelDefMacro_3(b, l + 1);
  exit_section_(b, m, LABEL_DEF_MACRO, r);
  return r;
}
 
Example #28
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
public static boolean StructureField(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "StructureField")) return false;
  if (!nextTokenIsSmart(b, ID_EXTENSION)) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeTokenSmart(b, ID_EXTENSION);
  exit_section_(b, m, STRUCTURE_FIELD, r);
  return r;
}
 
Example #29
Source File: OclYaccParser.java    From reasonml-idea-plugin with MIT License 5 votes vote down vote up
private static boolean rule_body_2_0(@NotNull PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "rule_body_2_0")) {
        return false;
    }
    boolean r;
    Marker m = enter_section_(b);
    r = consumeToken(b, PIPE);
    r = r && rule_pattern(b, l + 1);
    exit_section_(b, m, null, r);
    return r;
}
 
Example #30
Source File: NASMParser.java    From JetBrains-NASM-Language with MIT License 5 votes vote down vote up
public static boolean Label(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "Label")) return false;
  if (!nextTokenIs(b, "<label>", ID, LBL_DEF)) return false;
  boolean r;
  Marker m = enter_section_(b, l, _NONE_, LABEL, "<label>");
  r = Label_0(b, l + 1);
  if (!r) r = Label_1(b, l + 1);
  exit_section_(b, l, m, r, false, null);
  return r;
}