diff options
author | kpdecker <kpdecker@gmail.com> | 2013-05-27 11:52:32 -0500 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2013-05-27 11:56:28 -0500 |
commit | c1020a01309723b00ef21525d7f8093efb4d0d93 (patch) | |
tree | 51b149eb75beb74587a516327b38fbcb9628ed3a /src | |
parent | bff71d79d372a8edccfb6b282715634ac32ac3bb (diff) | |
download | handlebars.js-c1020a01309723b00ef21525d7f8093efb4d0d93.zip handlebars.js-c1020a01309723b00ef21525d7f8093efb4d0d93.tar.gz handlebars.js-c1020a01309723b00ef21525d7f8093efb4d0d93.tar.bz2 |
Add unicode support for ID tokens
Fixes #433
Fixes #469
Diffstat (limited to 'src')
-rw-r--r-- | src/handlebars.l | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/handlebars.l b/src/handlebars.l index d12ab28..349e78f 100644 --- a/src/handlebars.l +++ b/src/handlebars.l @@ -32,7 +32,7 @@ <mu>"{{" { return 'OPEN'; } <mu>"=" { return 'EQUALS'; } -<mu>"."/[}/ ] { return 'ID'; } +<mu>"."/[}\/ ] { return 'ID'; } <mu>".." { return 'ID'; } <mu>[\/.] { return 'SEP'; } <mu>\s+ { /*ignore whitespace*/ } @@ -44,7 +44,18 @@ <mu>"true"/[}\s] { return 'BOOLEAN'; } <mu>"false"/[}\s] { return 'BOOLEAN'; } <mu>\-?[0-9]+/[}\s] { return 'INTEGER'; } -<mu>[a-zA-Z0-9_$:\-]+/[=}\s\/.] { return 'ID'; } + +/* +ID is the inverse of control characters. +Control characters ranges: + [\s] Whitespace + [!"#%-,\./] !, ", #, %, &, ', (, ), *, +, ,, ., /, Exceptions in range: $, - + [;->@] ;, <, =, >, @, Exceptions in range: :, ? + [\[-\^`] [, \, ], ^, `, Exceptions in range: _ + [\{-~] {, |, }, ~ +*/ +<mu>[^\s!"#%-,\.\/;->@\[-\^`\{-~]+/[=}\s\/.] { return 'ID'; } + <mu>'['[^\]]*']' { yytext = yytext.substr(1, yyleng-2); return 'ID'; } <mu>. { return 'INVALID'; } <par>\s+ { /*ignore whitespace*/ } |