diff options
author | kpdecker <kpdecker@gmail.com> | 2013-07-24 23:43:56 -0500 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2013-07-24 23:43:56 -0500 |
commit | 497515c02fd58d46e38c872a3fbf366be5f876fe (patch) | |
tree | 444655df72ffe7fe9987ad4ddbca687e718ee64f | |
parent | 117239ca7c05d05ac32c84ec4c4e39688b352ec0 (diff) | |
download | handlebars.js-497515c02fd58d46e38c872a3fbf366be5f876fe.zip handlebars.js-497515c02fd58d46e38c872a3fbf366be5f876fe.tar.gz handlebars.js-497515c02fd58d46e38c872a3fbf366be5f876fe.tar.bz2 |
Remove braces on single line lex statements
Resolves a parsing issue in the 0.4 branch of jison.
-rw-r--r-- | dist/handlebars.js | 60 | ||||
-rw-r--r-- | src/handlebars.l | 64 |
2 files changed, 62 insertions, 62 deletions
diff --git a/dist/handlebars.js b/dist/handlebars.js index e05f346..89b7239 100644 --- a/dist/handlebars.js +++ b/dist/handlebars.js @@ -566,7 +566,7 @@ lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_STA var YYSTATE=YY_START switch($avoiding_name_collisions) { -case 0: yy_.yytext = "\\"; return 14; +case 0:yy_.yytext = "\\"; return 14; break; case 1: if(yy_.yytext.slice(-1) !== "\\") this.begin("mu"); @@ -574,7 +574,7 @@ case 1: if(yy_.yytext) return 14; break; -case 2: return 14; +case 2:return 14; break; case 3: if(yy_.yytext.slice(-1) !== "\\") this.popState(); @@ -582,61 +582,61 @@ case 3: return 14; break; -case 4: yy_.yytext = yy_.yytext.substr(0, yy_.yyleng-4); this.popState(); return 15; +case 4:yy_.yytext = yy_.yytext.substr(0, yy_.yyleng-4); this.popState(); return 15; break; -case 5: return 25; +case 5:return 25; break; -case 6: return 16; +case 6:return 16; break; -case 7: return 20; +case 7:return 20; break; -case 8: return 19; +case 8:return 19; break; -case 9: return 19; +case 9:return 19; break; -case 10: return 23; +case 10:return 23; break; -case 11: return 22; +case 11:return 22; break; -case 12: this.popState(); this.begin('com'); +case 12:this.popState(); this.begin('com'); break; -case 13: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15; +case 13:yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15; break; -case 14: return 22; +case 14:return 22; break; -case 15: return 39; +case 15:return 39; break; -case 16: return 38; +case 16:return 38; break; -case 17: return 38; +case 17:return 38; break; -case 18: return 42; +case 18:return 42; break; -case 19: /*ignore whitespace*/ +case 19:/*ignore whitespace*/ break; -case 20: this.popState(); return 24; +case 20:this.popState(); return 24; break; -case 21: this.popState(); return 18; +case 21:this.popState(); return 18; break; -case 22: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 32; +case 22:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 32; break; -case 23: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\'/g,"'"); return 32; +case 23:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\'/g,"'"); return 32; break; -case 24: return 40; +case 24:return 40; break; -case 25: return 34; +case 25:return 34; break; -case 26: return 34; +case 26:return 34; break; -case 27: return 33; +case 27:return 33; break; -case 28: return 38; +case 28:return 38; break; -case 29: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 38; +case 29:yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 38; break; -case 30: return 'INVALID'; +case 30:return 'INVALID'; break; -case 31: return 5; +case 31:return 5; break; } }; diff --git a/src/handlebars.l b/src/handlebars.l index aa76eab..5fd0bcd 100644 --- a/src/handlebars.l +++ b/src/handlebars.l @@ -3,14 +3,14 @@ %% -"\\\\"/("{{") { yytext = "\\"; return 'CONTENT'; } +"\\\\"/("{{") yytext = "\\"; return 'CONTENT'; [^\x00]*?/("{{") { if(yytext.slice(-1) !== "\\") this.begin("mu"); if(yytext.slice(-1) === "\\") yytext = yytext.substr(0,yyleng-1), this.begin("emu"); if(yytext) return 'CONTENT'; } -[^\x00]+ { return 'CONTENT'; } +[^\x00]+ return 'CONTENT'; <emu>[^\x00]{2,}?/("{{"|<<EOF>>) { if(yytext.slice(-1) !== "\\") this.popState(); @@ -18,32 +18,32 @@ return 'CONTENT'; } -<com>[\s\S]*?"--}}" { yytext = yytext.substr(0, yyleng-4); this.popState(); return 'COMMENT'; } - -<mu>"{{>" { return 'OPEN_PARTIAL'; } -<mu>"{{#" { return 'OPEN_BLOCK'; } -<mu>"{{/" { return 'OPEN_ENDBLOCK'; } -<mu>"{{^" { return 'OPEN_INVERSE'; } -<mu>"{{"\s*"else" { return 'OPEN_INVERSE'; } -<mu>"{{{" { return 'OPEN_UNESCAPED'; } -<mu>"{{&" { return 'OPEN'; } -<mu>"{{!--" { this.popState(); this.begin('com'); } -<mu>"{{!"[\s\S]*?"}}" { yytext = yytext.substr(3,yyleng-5); this.popState(); return 'COMMENT'; } -<mu>"{{" { return 'OPEN'; } - -<mu>"=" { return 'EQUALS'; } -<mu>"."/[}\/ ] { return 'ID'; } -<mu>".." { return 'ID'; } -<mu>[\/.] { return 'SEP'; } -<mu>\s+ { /*ignore whitespace*/ } -<mu>"}}}" { this.popState(); return 'CLOSE_UNESCAPED'; } -<mu>"}}" { this.popState(); return 'CLOSE'; } -<mu>'"'("\\"["]|[^"])*'"' { yytext = yytext.substr(1,yyleng-2).replace(/\\"/g,'"'); return 'STRING'; } -<mu>"'"("\\"[']|[^'])*"'" { yytext = yytext.substr(1,yyleng-2).replace(/\\'/g,"'"); return 'STRING'; } -<mu>"@" { return 'DATA'; } -<mu>"true"/[}\s] { return 'BOOLEAN'; } -<mu>"false"/[}\s] { return 'BOOLEAN'; } -<mu>\-?[0-9]+/[}\s] { return 'INTEGER'; } +<com>[\s\S]*?"--}}" yytext = yytext.substr(0, yyleng-4); this.popState(); return 'COMMENT'; + +<mu>"{{>" return 'OPEN_PARTIAL'; +<mu>"{{#" return 'OPEN_BLOCK'; +<mu>"{{/" return 'OPEN_ENDBLOCK'; +<mu>"{{^" return 'OPEN_INVERSE'; +<mu>"{{"\s*"else" return 'OPEN_INVERSE'; +<mu>"{{{" return 'OPEN_UNESCAPED'; +<mu>"{{&" return 'OPEN'; +<mu>"{{!--" this.popState(); this.begin('com'); +<mu>"{{!"[\s\S]*?"}}" yytext = yytext.substr(3,yyleng-5); this.popState(); return 'COMMENT'; +<mu>"{{" return 'OPEN'; + +<mu>"=" return 'EQUALS'; +<mu>"."/[}\/ ] return 'ID'; +<mu>".." return 'ID'; +<mu>[\/.] return 'SEP'; +<mu>\s+ /*ignore whitespace*/ +<mu>"}}}" this.popState(); return 'CLOSE_UNESCAPED'; +<mu>"}}" this.popState(); return 'CLOSE'; +<mu>'"'("\\"["]|[^"])*'"' yytext = yytext.substr(1,yyleng-2).replace(/\\"/g,'"'); return 'STRING'; +<mu>"'"("\\"[']|[^'])*"'" yytext = yytext.substr(1,yyleng-2).replace(/\\'/g,"'"); return 'STRING'; +<mu>"@" return 'DATA'; +<mu>"true"/[}\s] return 'BOOLEAN'; +<mu>"false"/[}\s] return 'BOOLEAN'; +<mu>\-?[0-9]+/[}\s] return 'INTEGER'; /* ID is the inverse of control characters. @@ -54,10 +54,10 @@ Control characters ranges: [\[-\^`] [, \, ], ^, `, Exceptions in range: _ [\{-~] {, |, }, ~ */ -<mu>[^\s!"#%-,\.\/;->@\[-\^`\{-~]+/[=}\s\/.] { return 'ID'; } +<mu>[^\s!"#%-,\.\/;->@\[-\^`\{-~]+/[=}\s\/.] return 'ID'; -<mu>'['[^\]]*']' { yytext = yytext.substr(1, yyleng-2); return 'ID'; } -<mu>. { return 'INVALID'; } +<mu>'['[^\]]*']' yytext = yytext.substr(1, yyleng-2); return 'ID'; +<mu>. return 'INVALID'; -<INITIAL,mu><<EOF>> { return 'EOF'; } +<INITIAL,mu><<EOF>> return 'EOF'; |