2 parserClass = 'com.intellij.json.JsonParser'
3 parserUtilClass = "com.intellij.json.psi.JsonParserUtil"
4 psiPackage = 'com.intellij.json.psi'
5 psiImplPackage = 'com.intellij.json.psi.impl'
7 elementTypeHolderClass = 'com.intellij.json.JsonElementTypes'
8 elementTypeClass = 'com.intellij.json.JsonElementType'
9 psiClassPrefix = "Json"
10 psiVisitorName = "JsonElementVisitor"
12 psiImplUtilClass = 'com.intellij.json.psi.impl.JsonPsiImplUtils'
13 tokenTypeClass = 'com.intellij.json.JsonTokenType'
15 implements("value") = "com.intellij.json.psi.JsonElement"
16 extends("value") = "com.intellij.json.psi.impl.JsonElementImpl"
26 LINE_COMMENT='regexp://.*'
27 // "/*" ([^*]|\*+[^*/])* (\*+"/")?
28 BLOCK_COMMENT='regexp:/\*([^*]|\*+[^*/])*(\*+/)?'
29 // else /\*(?:[^*]|\*[^/])*\*+/
31 // unclosed string literal matches till the line's end
32 // any escape sequences included, illegal escapes are indicated by SyntaxHighlighter
33 // and JsonStringLiteralAnnotator
34 DOUBLE_QUOTED_STRING="regexp:\"([^\\\"\r\n]|\\[^\r\n])*\"?"
35 SINGLE_QUOTED_STRING="regexp:'([^\\\'\r\n]|\\[^\r\n])*'?"
36 // STRING='regexp:"([^\\"\r\n]|\\([\\"/bfnrt]|u[a-fA-F0-9]{4}))*"?'
38 NUMBER='regexp:-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d*)?'
42 // Actually not defined in RFC 4627, but may be used for JSON5 and helps with
43 // auto completion of keywords.
44 IDENTIFIER='regexp:[:jletter:] [:jletterdigit:]*'
47 extends("container|literal|reference_expression")=value
48 extends("array|object")=container
49 extends("string_literal|number_literal|boolean_literal|null_literal")=literal
50 implements("property")=[
51 "com.intellij.json.psi.JsonElement"
52 "com.intellij.psi.PsiNamedElement"
56 // For compatibility we allow any value at root level (see JsonStandardComplianceAnnotator)
59 object ::= '{' object_element* '}' {
65 mixin="com.intellij.json.psi.impl.JsonObjectMixin"
68 // Hackity-hack to parse array elements and properties even if separating commas are missing,
69 // TODO: Find out if there is any simpler way to do so in GrammarKit
70 private object_element ::= property (','|&'}') {
71 recoverWhile = not_brace_or_next_value
75 property ::= property_name (':' value) {
80 // suppress getValueList() accessor
84 mixin="com.intellij.json.psi.impl.JsonPropertyMixin"
88 private property_name ::= literal | reference_expression
90 array ::= '[' array_element* ']' {
97 private array_element ::= value (','|&']') {
98 recoverWhile = not_bracket_or_next_value
102 string_literal ::= SINGLE_QUOTED_STRING | DOUBLE_QUOTED_STRING {
106 SINGLE_QUOTED_STRING=""
107 DOUBLE_QUOTED_STRING=""
109 mixin="com.intellij.json.psi.impl.JsonStringLiteralMixin"
111 number_literal ::= NUMBER {
117 boolean_literal ::= TRUE | FALSE {
122 null_literal ::= NULL
124 literal ::= string_literal | number_literal | boolean_literal | null_literal {
128 mixin="com.intellij.json.psi.impl.JsonLiteralMixin"
133 reference_expression ::= IDENTIFIER
135 value ::= object | array | literal | reference_expression
138 private not_bracket_or_next_value ::= !(']'|value)
139 private not_brace_or_next_value ::= !('}'|value)