mirror of
https://github.com/circlecell/jsonlint-mod.git
synced 2026-01-21 05:07:49 +08:00
update grammar for latest jison
This commit is contained in:
@@ -1,23 +1,24 @@
|
||||
esc "\\"
|
||||
int "-"?([0-9]|[1-9][0-9]+)
|
||||
exp ([eE][-+]?[0-9]+)
|
||||
frac ("."[0-9]+)
|
||||
exp [eE][-+]?[0-9]+
|
||||
frac "."[0-9]+
|
||||
|
||||
%%
|
||||
\s+ {/* skip whitespace */}
|
||||
{int}{frac}?{exp}?\b {return 'NUMBER';}
|
||||
'"'("\\"["bfnrt/{esc}]|"\\u"[a-fA-F0-9]{4}|[^\0-\x09\x0a-\x1f"{esc}])*'"' {yytext = yytext.substr(1,yyleng-2); return 'STRING';}
|
||||
"{" %{ return '{' %}
|
||||
"}" %{ return '}' %}
|
||||
"[" {return '['}
|
||||
"]" {return ']'}
|
||||
"," {return ','}
|
||||
":" {return ':'}
|
||||
"true" {return 'TRUE'}
|
||||
"false" {return 'FALSE'}
|
||||
"null" {return 'NULL'}
|
||||
<<EOF>> {return 'EOF'}
|
||||
. {return 'INVALID'}
|
||||
\s+ /* skip whitespace */
|
||||
|
||||
{int}{frac}?{exp}?\b return 'NUMBER'
|
||||
\"(?:'\\'[\\"bfnrt/]|'\\u'[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*\" yytext = yytext.substr(1,yyleng-2); return 'STRING'
|
||||
|
||||
"{" return '{'
|
||||
"}" return ''
|
||||
"[" return '['
|
||||
"]" return ']'
|
||||
"," return ','
|
||||
":" return ':'
|
||||
"true" return 'TRUE'
|
||||
"false" return 'FALSE'
|
||||
"null" return 'NULL'
|
||||
<<EOF>> return 'EOF'
|
||||
. return 'INVALID'
|
||||
|
||||
%%
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
%start JSONText
|
||||
|
||||
/*
|
||||
ECMA-262 5th Edition, 15.12.1 The JSON Grammar.
|
||||
*/
|
||||
|
||||
|
||||
/* author: Zach Carter */
|
||||
|
||||
|
||||
%start JSONText
|
||||
|
||||
%%
|
||||
|
||||
JSONString
|
||||
|
||||
Reference in New Issue
Block a user