Modify JSON grammar to match more general text as IDENTIFIER tokens

It simplifies implementation of completion contributors that
are supposed to give aid in writing various configuration files
making it's possible to start typing some structured content
of a string literal (in particular, name of npm package) not
putting it in quotes first and without need to deal with a series
of TokenType.BAD_CHARACTERs in PSI.

Additionally, in the standard compliance inspection IDENTIFIERS are now
reported as "illegal tokens", since, striclty speaking, they're no
longer just identifiers (though the name is quite confusing now).
This commit is contained in:
Mikhail Golubev
2017-01-19 15:07:59 +03:00
parent 8829e112cf
commit 3cea313480
11 changed files with 215 additions and 224 deletions
+148 -163
View File
@@ -2,8 +2,11 @@
package com.intellij.json;
import com.intellij.lexer.*;
import com.intellij.lexer.FlexLexer;
import com.intellij.psi.tree.IElementType;
import static com.intellij.psi.TokenType.BAD_CHARACTER;
import static com.intellij.psi.TokenType.WHITE_SPACE;
import static com.intellij.json.JsonElementTypes.*;
@@ -36,7 +39,7 @@ public class _JsonLexer implements FlexLexer {
/**
* Translates characters to character classes
* Chosen bits are [12, 6, 3]
* Total runtime size is 14928 bytes
* Total runtime size is 13360 bytes
*/
public static int ZZ_CMAP(int ch) {
return ZZ_CMAP_A[(ZZ_CMAP_Y[(ZZ_CMAP_Z[ch>>9]<<6)|((ch>>3)&0x3f)]<<3)|(ch&0x7)];
@@ -53,119 +56,91 @@ public class _JsonLexer implements FlexLexer {
/* The ZZ_CMAP_Y table has 3584 entries */
static final char ZZ_CMAP_Y[] = zzUnpackCMap(
"\1\0\1\1\1\0\1\2\1\3\1\4\1\5\1\6\1\7\2\10\1\11\1\12\1\13\1\14\1\15\1\16\3"+
"\0\1\17\1\20\1\21\1\22\2\10\1\23\3\10\1\23\71\10\1\24\1\10\1\25\1\26\1\27"+
"\1\30\2\26\16\0\1\31\1\32\1\33\1\34\2\10\1\35\11\10\1\36\21\10\1\37\1\40\23"+
"\10\1\26\1\41\3\10\1\23\1\42\1\41\4\10\1\43\1\44\4\0\1\45\1\46\1\26\3\10\2"+
"\47\1\26\1\50\1\51\1\0\1\52\5\10\1\53\3\0\1\54\1\55\13\10\1\56\1\45\1\57\1"+
"\60\1\0\1\61\1\26\1\62\1\63\3\10\3\0\1\64\12\10\1\65\1\0\1\66\1\26\1\0\1\67"+
"\3\10\1\53\1\70\1\22\2\10\1\65\1\71\1\72\1\73\2\26\3\10\1\74\10\26\1\75\1"+
"\27\6\26\1\76\2\0\1\77\1\100\6\10\1\101\2\0\1\102\1\10\1\103\1\0\2\41\1\104"+
"\1\105\1\106\2\10\1\75\1\107\1\110\1\111\1\112\1\62\1\113\1\103\1\0\1\114"+
"\1\51\1\104\1\115\1\106\2\10\1\75\1\116\1\117\1\120\1\121\1\122\1\123\1\124"+
"\1\0\1\125\1\26\1\104\1\36\1\35\2\10\1\75\1\126\1\110\1\45\1\127\1\130\1\26"+
"\1\103\1\0\1\42\1\26\1\104\1\105\1\106\2\10\1\75\1\126\1\110\1\111\1\121\1"+
"\124\1\113\1\103\1\0\1\42\1\26\1\131\1\132\1\133\1\134\1\135\1\132\1\10\1"+
"\136\1\137\1\140\1\141\1\26\1\124\1\0\1\26\1\42\1\104\1\31\1\75\2\10\1\75"+
"\1\142\1\143\1\144\1\140\1\145\1\25\1\103\1\0\2\26\1\146\1\31\1\75\2\10\1"+
"\75\1\142\1\110\1\144\1\140\1\145\1\33\1\103\1\0\1\147\1\26\1\146\1\31\1\75"+
"\4\10\1\150\1\144\1\151\1\62\1\26\1\103\1\0\1\26\1\40\1\146\1\10\1\23\1\40"+
"\2\10\1\35\1\152\1\23\1\153\1\154\1\0\2\26\1\155\1\26\1\41\5\10\1\156\1\157"+
"\1\160\1\77\1\0\1\161\4\26\1\162\1\163\1\164\1\41\1\165\1\166\1\156\1\167"+
"\1\170\1\171\1\0\1\172\4\26\1\130\2\26\1\161\1\0\1\161\1\173\1\174\1\10\1"+
"\41\3\10\1\27\1\44\1\0\1\144\1\175\1\0\1\44\3\0\1\50\1\176\7\26\5\10\1\53"+
"\1\0\1\177\1\0\1\161\1\65\1\200\1\201\1\202\1\203\1\10\1\204\1\205\1\0\1\171"+
"\4\10\1\36\1\21\5\10\1\206\51\10\1\133\1\23\1\133\5\10\1\133\4\10\1\133\1"+
"\23\1\133\1\10\1\23\7\10\1\133\10\10\1\207\4\26\2\10\2\26\12\10\1\27\1\26"+
"\1\41\114\10\1\105\2\10\1\210\2\10\1\47\11\10\1\132\1\130\1\26\1\10\1\31\1"+
"\211\1\26\2\10\1\211\1\26\2\10\1\212\1\26\1\10\1\31\1\213\1\26\6\10\1\214"+
"\3\0\1\215\1\216\1\0\1\161\3\26\1\217\1\0\1\161\13\10\1\26\5\10\1\220\10\10"+
"\1\221\1\26\3\10\1\27\1\0\1\2\1\0\1\2\1\124\1\0\3\10\1\221\1\27\1\26\5\10"+
"\1\114\2\0\1\55\1\161\1\0\1\161\4\26\2\10\1\160\1\2\6\10\1\175\1\77\3\0\1"+
"\111\1\0\1\161\1\0\1\161\1\43\13\26\1\222\5\10\1\214\1\0\1\222\1\114\1\0\1"+
"\161\1\26\1\223\1\2\1\26\1\224\3\10\1\102\1\202\1\0\1\67\4\10\1\65\1\0\1\2"+
"\1\26\4\10\1\214\2\0\1\26\1\0\1\225\1\0\1\67\3\10\1\221\12\26\1\226\2\0\1"+
"\227\1\230\1\26\30\10\4\0\1\77\2\26\1\76\42\10\2\221\4\10\2\221\1\10\1\231"+
"\3\10\1\221\6\10\1\31\1\170\1\232\1\27\1\233\1\114\1\10\1\27\1\232\1\27\1"+
"\234\1\235\3\26\1\236\1\26\1\43\1\130\1\26\1\237\1\240\1\50\1\241\1\42\1\43"+
"\2\26\1\10\1\27\3\10\1\47\2\26\1\0\1\50\1\242\1\0\1\243\1\26\1\244\1\40\1"+
"\152\1\245\1\30\1\246\1\10\1\247\1\250\1\251\2\26\5\10\1\130\116\26\5\10\1"+
"\23\5\10\1\23\20\10\1\27\1\252\1\253\1\26\4\10\1\36\1\21\7\10\1\43\1\26\1"+
"\62\2\10\1\23\1\26\10\23\4\0\5\26\1\43\72\26\1\254\3\26\1\41\1\204\1\245\1"+
"\27\1\41\11\10\1\23\1\255\1\41\12\10\1\206\1\250\4\10\1\221\1\41\12\10\1\23"+
"\2\26\3\10\1\47\6\26\170\10\1\221\11\26\71\10\1\27\6\26\21\10\1\27\10\26\5"+
"\10\1\221\41\10\1\27\2\10\1\0\1\253\2\26\5\10\1\160\1\76\1\256\3\10\1\62\12"+
"\10\1\161\3\26\1\43\1\10\1\40\14\10\1\257\1\114\1\26\1\10\1\47\11\26\1\10"+
"\1\260\1\261\2\10\1\53\2\26\1\130\6\10\1\114\1\26\1\67\5\10\1\214\1\0\1\50"+
"\1\26\1\0\1\161\2\0\1\67\1\51\1\0\1\67\2\10\1\65\1\171\2\10\1\160\1\0\1\2"+
"\1\26\3\10\1\27\1\100\5\10\1\53\1\0\1\243\1\43\1\0\1\161\4\26\5\10\1\102\1"+
"\77\1\26\1\261\1\262\1\0\1\161\2\10\1\23\1\263\6\10\1\201\1\264\1\220\2\26"+
"\1\265\1\10\1\53\1\266\1\26\3\267\1\26\2\23\22\26\4\10\1\53\1\270\1\0\1\161"+
"\64\10\1\114\1\26\2\10\1\23\1\271\5\10\1\114\40\26\55\10\1\221\15\10\1\25"+
"\4\26\1\23\1\26\1\271\1\272\1\10\1\75\1\23\1\170\1\273\15\10\1\25\3\26\1\271"+
"\54\10\1\221\2\26\10\10\1\40\6\10\5\26\1\10\1\27\2\0\2\26\1\77\1\26\1\135"+
"\2\26\1\250\3\26\1\42\1\31\20\10\1\274\1\237\1\26\1\0\1\161\1\41\2\10\1\115"+
"\1\41\2\10\1\47\1\275\12\10\1\23\3\40\1\276\1\277\2\26\1\300\1\10\1\142\2"+
"\10\1\23\2\10\1\301\1\10\1\221\1\10\1\221\4\26\17\10\1\47\10\26\6\10\1\27"+
"\20\26\1\302\20\26\3\10\1\27\6\10\1\130\5\26\3\10\1\23\2\26\3\10\1\47\6\26"+
"\3\10\1\221\4\10\1\114\1\10\1\245\5\26\23\10\1\221\1\0\1\161\52\26\1\221\1"+
"\75\4\10\1\36\1\303\2\10\1\221\25\26\2\10\1\221\1\26\3\10\1\25\10\26\7\10"+
"\1\275\10\26\1\304\1\76\1\142\1\41\2\10\1\114\1\120\4\26\3\10\1\27\20\26\6"+
"\10\1\221\1\26\2\10\1\221\1\26\2\10\1\47\21\26\11\10\1\130\66\26\1\224\6\10"+
"\1\0\1\77\3\26\1\124\1\0\2\26\1\224\5\10\1\0\1\305\2\26\3\10\1\130\1\0\1\161"+
"\1\224\3\10\1\160\1\0\1\144\1\0\10\26\1\224\5\10\1\53\1\0\1\306\1\26\1\0\1"+
"\161\24\26\5\10\1\53\1\0\1\26\1\0\1\161\46\26\55\10\1\23\22\26\14\10\1\47"+
"\63\26\5\10\1\23\72\26\7\10\1\130\130\26\10\10\1\27\1\26\1\102\4\0\1\77\1"+
"\26\1\62\1\224\1\10\14\26\1\25\153\26\1\307\1\310\2\0\1\311\1\2\3\26\1\312"+
"\22\26\1\313\67\26\12\10\1\31\10\10\1\31\1\314\1\315\1\10\1\316\1\142\7\10"+
"\1\36\1\317\2\31\3\10\1\320\1\170\1\40\1\75\51\10\1\221\3\10\1\75\2\10\1\206"+
"\3\10\1\206\2\10\1\31\3\10\1\31\2\10\1\23\3\10\1\23\3\10\1\75\3\10\1\75\2"+
"\10\1\206\1\321\6\0\1\142\3\10\1\162\1\41\1\206\1\322\1\244\1\323\1\162\1"+
"\231\1\162\2\206\1\123\1\10\1\35\1\10\1\114\1\324\1\35\1\10\1\114\50\26\32"+
"\10\1\23\5\26\106\10\1\27\1\26\33\10\1\221\74\26\1\122\3\26\14\0\20\26\36"+
"\0\2\26");
"\1\0\1\1\1\0\1\2\1\3\1\4\1\5\1\6\1\7\2\0\1\10\1\11\1\12\1\13\1\14\1\15\3\0"+
"\1\16\1\17\1\20\1\21\2\0\1\22\3\0\1\22\71\0\1\23\1\0\1\24\1\25\1\26\1\27\2"+
"\25\16\0\1\30\1\31\1\32\1\33\2\0\1\34\11\0\1\35\21\0\1\34\1\36\23\0\1\25\1"+
"\37\3\0\1\22\1\40\1\37\4\0\1\41\1\37\4\0\1\35\1\42\1\25\3\0\2\43\1\25\1\26"+
"\1\44\1\0\1\43\11\0\1\23\14\0\1\45\1\35\1\0\1\46\1\0\1\47\1\25\1\41\7\0\1"+
"\50\14\0\1\24\1\25\6\0\1\51\1\21\5\0\1\51\2\25\3\0\1\2\10\25\1\46\1\26\6\25"+
"\1\52\2\0\1\22\14\0\1\53\1\0\2\37\1\54\1\47\1\55\2\0\1\46\1\56\1\57\1\47\1"+
"\60\1\41\1\61\1\53\1\0\1\2\1\44\1\54\1\62\1\55\2\0\1\46\1\63\1\64\1\62\1\65"+
"\1\40\1\66\1\67\1\0\1\51\1\25\1\54\1\35\1\34\2\0\1\46\1\70\1\57\1\35\1\71"+
"\1\72\1\25\1\53\1\0\1\40\1\25\1\54\1\47\1\55\2\0\1\46\1\70\1\57\1\47\1\65"+
"\1\67\1\61\1\53\1\0\1\40\1\25\1\73\1\74\1\75\1\76\1\77\1\74\1\0\1\23\1\74"+
"\1\75\1\100\1\25\1\67\1\0\1\25\1\40\1\54\1\30\1\46\2\0\1\46\1\45\1\101\1\30"+
"\1\75\1\102\1\24\1\53\1\0\2\25\1\73\1\30\1\46\2\0\1\46\1\45\1\57\1\30\1\75"+
"\1\102\1\32\1\53\1\0\1\103\1\25\1\73\1\30\1\46\4\0\1\50\1\30\1\104\1\41\1"+
"\25\1\53\1\0\1\25\1\36\1\73\1\0\1\22\1\36\2\0\1\34\1\105\1\22\1\106\1\107"+
"\1\0\2\25\1\110\1\25\1\37\6\0\1\62\1\0\1\22\1\0\1\24\4\25\1\111\1\112\1\52"+
"\1\37\1\113\1\73\1\0\1\71\1\107\1\51\1\0\1\57\4\25\1\72\2\25\1\24\1\0\1\24"+
"\1\114\1\115\1\0\1\37\3\0\1\26\1\37\1\0\1\30\2\0\1\37\3\0\1\26\1\32\7\25\11"+
"\0\1\24\11\0\1\51\4\0\1\35\1\20\5\0\1\116\51\0\1\75\1\22\1\75\5\0\1\75\4\0"+
"\1\75\1\22\1\75\1\0\1\22\7\0\1\75\10\0\1\50\4\25\2\0\2\25\12\0\1\26\1\25\1"+
"\37\114\0\1\47\2\0\1\117\2\0\1\43\11\0\1\74\1\72\1\25\1\0\1\30\1\26\1\25\2"+
"\0\1\26\1\25\2\0\1\2\1\25\1\0\1\30\1\120\1\25\12\0\1\121\1\122\1\0\1\24\3"+
"\25\1\122\1\0\1\24\13\0\1\25\5\0\1\43\10\0\1\51\1\25\3\0\1\26\1\0\1\2\1\0"+
"\1\2\1\67\4\0\1\51\1\26\1\25\5\0\1\2\3\0\1\24\1\0\1\24\4\25\3\0\1\2\7\0\1"+
"\22\3\0\1\47\1\0\1\24\1\0\1\24\1\41\13\25\11\0\1\2\1\0\1\24\1\25\1\123\1\2"+
"\1\25\16\0\1\2\1\25\7\0\1\25\1\0\1\101\5\0\1\51\12\25\1\116\3\0\1\22\1\25"+
"\34\0\1\22\2\25\1\52\42\0\2\51\4\0\2\51\1\0\1\124\3\0\1\51\6\0\1\30\1\107"+
"\1\125\1\26\1\53\1\2\1\0\1\26\1\125\1\26\1\126\1\127\3\25\1\130\1\25\1\41"+
"\1\72\1\25\1\131\1\132\1\26\1\36\1\40\1\41\2\25\1\0\1\26\3\0\1\43\2\25\1\0"+
"\1\26\1\133\1\0\1\72\1\25\1\106\1\36\1\105\1\134\1\27\1\135\1\0\1\57\1\136"+
"\1\137\2\25\5\0\1\72\116\25\5\0\1\22\5\0\1\22\20\0\1\26\1\123\1\2\1\25\4\0"+
"\1\35\1\20\7\0\1\41\1\25\1\41\2\0\1\22\1\25\10\22\4\0\5\25\1\41\72\25\1\140"+
"\3\25\1\37\1\0\1\134\1\26\1\37\11\0\1\22\1\141\1\37\12\0\1\116\1\136\4\0\1"+
"\51\1\37\12\0\1\22\2\25\3\0\1\43\6\25\170\0\1\51\11\25\71\0\1\26\6\25\21\0"+
"\1\26\10\25\5\0\1\51\41\0\1\26\3\0\1\2\2\25\6\0\1\52\1\35\3\0\1\41\12\0\1"+
"\24\3\25\1\41\1\0\1\36\14\0\1\60\1\2\1\25\1\0\1\43\11\25\6\0\2\25\1\72\6\0"+
"\1\2\1\25\10\0\1\26\1\25\1\0\1\24\3\0\1\44\5\0\1\51\4\0\1\2\1\25\3\0\1\26"+
"\10\0\1\72\1\41\1\0\1\24\4\25\6\0\1\22\1\25\1\0\1\51\1\0\1\24\2\0\1\22\1\110"+
"\10\0\1\43\2\25\1\122\2\0\1\142\1\25\3\143\1\25\2\22\22\25\5\0\1\144\1\0\1"+
"\24\64\0\1\2\1\25\2\0\1\22\1\123\5\0\1\2\40\25\55\0\1\51\15\0\1\24\4\25\1"+
"\22\1\25\1\123\1\136\1\0\1\46\1\22\1\107\1\145\15\0\1\24\3\25\1\123\54\0\1"+
"\51\2\25\10\0\1\36\6\0\5\25\1\0\1\26\2\0\2\25\1\22\1\25\1\77\2\25\1\136\3"+
"\25\1\40\1\30\20\0\1\47\1\131\1\25\1\0\1\24\1\37\2\0\1\62\1\37\2\0\1\43\1"+
"\67\12\0\1\22\3\36\1\146\1\147\2\25\1\150\1\0\1\45\2\0\1\22\2\0\1\151\1\0"+
"\1\51\1\0\1\51\4\25\17\0\1\43\10\25\6\0\1\26\20\25\1\20\20\25\3\0\1\26\6\0"+
"\1\72\5\25\3\0\1\22\2\25\3\0\1\43\6\25\3\0\1\51\4\0\1\2\1\0\1\134\5\25\23"+
"\0\1\51\1\0\1\24\52\25\1\51\1\46\4\0\1\35\1\152\2\0\1\51\25\25\2\0\1\51\1"+
"\25\3\0\1\24\10\25\7\0\1\67\10\25\1\153\1\52\1\45\1\37\2\0\1\2\1\62\4\25\3"+
"\0\1\26\20\25\6\0\1\51\1\25\2\0\1\51\1\25\2\0\1\43\21\25\11\0\1\72\66\25\10"+
"\0\1\22\3\25\1\67\1\0\2\25\7\0\1\154\2\25\3\0\1\72\1\0\1\24\6\0\1\30\1\0\10"+
"\25\10\0\1\26\1\25\1\0\1\24\24\25\7\0\1\25\1\0\1\24\46\25\55\0\1\22\22\25"+
"\14\0\1\43\63\25\5\0\1\22\72\25\7\0\1\72\130\25\10\0\1\26\1\25\5\0\1\22\1"+
"\25\1\41\2\0\14\25\1\24\153\25\1\136\1\101\2\0\1\50\1\2\3\25\1\31\22\25\1"+
"\146\67\25\12\0\1\30\10\0\1\30\1\155\1\156\1\0\1\157\1\45\7\0\1\35\1\50\2"+
"\30\3\0\1\160\1\107\1\36\1\46\51\0\1\51\3\0\1\46\2\0\1\116\3\0\1\116\2\0\1"+
"\30\3\0\1\30\2\0\1\22\3\0\1\22\3\0\1\46\3\0\1\46\2\0\1\116\1\53\6\0\1\45\3"+
"\0\1\111\1\37\1\116\1\161\1\106\1\162\1\111\1\124\1\111\2\116\1\66\1\0\1\34"+
"\1\0\1\2\1\54\1\34\1\0\1\2\50\25\32\0\1\22\5\25\106\0\1\26\1\25\33\0\1\51"+
"\74\25\1\40\3\25\14\0\20\25\36\0\2\25");
/* The ZZ_CMAP_A table has 1704 entries */
/* The ZZ_CMAP_A table has 920 entries */
static final char ZZ_CMAP_A[] = zzUnpackCMap(
"\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\3\1\0\4\20\4\0\1\20\2\0\1\21\7\0\1"+
"\11\20\1\3\1\2\2\1\1\2\6\20\4\0\1\3\1\20\1\7\1\0\1\20\2\0\1\11\2\20\1\6\1"+
"\17\1\25\1\12\1\15\1\4\1\13\11\14\1\26\5\0\5\20\1\16\5\20\1\23\1\10\1\24\1"+
"\0\1\20\1\0\1\34\3\20\1\32\1\33\5\20\1\35\1\20\1\37\3\20\1\30\1\36\1\27\1"+
"\31\5\20\1\21\1\0\1\22\7\20\1\5\2\20\1\3\1\0\4\20\4\0\1\20\2\0\1\20\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"+
"\21\1\0\2\21\1\0\1\21\3\20\5\0\5\21\6\0\1\20\4\0\3\21\5\0\3\20\7\21\4\0\2"+
"\20\1\21\13\20\1\0\1\20\7\21\2\20\2\21\1\0\4\21\2\20\2\21\3\20\2\0\1\20\7"+
"\0\1\21\1\20\1\21\6\20\3\21\2\0\11\20\3\21\1\20\6\0\2\21\6\20\4\21\2\20\2"+
"\0\2\21\1\20\11\21\1\20\3\21\1\20\5\21\2\0\1\20\3\21\4\0\1\20\1\0\6\20\4\0"+
"\13\21\1\0\4\21\6\20\3\21\1\20\2\21\1\20\7\21\2\20\2\21\2\0\2\21\1\0\3\21"+
"\1\0\10\20\2\0\2\20\2\0\6\20\1\0\1\20\3\0\4\20\2\0\1\21\1\20\7\21\2\0\2\21"+
"\2\0\3\21\1\20\5\0\2\20\1\0\5\20\4\0\3\20\4\0\2\20\1\0\2\20\1\0\2\20\1\0\2"+
"\20\2\0\1\21\1\0\5\21\4\0\2\21\2\0\3\21\3\0\1\21\7\0\4\20\1\0\1\20\7\0\4\21"+
"\3\20\1\21\2\0\1\20\1\0\2\20\1\0\3\20\2\21\1\0\3\21\2\0\1\20\11\0\1\21\1\20"+
"\1\0\6\20\3\0\3\20\1\0\4\20\3\0\2\20\1\0\1\20\1\0\2\20\3\0\2\20\3\0\2\20\4"+
"\0\5\21\3\0\3\21\1\0\4\21\2\0\1\20\6\0\1\21\4\20\1\0\5\20\3\0\1\20\7\21\1"+
"\0\2\21\5\0\2\21\3\0\2\21\1\0\3\20\1\0\2\20\5\0\3\20\2\0\1\20\3\21\1\0\4\21"+
"\1\20\1\0\4\20\1\0\1\20\4\0\1\21\4\0\6\21\1\0\1\21\3\0\2\21\4\0\1\20\1\21"+
"\2\20\7\21\4\0\10\20\3\21\7\0\2\20\1\0\1\20\2\0\2\20\1\0\1\20\2\0\1\20\6\0"+
"\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\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\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\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"+
"\20\2\0\3\20\3\0\2\20\3\0\2\20\2\0\3\21\4\0\3\20\1\0\2\20\1\0\1\20\5\0\1\21"+
"\2\0\1\20\3\0\1\20\2\0\2\20\3\21\1\0\2\21\1\0\3\21\2\0\1\21\2\0\1\21\4\20"+
"\10\0\5\21\3\0\6\21\2\0\3\21\2\0\4\21\4\0\3\21\5\0\1\20\2\0\2\20\2\0\4\20"+
"\1\0\4\20\1\0\1\20\1\0\6\20\2\0\5\20\1\0\4\20\1\0\4\20\2\0\2\21\1\0\1\20\1"+
"\0\1\20\5\0\1\20\1\0\1\20\1\0\3\20\1\0\3\20\1\0\3\20");
"\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\1"+
"\20\2\0\6\20\1\0\7\20\1\0\1\20\15\0\1\20\1\0\2\20\1\0\2\20\1\0\4\20\10\0\1"+
"\20\4\0\4\20\1\0\4\20\1\0\13\20\2\0\4\20\2\0\11\20\6\0\10\20\2\0\2\20\1\0"+
"\3\20\1\0\4\20\2\0\6\20\1\0\1\20\3\0\4\20\2\0\5\20\2\0\4\20\5\0\2\20\1\0\4"+
"\20\4\0\2\20\1\0\2\20\1\0\2\20\1\0\2\20\2\0\1\20\1\0\3\20\2\0\3\20\3\0\4\20"+
"\1\0\1\20\7\0\3\20\1\0\2\20\1\0\5\20\1\0\3\20\2\0\1\20\11\0\2\20\1\0\6\20"+
"\3\0\3\20\1\0\4\20\3\0\2\20\1\0\1\20\1\0\2\20\3\0\2\20\3\0\1\20\6\0\3\20\3"+
"\0\3\20\5\0\2\20\2\0\2\20\5\0\1\20\1\0\5\20\1\0\4\20\1\0\1\20\4\0\1\20\4\0"+
"\6\20\1\0\1\20\3\0\2\20\5\0\2\20\1\0\1\20\2\0\2\20\1\0\1\20\2\0\1\20\3\0\3"+
"\20\1\0\1\20\1\0\1\20\5\0\1\20\1\0\1\20\1\0\1\20\4\0\5\20\1\0\4\20\1\3\10"+
"\20\1\0\2\20\4\0\4\20\3\0\1\20\3\0\3\20\5\0\5\20\1\0\1\20\1\0\1\20\1\0\1\20"+
"\1\0\1\20\2\0\3\20\1\0\2\20\13\3\5\20\2\1\5\20\1\3\4\0\1\20\12\0\1\3\1\0\1"+
"\20\3\0\3\20\1\0\5\20\2\0\1\20\1\0\4\20\1\0\1\20\5\0\5\20\4\0\1\20\1\0\1\3"+
"\4\0\3\20\1\0\2\20\2\0\3\20\2\0\5\20\2\0\6\20\1\0\3\20\1\0\2\20\2\0\2\20\1"+
"\0\2\20\1\0\2\20\2\0\3\20\3\0\2\20\3\0\2\20\2\0\3\20\4\0\3\20\1\0\2\20\1\0"+
"\2\20\3\0\1\20\2\0\5\20\1\0\2\20\1\0\3\20\2\0\1\20\4\0\1\20\2\0\2\20\2\0\4"+
"\20\1\0\4\20\1\0\1\20\1\0\5\20\1\0\4\20\2\0\1\20\1\0\1\20\5\0\1\20\1\0\1\20"+
"\1\0\3\20");
/**
* Translates DFA states to action switch labels.
@@ -173,13 +148,14 @@ public class _JsonLexer implements FlexLexer {
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\1\0\1\1\1\2\1\1\1\3\1\4\1\1\2\5"+
"\1\6\1\7\1\10\1\11\1\12\1\13\1\14\3\6"+
"\1\15\1\16\1\3\2\0\1\4\1\0\1\5\3\6"+
"\1\0\2\5\3\6\1\16\1\17\1\6\1\20\1\21";
"\1\0\1\1\1\2\1\3\1\2\1\3\1\4\1\5"+
"\1\3\2\6\1\7\1\10\1\11\1\12\1\13\1\14"+
"\3\3\1\15\1\16\1\4\2\0\1\5\1\3\1\6"+
"\3\3\1\15\1\16\1\3\3\6\3\3\1\0\1\16"+
"\1\17\1\3\1\20\1\16\1\21";
private static int [] zzUnpackAction() {
int [] result = new int[41];
int [] result = new int[47];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
@@ -204,15 +180,15 @@ public class _JsonLexer implements FlexLexer {
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\41\0\102\0\143\0\204\0\245\0\306\0\347"+
"\0\u0108\0\u0129\0\41\0\41\0\41\0\41\0\41\0\41"+
"\0\u014a\0\u016b\0\u018c\0\u01ad\0\u01ce\0\41\0\u01ef\0\u0210"+
"\0\41\0\u0231\0\u0252\0\u0273\0\u0294\0\u02b5\0\u02d6\0\u02f7"+
"\0\u0318\0\u0339\0\u035a\0\u037b\0\41\0\u0129\0\u039c\0\u0129"+
"\0\u0129";
"\0\0\0\40\0\100\0\140\0\200\0\240\0\300\0\340"+
"\0\u0100\0\u0120\0\u0140\0\40\0\40\0\40\0\40\0\40"+
"\0\40\0\u0160\0\u0180\0\u01a0\0\u01c0\0\u01e0\0\40\0\u0200"+
"\0\u0220\0\40\0\u0240\0\u0260\0\u0280\0\u02a0\0\u02c0\0\u02e0"+
"\0\u0300\0\u0320\0\u0340\0\u0360\0\u0380\0\u03a0\0\u03c0\0\u03e0"+
"\0\u0400\0\240\0\240\0\u0420\0\240\0\40\0\240";
private static int [] zzUnpackRowMap() {
int [] result = new int[41];
int [] result = new int[47];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
@@ -235,38 +211,47 @@ public class _JsonLexer implements FlexLexer {
private static final int [] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\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\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"+
"\5\0\1\12\5\0\2\12\1\0\1\12\1\0\2\12"+
"\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\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";
"\1\2\3\3\1\4\1\5\1\6\1\7\1\2\1\10"+
"\1\11\1\12\1\13\2\6\1\2\1\6\1\14\1\15"+
"\1\16\1\17\1\20\1\21\1\22\3\6\1\23\3\6"+
"\1\24\41\0\3\3\1\0\1\3\36\0\1\25\1\6"+
"\1\26\3\0\5\6\1\0\1\6\6\0\11\6\1\0"+
"\3\3\1\6\1\5\1\6\3\0\5\6\1\0\1\6"+
"\6\0\11\6\4\0\3\6\3\0\5\6\1\0\1\6"+
"\6\0\11\6\2\7\1\0\4\7\1\27\1\30\27\7"+
"\2\10\1\0\5\10\1\31\1\32\26\10\4\0\3\6"+
"\3\0\1\6\1\12\1\13\2\6\1\0\1\6\6\0"+
"\11\6\4\0\3\6\3\0\3\6\1\33\1\34\1\0"+
"\1\6\6\0\3\6\1\34\5\6\4\0\3\6\3\0"+
"\1\6\2\13\1\33\1\34\1\0\1\6\6\0\3\6"+
"\1\34\5\6\4\0\3\6\3\0\5\6\1\0\1\6"+
"\6\0\1\6\1\35\7\6\4\0\3\6\3\0\5\6"+
"\1\0\1\6\6\0\5\6\1\36\3\6\4\0\3\6"+
"\3\0\5\6\1\0\1\6\6\0\2\6\1\37\6\6"+
"\1\40\2\0\1\40\1\25\1\6\1\25\3\40\5\25"+
"\1\40\1\25\6\40\11\25\4\41\2\26\1\42\3\41"+
"\5\26\1\41\1\26\6\41\11\26\2\7\1\0\35\7"+
"\2\10\1\0\35\10\4\0\3\6\3\0\1\6\2\43"+
"\2\6\1\0\1\6\6\0\11\6\4\0\3\6\3\0"+
"\3\44\2\6\1\45\1\6\6\0\11\6\4\0\3\6"+
"\3\0\5\6\1\0\1\6\6\0\2\6\1\46\6\6"+
"\4\0\3\6\3\0\5\6\1\0\1\6\6\0\6\6"+
"\1\47\2\6\4\0\3\6\3\0\5\6\1\0\1\6"+
"\6\0\6\6\1\50\2\6\1\40\2\0\2\40\1\0"+
"\32\40\6\41\1\51\35\41\1\52\1\26\1\42\3\41"+
"\5\26\1\41\1\26\6\41\11\26\4\0\3\6\3\0"+
"\1\6\2\43\1\6\1\34\1\0\1\6\6\0\3\6"+
"\1\34\5\6\4\0\3\6\3\0\1\6\2\44\2\6"+
"\1\0\1\6\6\0\11\6\13\0\2\45\27\0\3\6"+
"\3\0\5\6\1\0\1\6\6\0\3\6\1\53\5\6"+
"\4\0\3\6\3\0\5\6\1\0\1\6\6\0\7\6"+
"\1\54\1\6\4\0\3\6\3\0\5\6\1\0\1\6"+
"\6\0\6\6\1\55\2\6\4\41\1\56\1\41\1\51"+
"\31\41\4\0\3\6\3\0\5\6\1\0\1\6\6\0"+
"\3\6\1\57\5\6";
private static int [] zzUnpackTrans() {
int [] result = new int[957];
int [] result = new int[1088];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
@@ -304,11 +289,11 @@ public class _JsonLexer implements FlexLexer {
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\1\0\1\11\10\1\6\11\5\1\1\11\2\0\1\11"+
"\1\0\4\1\1\0\5\1\1\11\4\1";
"\1\0\1\11\11\1\6\11\5\1\1\11\2\0\1\11"+
"\16\1\1\0\4\1\1\11\1\1";
private static int [] zzUnpackAttribute() {
int [] result = new int[41];
int [] result = new int[47];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
@@ -614,27 +599,27 @@ public class _JsonLexer implements FlexLexer {
else {
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 1:
{ return com.intellij.psi.TokenType.BAD_CHARACTER;
{ return BAD_CHARACTER;
}
case 18: break;
case 2:
{ return com.intellij.psi.TokenType.WHITE_SPACE;
{ return WHITE_SPACE;
}
case 19: break;
case 3:
{ return DOUBLE_QUOTED_STRING;
{ return IDENTIFIER;
}
case 20: break;
case 4:
{ return SINGLE_QUOTED_STRING;
{ return DOUBLE_QUOTED_STRING;
}
case 21: break;
case 5:
{ return NUMBER;
{ return SINGLE_QUOTED_STRING;
}
case 22: break;
case 6:
{ return IDENTIFIER;
{ return NUMBER;
}
case 23: break;
case 7:
+6 -2
View File
@@ -40,8 +40,12 @@
FALSE='false'
NULL='null'
// Actually not defined in RFC 4627, but may be used for JSON5 and helps with
// auto completion of keywords.
IDENTIFIER='regexp:[:jletter:] [:jletterdigit:]*'
// auto completion of keywords. Semantically, it represents "bad word" type
// of tokens
// Could be as loose as [^\s\[\]{}:,\"\']+, but is slightly more restricted
// for the time being to match most forms of npm package names in package.json.
// See https://github.com/npm/validate-npm-package-name
IDENTIFIER="regexp:[[:jletterdigit:]~!()*\-./@]+"
]
extends("container|literal|reference_expression")=value
@@ -13,7 +13,7 @@ json.inspection.group=JSON
inspection.compliance.name=Compliance with JSON standard
inspection.compliance.msg.comments=JSON standard does not allow comments. Use JSMin or similar tool to remove comments before parsing.
inspection.compliance.msg.single.quoted.strings=JSON standard does not allow single quoted strings
inspection.compliance.msg.identifier=JSON standard does not allow identifiers
inspection.compliance.msg.bad.token=JSON standard does not allow such tokens
inspection.compliance.msg.illegal.property.key=JSON standard allows only double quoted string as property key
inspection.compliance.msg.trailing.comma=JSON standard does not allow trailing comma
inspection.compliance.msg.multiple.top.level.values=JSON standard allows only one top-level value
+7 -5
View File
@@ -1,7 +1,10 @@
package com.intellij.json;
import com.intellij.lexer.*;
import com.intellij.lexer.FlexLexer;
import com.intellij.psi.tree.IElementType;
import static com.intellij.psi.TokenType.BAD_CHARACTER;
import static com.intellij.psi.TokenType.WHITE_SPACE;
import static com.intellij.json.JsonElementTypes.*;
%%
@@ -20,7 +23,6 @@ import static com.intellij.json.JsonElementTypes.*;
%unicode
EOL=\R
// Edited manually, GrammarKit generates plain "\s" (no iteration)
WHITE_SPACE=\s+
LINE_COMMENT="//".*
@@ -28,11 +30,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]*)?
IDENTIFIER=[:jletter:] [:jletterdigit:]*
IDENTIFIER=[[:jletterdigit:]~!()*\-."/"@]+
%%
<YYINITIAL> {
{WHITE_SPACE} { return com.intellij.psi.TokenType.WHITE_SPACE; }
{WHITE_SPACE} { return WHITE_SPACE; }
"{" { return L_CURLY; }
"}" { return R_CURLY; }
@@ -53,4 +55,4 @@ IDENTIFIER=[:jletter:] [:jletterdigit:]*
}
[^] { return com.intellij.psi.TokenType.BAD_CHARACTER; }
[^] { return BAD_CHARACTER; }
@@ -82,7 +82,7 @@ public class JsonStandardComplianceInspection extends LocalInspectionTool {
@Override
public void visitReferenceExpression(@NotNull JsonReferenceExpression reference) {
holder.registerProblem(reference, JsonBundle.message("inspection.compliance.msg.identifier"), new AddDoubleQuotesFix());
holder.registerProblem(reference, JsonBundle.message("inspection.compliance.msg.bad.token"), new AddDoubleQuotesFix());
// May be illegal property key as well
super.visitReferenceExpression(reference);
}
@@ -71,6 +71,10 @@ public class JsonParsingTest extends ParsingTestCase {
doTest();
}
public void testExtendedIdentifierToken() {
doTest();
}
// Moved from JavaScript
public void testSimple1() {
@@ -2,13 +2,13 @@
<weak_warning descr="JSON standard does not allow comments. Use JSMin or similar tool to remove comments before parsing.">/* Property key checks */</weak_warning>
"key1": null,
<error descr="JSON standard allows only double quoted string as property key"><error descr="JSON standard does not allow single quoted strings">'key2'</error></error>: null,
<error descr="JSON standard does not allow identifiers">key3</error>: null,
<error descr="JSON standard does not allow such tokens">key3</error>: null,
<error descr="JSON standard allows only double quoted string as property key">42</error>: null,
<weak_warning descr="JSON standard does not allow comments. Use JSMin or similar tool to remove comments before parsing.">// Property value checks</weak_warning>
"key4": "foo",
"key5": <error descr="JSON standard does not allow single quoted strings">'foo'</error>,
"key6": <error descr="JSON standard does not allow identifiers">foo</error>,
"key6": <error descr="JSON standard does not allow such tokens">foo</error>,
"key7": [42<error descr="JSON standard does not allow trailing comma">,</error>],
"key8": false<error descr="JSON standard does not allow trailing comma">,</error>
}
@@ -0,0 +1,5 @@
{
"devDependencies": {
@types/3d-bin.packing: 42
}
}
@@ -0,0 +1,23 @@
JsonFile: ExtendedIdentifierToken.json
JsonObject
PsiElement({)('{')
PsiWhiteSpace('\n ')
JsonProperty
JsonStringLiteral
PsiElement(DOUBLE_QUOTED_STRING)('"devDependencies"')
PsiElement(:)(':')
PsiWhiteSpace(' ')
JsonObject
PsiElement({)('{')
PsiWhiteSpace('\n ')
JsonProperty
JsonReferenceExpression
PsiElement(IDENTIFIER)('@types/3d-bin.packing')
PsiElement(:)(':')
PsiWhiteSpace(' ')
JsonNumberLiteral
PsiElement(NUMBER)('42')
PsiWhiteSpace('\n ')
PsiElement(})('}')
PsiWhiteSpace('\n')
PsiElement(})('}')
+17 -49
View File
@@ -20,24 +20,16 @@ JsonFile: NumberLiterals.json
PsiElement(NUMBER)('-42')
PsiElement(,)(',')
PsiWhiteSpace('\n ')
JsonNumberLiteral
PsiElement(NUMBER)('0')
PsiErrorElement:',' or ']' expected, got '42'
<empty list>
JsonNumberLiteral
PsiElement(NUMBER)('42')
JsonReferenceExpression
PsiElement(IDENTIFIER)('042')
PsiElement(,)(',')
PsiWhiteSpace('\n\n ')
PsiErrorElement:'.' unexpected
PsiElement(BAD_CHARACTER)('.')
JsonNumberLiteral
PsiElement(NUMBER)('1')
JsonReferenceExpression
PsiElement(IDENTIFIER)('.1')
PsiElement(,)(',')
PsiWhiteSpace('\n ')
JsonNumberLiteral
PsiElement(NUMBER)('1')
PsiErrorElement:',' or ']' expected, got '.'
PsiElement(BAD_CHARACTER)('.')
JsonReferenceExpression
PsiElement(IDENTIFIER)('1.')
PsiElement(,)(',')
PsiWhiteSpace('\n ')
JsonNumberLiteral
@@ -54,12 +46,8 @@ JsonFile: NumberLiterals.json
PsiElement(NUMBER)('-1.2')
PsiElement(,)(',')
PsiWhiteSpace('\n ')
JsonNumberLiteral
PsiElement(NUMBER)('0')
PsiErrorElement:',' or ']' expected, got '1.2'
<empty list>
JsonNumberLiteral
PsiElement(NUMBER)('1.2')
JsonReferenceExpression
PsiElement(IDENTIFIER)('01.2')
PsiElement(,)(',')
PsiWhiteSpace('\n\n ')
JsonNumberLiteral
@@ -100,44 +88,28 @@ JsonFile: NumberLiterals.json
PsiElement(NUMBER)('-1e2')
PsiElement(,)(',')
PsiWhiteSpace('\n ')
JsonNumberLiteral
PsiElement(NUMBER)('0')
PsiErrorElement:',' or ']' expected, got '1e2'
<empty list>
JsonNumberLiteral
PsiElement(NUMBER)('1e2')
JsonReferenceExpression
PsiElement(IDENTIFIER)('01e2')
PsiElement(,)(',')
PsiWhiteSpace('\n\n ')
JsonNumberLiteral
PsiElement(NUMBER)('1')
PsiErrorElement:',' or ']' expected, got '.'
PsiElement(BAD_CHARACTER)('.')
JsonReferenceExpression
PsiElement(IDENTIFIER)('e2')
PsiElement(IDENTIFIER)('1.e2')
PsiElement(,)(',')
PsiWhiteSpace('\n ')
PsiErrorElement:'.' unexpected
PsiElement(BAD_CHARACTER)('.')
JsonReferenceExpression
PsiElement(IDENTIFIER)('e2')
PsiElement(IDENTIFIER)('.e2')
PsiElement(,)(',')
PsiWhiteSpace('\n ')
JsonNumberLiteral
PsiElement(NUMBER)('1')
PsiErrorElement:',' or ']' expected, got '.'
PsiElement(BAD_CHARACTER)('.')
JsonReferenceExpression
PsiElement(IDENTIFIER)('e')
PsiElement(IDENTIFIER)('1.e')
PsiElement(,)(',')
PsiWhiteSpace('\n ')
JsonNumberLiteral
PsiElement(NUMBER)('1.2e')
PsiElement(,)(',')
PsiWhiteSpace('\n ')
PsiErrorElement:'.' unexpected
PsiElement(BAD_CHARACTER)('.')
JsonNumberLiteral
PsiElement(NUMBER)('2e3')
JsonReferenceExpression
PsiElement(IDENTIFIER)('.2e3')
PsiErrorElement:',' or ']' expected, got '1.2e3'
<empty list>
PsiWhiteSpace('\n ')
@@ -171,12 +143,8 @@ JsonFile: NumberLiterals.json
PsiElement(NUMBER)('-1.2e3')
PsiElement(,)(',')
PsiWhiteSpace('\n ')
JsonNumberLiteral
PsiElement(NUMBER)('0')
PsiErrorElement:',' or ']' expected, got '1.2e3'
<empty list>
JsonNumberLiteral
PsiElement(NUMBER)('1.2e3')
JsonReferenceExpression
PsiElement(IDENTIFIER)('01.2e3')
PsiElement(,)(',')
PsiWhiteSpace('\n\n ')
JsonNumberLiteral
+1 -1
View File
@@ -1 +1 @@
{"aaa": <error descr="JSON standard does not allow identifiers">b<caret>bb</error>}
{"aaa": <error descr="JSON standard does not allow such tokens">b<caret>bb</error>}