diff options
author | Stephen Dolan <mu@netsoc.tcd.ie> | 2012-09-22 14:03:46 +0100 |
---|---|---|
committer | Stephen Dolan <mu@netsoc.tcd.ie> | 2012-09-22 14:03:46 +0100 |
commit | a2643cc0d564033c49bffbd0de9a8e797281e73f (patch) | |
tree | e00b27b5a0bd58fb5cb1286ee988c0d128b3bac7 | |
parent | 359d5f33bde0df899985eac3d720f5c6a7f4d580 (diff) |
Allow underscores in IDENT tokens. Fixes #3.
IDENT syntax now includes ASCII letters and underscores, so
'.foo_bar' now works. Non-ASCII letters won't work in IDENT
tokens (it's impossible to tell which non-ascii characters are
"letters" without full unicode tables), so '.données' is still
a syntax error (the workaround is '.["données"]', since you can
put anything you like in a string).
-rw-r--r-- | lexer.l | 2 | ||||
-rw-r--r-- | testdata | 4 |
2 files changed, 5 insertions, 1 deletions
@@ -107,7 +107,7 @@ } -[[:alnum:]]+ { yylval->literal = jv_string(yytext); return IDENT;} +[a-zA-Z_][a-zA-Z_0-9]* { yylval->literal = jv_string(yytext); return IDENT;} [ \n\t]+ {} @@ -61,6 +61,10 @@ null {"foo": {"bar": 42}, "bar": "badvalue"} 42 +.foo_bar +{"foo_bar": 2} +2 + .["foo"].bar {"foo": {"bar": 42}, "bar": "badvalue"} 42 |