mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:50:54 +07:00
IDEA-248869 [json] Introduce 'parameter' element type
GitOrigin-RevId: 90c701d9022b7b2377f486e1d97bce235f905b2e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5ba1e604b8
commit
c1f5e66af2
@@ -30,6 +30,7 @@ public interface JsonElementTypes {
|
||||
IElementType L_CURLY = new JsonTokenType("{");
|
||||
IElementType NULL = new JsonTokenType("null");
|
||||
IElementType NUMBER = new JsonTokenType("NUMBER");
|
||||
IElementType PARAMETER = new JsonTokenType("PARAMETER");
|
||||
IElementType R_BRACKET = new JsonTokenType("]");
|
||||
IElementType R_CURLY = new JsonTokenType("}");
|
||||
IElementType SINGLE_QUOTED_STRING = new JsonTokenType("SINGLE_QUOTED_STRING");
|
||||
|
||||
@@ -76,7 +76,7 @@ public class JsonParser implements PsiParser, LightPsiParser {
|
||||
r = value(b, l + 1);
|
||||
p = r; // pin = 1
|
||||
r = r && array_element_1(b, l + 1);
|
||||
exit_section_(b, l, m, r, p, not_bracket_or_next_value_parser_);
|
||||
exit_section_(b, l, m, r, p, JsonParser::not_bracket_or_next_value);
|
||||
return r || p;
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ public class JsonParser implements PsiParser, LightPsiParser {
|
||||
r = property(b, l + 1);
|
||||
p = r; // pin = 1
|
||||
r = r && object_element_1(b, l + 1);
|
||||
exit_section_(b, l, m, r, p, not_brace_or_next_value_parser_);
|
||||
exit_section_(b, l, m, r, p, JsonParser::not_brace_or_next_value);
|
||||
return r || p;
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ public class JsonParser implements PsiParser, LightPsiParser {
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// property_name (':' value)
|
||||
// property_name (':' property_value)
|
||||
public static boolean property(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "property")) return false;
|
||||
boolean r, p;
|
||||
@@ -277,14 +277,14 @@ public class JsonParser implements PsiParser, LightPsiParser {
|
||||
return r || p;
|
||||
}
|
||||
|
||||
// ':' value
|
||||
// ':' property_value
|
||||
private static boolean property_1(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "property_1")) return false;
|
||||
boolean r, p;
|
||||
Marker m = enter_section_(b, l, _NONE_);
|
||||
r = consumeToken(b, COLON);
|
||||
p = r; // pin = 1
|
||||
r = r && value(b, l + 1);
|
||||
r = r && property_value(b, l + 1);
|
||||
exit_section_(b, l, m, r, p, null);
|
||||
return r || p;
|
||||
}
|
||||
@@ -299,6 +299,18 @@ public class JsonParser implements PsiParser, LightPsiParser {
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// value | PARAMETER
|
||||
static boolean property_value(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "property_value")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b, l, _NONE_, null, "<value>");
|
||||
r = value(b, l + 1);
|
||||
if (!r) r = consumeToken(b, PARAMETER);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// IDENTIFIER
|
||||
public static boolean reference_expression(PsiBuilder b, int l) {
|
||||
@@ -338,14 +350,4 @@ public class JsonParser implements PsiParser, LightPsiParser {
|
||||
return r;
|
||||
}
|
||||
|
||||
static final Parser not_brace_or_next_value_parser_ = new Parser() {
|
||||
public boolean parse(PsiBuilder b, int l) {
|
||||
return not_brace_or_next_value(b, l + 1);
|
||||
}
|
||||
};
|
||||
static final Parser not_bracket_or_next_value_parser_ = new Parser() {
|
||||
public boolean parse(PsiBuilder b, int l) {
|
||||
return not_bracket_or_next_value(b, l + 1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -78,7 +78,9 @@ private object_element ::= property (','|&'}') {
|
||||
pin = 1
|
||||
}
|
||||
|
||||
property ::= property_name (':' value) {
|
||||
private property_value ::= value | PARAMETER {name="value"}
|
||||
|
||||
property ::= property_name (':' property_value) {
|
||||
methods=[
|
||||
getName
|
||||
getNameElement
|
||||
|
||||
Reference in New Issue
Block a user