mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
Fix typo in the name of IDENTIFIER token type in JSON grammar
I re-generated JFlex lexer and GrammarKit parser accordingly. I had to adjust the macro for WHITE_SPACE token, though, since GrammarKit generates weird "WHITE_SPACE=\s" for some reason.
This commit is contained in:
@@ -24,7 +24,7 @@ public interface JsonElementTypes {
|
||||
IElementType COMMA = new JsonTokenType(",");
|
||||
IElementType DOUBLE_QUOTED_STRING = new JsonTokenType("DOUBLE_QUOTED_STRING");
|
||||
IElementType FALSE = new JsonTokenType("false");
|
||||
IElementType INDENTIFIER = new JsonTokenType("INDENTIFIER");
|
||||
IElementType IDENTIFIER = new JsonTokenType("IDENTIFIER");
|
||||
IElementType LINE_COMMENT = new JsonTokenType("LINE_COMMENT");
|
||||
IElementType L_BRACKET = new JsonTokenType("[");
|
||||
IElementType L_CURLY = new JsonTokenType("{");
|
||||
|
||||
@@ -341,13 +341,13 @@ public class JsonParser implements PsiParser, LightPsiParser {
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// INDENTIFIER
|
||||
// IDENTIFIER
|
||||
public static boolean reference_expression(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "reference_expression")) return false;
|
||||
if (!nextTokenIs(b, INDENTIFIER)) return false;
|
||||
if (!nextTokenIs(b, IDENTIFIER)) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = consumeToken(b, INDENTIFIER);
|
||||
r = consumeToken(b, IDENTIFIER);
|
||||
exit_section_(b, m, REFERENCE_EXPRESSION, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* The following code was generated by JFlex 1.7.0-SNAPSHOT tweaked for IntelliJ platform */
|
||||
|
||||
package com.intellij.json;
|
||||
|
||||
import com.intellij.lexer.*;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import static com.intellij.psi.TokenType.*;
|
||||
import static com.intellij.json.JsonElementTypes.*;
|
||||
|
||||
|
||||
@@ -127,10 +127,10 @@ public class _JsonLexer implements FlexLexer {
|
||||
|
||||
/* The ZZ_CMAP_A table has 1704 entries */
|
||||
static final char ZZ_CMAP_A[] = zzUnpackCMap(
|
||||
"\11\21\1\1\1\3\2\4\1\3\6\21\4\0\1\1\1\0\1\7\1\0\1\20\2\0\1\11\2\0\1\6\1\17"+
|
||||
"\1\26\1\12\1\15\1\2\1\13\11\14\1\27\6\0\4\20\1\16\15\20\1\24\1\10\1\25\1\0"+
|
||||
"\11\21\1\3\1\2\2\1\1\2\6\21\4\0\1\3\1\0\1\7\1\0\1\20\2\0\1\11\2\0\1\6\1\17"+
|
||||
"\1\26\1\12\1\15\1\4\1\13\11\14\1\27\6\0\4\20\1\16\15\20\1\24\1\10\1\25\1\0"+
|
||||
"\1\20\1\0\1\35\3\20\1\33\1\34\5\20\1\36\1\20\1\40\3\20\1\31\1\37\1\30\1\32"+
|
||||
"\5\20\1\22\1\0\1\23\1\0\6\21\1\5\2\21\1\1\1\0\4\20\4\0\1\20\2\0\1\21\7\0\1"+
|
||||
"\5\20\1\22\1\0\1\23\1\0\6\21\1\5\2\21\1\3\1\0\4\20\4\0\1\20\2\0\1\21\7\0\1"+
|
||||
"\20\4\0\1\20\5\0\7\20\1\0\2\20\4\0\4\20\16\0\5\20\7\0\1\20\1\0\1\20\1\0\5"+
|
||||
"\20\1\0\2\20\2\0\4\20\10\0\1\20\1\0\3\20\1\0\1\20\1\0\4\20\1\0\13\20\1\0\3"+
|
||||
"\20\1\0\5\21\2\0\6\20\1\0\7\20\1\0\1\20\15\0\1\20\1\0\15\21\1\0\1\21\1\0\2"+
|
||||
@@ -151,13 +151,13 @@ public class _JsonLexer implements FlexLexer {
|
||||
"\4\20\1\0\3\20\1\0\1\20\1\0\1\20\2\0\2\20\1\0\3\20\2\21\1\0\2\21\1\20\2\0"+
|
||||
"\5\20\1\0\1\20\1\0\6\21\2\0\2\21\2\0\4\20\5\0\1\21\1\0\1\21\1\0\1\21\4\0\2"+
|
||||
"\21\5\20\3\21\6\0\1\21\1\0\7\21\1\20\2\21\4\20\3\21\1\20\3\21\2\20\7\21\3"+
|
||||
"\20\4\21\5\20\14\21\1\20\1\21\3\20\1\0\7\20\2\0\3\21\1\1\11\20\3\21\3\0\2"+
|
||||
"\20\4\21\5\20\14\21\1\20\1\21\3\20\1\0\7\20\2\0\3\21\1\3\11\20\3\21\3\0\2"+
|
||||
"\20\2\21\4\0\1\20\1\0\2\21\4\0\4\20\10\21\3\0\1\20\3\0\2\20\1\21\5\0\3\21"+
|
||||
"\2\0\1\20\1\21\1\20\5\0\6\20\2\0\5\21\3\20\3\0\10\21\5\20\2\21\3\0\3\20\3"+
|
||||
"\21\1\0\5\21\4\20\1\21\4\20\3\21\2\20\2\0\1\20\1\0\1\20\1\0\1\20\1\0\1\20"+
|
||||
"\2\0\3\20\1\0\6\20\2\0\2\20\13\1\5\21\2\4\5\21\1\1\4\0\1\20\12\0\1\1\2\0\6"+
|
||||
"\2\0\3\20\1\0\6\20\2\0\2\20\13\3\5\21\2\1\5\21\1\3\4\0\1\20\12\0\1\3\2\0\6"+
|
||||
"\21\1\0\1\21\3\0\4\21\11\0\1\20\4\0\1\20\1\0\5\20\2\0\1\20\1\0\4\20\1\0\3"+
|
||||
"\20\2\0\4\20\5\0\5\20\4\0\1\20\4\0\4\20\3\21\2\20\4\0\1\1\4\0\3\20\1\0\2\21"+
|
||||
"\20\2\0\4\20\5\0\5\20\4\0\1\20\4\0\4\20\3\21\2\20\4\0\1\3\4\0\3\20\1\0\2\21"+
|
||||
"\2\0\3\20\6\21\1\0\2\20\2\0\4\20\1\0\2\20\1\21\3\20\1\21\4\20\1\21\10\20\2"+
|
||||
"\21\4\0\1\20\1\21\4\0\1\21\5\20\2\21\3\0\3\20\4\0\3\20\2\21\2\0\6\20\1\0\3"+
|
||||
"\21\1\0\2\21\5\0\5\20\5\0\1\20\1\21\3\20\1\0\2\20\1\0\7\20\2\0\1\21\6\0\2"+
|
||||
@@ -235,12 +235,12 @@ public class _JsonLexer implements FlexLexer {
|
||||
private static final int [] ZZ_TRANS = zzUnpackTrans();
|
||||
|
||||
private static final String ZZ_TRANS_PACKED_0 =
|
||||
"\1\2\1\3\1\4\3\3\1\2\1\5\1\2\1\6"+
|
||||
"\1\2\3\3\1\4\1\3\1\2\1\5\1\2\1\6"+
|
||||
"\1\7\1\10\1\11\1\2\1\12\1\2\1\12\1\2"+
|
||||
"\1\13\1\14\1\15\1\16\1\17\1\20\1\21\3\12"+
|
||||
"\1\22\3\12\1\23\42\0\1\3\1\0\3\3\35\0"+
|
||||
"\1\24\3\0\1\25\32\0\3\5\1\0\3\5\1\26"+
|
||||
"\1\27\30\5\3\6\1\0\4\6\1\30\1\31\27\6"+
|
||||
"\1\22\3\12\1\23\42\0\3\3\1\0\1\3\37\0"+
|
||||
"\1\24\1\0\1\25\32\0\2\5\1\0\4\5\1\26"+
|
||||
"\1\27\30\5\2\6\1\0\5\6\1\30\1\31\27\6"+
|
||||
"\13\0\1\10\1\11\41\0\1\32\1\33\14\0\1\33"+
|
||||
"\20\0\2\11\1\32\1\33\14\0\1\33\12\0\1\12"+
|
||||
"\5\0\2\12\1\0\1\12\1\0\2\12\6\0\11\12"+
|
||||
@@ -248,21 +248,22 @@ public class _JsonLexer implements FlexLexer {
|
||||
"\6\0\1\12\1\34\7\12\5\0\1\12\5\0\2\12"+
|
||||
"\1\0\1\12\1\0\2\12\6\0\5\12\1\35\3\12"+
|
||||
"\5\0\1\12\5\0\2\12\1\0\1\12\1\0\2\12"+
|
||||
"\6\0\2\12\1\36\6\12\3\24\3\0\33\24\6\25"+
|
||||
"\1\37\32\25\3\5\1\0\35\5\3\6\1\0\35\6"+
|
||||
"\13\0\2\40\36\0\3\41\2\0\1\41\26\0\1\12"+
|
||||
"\5\0\2\12\1\0\1\12\1\0\2\12\6\0\2\12"+
|
||||
"\1\42\6\12\5\0\1\12\5\0\2\12\1\0\1\12"+
|
||||
"\1\0\2\12\6\0\6\12\1\43\2\12\5\0\1\12"+
|
||||
"\5\0\2\12\1\0\1\12\1\0\2\12\6\0\6\12"+
|
||||
"\1\44\2\12\2\25\1\45\3\25\1\37\32\25\13\0"+
|
||||
"\2\40\1\0\1\33\14\0\1\33\20\0\2\41\31\0"+
|
||||
"\1\12\5\0\2\12\1\0\1\12\1\0\2\12\6\0"+
|
||||
"\3\12\1\46\5\12\5\0\1\12\5\0\2\12\1\0"+
|
||||
"\1\12\1\0\2\12\6\0\7\12\1\47\1\12\5\0"+
|
||||
"\1\12\5\0\2\12\1\0\1\12\1\0\2\12\6\0"+
|
||||
"\6\12\1\50\2\12\5\0\1\12\5\0\2\12\1\0"+
|
||||
"\1\12\1\0\2\12\6\0\3\12\1\51\5\12";
|
||||
"\6\0\2\12\1\36\6\12\1\24\2\0\2\24\1\0"+
|
||||
"\33\24\6\25\1\37\32\25\2\5\1\0\36\5\2\6"+
|
||||
"\1\0\36\6\13\0\2\40\36\0\3\41\2\0\1\41"+
|
||||
"\26\0\1\12\5\0\2\12\1\0\1\12\1\0\2\12"+
|
||||
"\6\0\2\12\1\42\6\12\5\0\1\12\5\0\2\12"+
|
||||
"\1\0\1\12\1\0\2\12\6\0\6\12\1\43\2\12"+
|
||||
"\5\0\1\12\5\0\2\12\1\0\1\12\1\0\2\12"+
|
||||
"\6\0\6\12\1\44\2\12\4\25\1\45\1\25\1\37"+
|
||||
"\32\25\13\0\2\40\1\0\1\33\14\0\1\33\20\0"+
|
||||
"\2\41\31\0\1\12\5\0\2\12\1\0\1\12\1\0"+
|
||||
"\2\12\6\0\3\12\1\46\5\12\5\0\1\12\5\0"+
|
||||
"\2\12\1\0\1\12\1\0\2\12\6\0\7\12\1\47"+
|
||||
"\1\12\5\0\1\12\5\0\2\12\1\0\1\12\1\0"+
|
||||
"\2\12\6\0\6\12\1\50\2\12\5\0\1\12\5\0"+
|
||||
"\2\12\1\0\1\12\1\0\2\12\6\0\3\12\1\51"+
|
||||
"\5\12";
|
||||
|
||||
private static int [] zzUnpackTrans() {
|
||||
int [] result = new int[957];
|
||||
@@ -613,11 +614,11 @@ public class _JsonLexer implements FlexLexer {
|
||||
else {
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 1:
|
||||
{ return BAD_CHARACTER;
|
||||
{ return com.intellij.psi.TokenType.BAD_CHARACTER;
|
||||
}
|
||||
case 18: break;
|
||||
case 2:
|
||||
{ return WHITE_SPACE;
|
||||
{ return com.intellij.psi.TokenType.WHITE_SPACE;
|
||||
}
|
||||
case 19: break;
|
||||
case 3:
|
||||
@@ -633,7 +634,7 @@ public class _JsonLexer implements FlexLexer {
|
||||
}
|
||||
case 22: break;
|
||||
case 6:
|
||||
{ return INDENTIFIER;
|
||||
{ return IDENTIFIER;
|
||||
}
|
||||
case 23: break;
|
||||
case 7:
|
||||
|
||||
@@ -8,6 +8,6 @@ import com.intellij.psi.PsiElement;
|
||||
public interface JsonReferenceExpression extends JsonValue {
|
||||
|
||||
@NotNull
|
||||
PsiElement getIndentifier();
|
||||
PsiElement getIdentifier();
|
||||
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ public class JsonReferenceExpressionImpl extends JsonValueImpl implements JsonRe
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiElement getIndentifier() {
|
||||
return findNotNullChildByType(INDENTIFIER);
|
||||
public PsiElement getIdentifier() {
|
||||
return findNotNullChildByType(IDENTIFIER);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
NULL='null'
|
||||
// Actually not defined in RFC 4627, but may be used for JSON5 and helps with
|
||||
// auto completion of keywords.
|
||||
INDENTIFIER='regexp:[:jletter:] [:jletterdigit:]*'
|
||||
IDENTIFIER='regexp:[:jletter:] [:jletterdigit:]*'
|
||||
]
|
||||
|
||||
extends("container|literal|reference_expression")=value
|
||||
@@ -130,7 +130,7 @@ literal ::= string_literal | number_literal | boolean_literal | null_literal {
|
||||
|
||||
fake container ::=
|
||||
|
||||
reference_expression ::= INDENTIFIER
|
||||
reference_expression ::= IDENTIFIER
|
||||
|
||||
value ::= object | array | literal | reference_expression
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.intellij.json;
|
||||
|
||||
import com.intellij.lexer.*;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import static com.intellij.psi.TokenType.*;
|
||||
import static com.intellij.json.JsonElementTypes.*;
|
||||
|
||||
%%
|
||||
@@ -19,6 +19,8 @@ import static com.intellij.json.JsonElementTypes.*;
|
||||
%type IElementType
|
||||
%unicode
|
||||
|
||||
EOL=\R
|
||||
// Edited manually, GrammarKit generates plain "\s" (no iteration)
|
||||
WHITE_SPACE=\s+
|
||||
|
||||
LINE_COMMENT="//".*
|
||||
@@ -26,11 +28,11 @@ BLOCK_COMMENT="/"\*([^*]|\*+[^*/])*(\*+"/")?
|
||||
DOUBLE_QUOTED_STRING=\"([^\\\"\r\n]|\\[^\r\n])*\"?
|
||||
SINGLE_QUOTED_STRING='([^\\'\r\n]|\\[^\r\n])*'?
|
||||
NUMBER=-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]*)?
|
||||
INDENTIFIER=[:jletter:] [:jletterdigit:]*
|
||||
IDENTIFIER=[:jletter:] [:jletterdigit:]*
|
||||
|
||||
%%
|
||||
<YYINITIAL> {
|
||||
{WHITE_SPACE} { return WHITE_SPACE; }
|
||||
{WHITE_SPACE} { return com.intellij.psi.TokenType.WHITE_SPACE; }
|
||||
|
||||
"{" { return L_CURLY; }
|
||||
"}" { return R_CURLY; }
|
||||
@@ -47,8 +49,8 @@ INDENTIFIER=[:jletter:] [:jletterdigit:]*
|
||||
{DOUBLE_QUOTED_STRING} { return DOUBLE_QUOTED_STRING; }
|
||||
{SINGLE_QUOTED_STRING} { return SINGLE_QUOTED_STRING; }
|
||||
{NUMBER} { return NUMBER; }
|
||||
{INDENTIFIER} { return INDENTIFIER; }
|
||||
{IDENTIFIER} { return IDENTIFIER; }
|
||||
|
||||
}
|
||||
|
||||
[^] { return BAD_CHARACTER; }
|
||||
[^] { return com.intellij.psi.TokenType.BAD_CHARACTER; }
|
||||
|
||||
@@ -13,7 +13,7 @@ import static com.intellij.json.JsonParserDefinition.JSON_LITERALS;
|
||||
*/
|
||||
public class JsonWordScanner extends DefaultWordsScanner {
|
||||
public JsonWordScanner() {
|
||||
super(new JsonLexer(), TokenSet.create(JsonElementTypes.INDENTIFIER), JSON_COMMENTARIES, JSON_LITERALS);
|
||||
super(new JsonLexer(), TokenSet.create(JsonElementTypes.IDENTIFIER), JSON_COMMENTARIES, JSON_LITERALS);
|
||||
setMayHaveFileRefsInLiterals(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class JsonSyntaxHighlighterFactory extends SyntaxHighlighterFactory {
|
||||
fillMap(ourAttributes, JSON_LINE_COMMENT, JsonElementTypes.LINE_COMMENT);
|
||||
fillMap(ourAttributes, JSON_BLOCK_COMMENT, JsonElementTypes.BLOCK_COMMENT);
|
||||
// TODO may be it's worth to add more sensible highlighting for identifiers
|
||||
fillMap(ourAttributes, JSON_IDENTIFIER, JsonElementTypes.INDENTIFIER);
|
||||
fillMap(ourAttributes, JSON_IDENTIFIER, JsonElementTypes.IDENTIFIER);
|
||||
fillMap(ourAttributes, HighlighterColors.BAD_CHARACTER, TokenType.BAD_CHARACTER);
|
||||
|
||||
fillMap(ourAttributes, JSON_VALID_ESCAPE, StringEscapesTokenTypes.VALID_STRING_ESCAPE_TOKEN);
|
||||
|
||||
@@ -40,7 +40,7 @@ JsonFile: NonStandardPropertyKeys.json
|
||||
PsiWhiteSpace('\n ')
|
||||
JsonProperty
|
||||
JsonReferenceExpression
|
||||
PsiElement(INDENTIFIER)('identifier')
|
||||
PsiElement(IDENTIFIER)('identifier')
|
||||
PsiElement(:)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
JsonNullLiteral
|
||||
|
||||
@@ -67,7 +67,7 @@ JsonFile: NumberLiterals.json
|
||||
PsiElement(,)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
JsonReferenceExpression
|
||||
PsiElement(INDENTIFIER)('e2')
|
||||
PsiElement(IDENTIFIER)('e2')
|
||||
PsiElement(,)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
JsonNumberLiteral
|
||||
@@ -113,13 +113,13 @@ JsonFile: NumberLiterals.json
|
||||
PsiErrorElement:',' or ']' expected, got '.'
|
||||
PsiElement(BAD_CHARACTER)('.')
|
||||
JsonReferenceExpression
|
||||
PsiElement(INDENTIFIER)('e2')
|
||||
PsiElement(IDENTIFIER)('e2')
|
||||
PsiElement(,)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiErrorElement:'.' unexpected
|
||||
PsiElement(BAD_CHARACTER)('.')
|
||||
JsonReferenceExpression
|
||||
PsiElement(INDENTIFIER)('e2')
|
||||
PsiElement(IDENTIFIER)('e2')
|
||||
PsiElement(,)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
JsonNumberLiteral
|
||||
@@ -127,7 +127,7 @@ JsonFile: NumberLiterals.json
|
||||
PsiErrorElement:',' or ']' expected, got '.'
|
||||
PsiElement(BAD_CHARACTER)('.')
|
||||
JsonReferenceExpression
|
||||
PsiElement(INDENTIFIER)('e')
|
||||
PsiElement(IDENTIFIER)('e')
|
||||
PsiElement(,)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
JsonNumberLiteral
|
||||
|
||||
Reference in New Issue
Block a user