diff --git a/src/handlebars.l b/src/handlebars.l index ec99edc3..dd92cbfd 100644 --- a/src/handlebars.l +++ b/src/handlebars.l @@ -6,30 +6,30 @@ [^\x00]*?/("{{") { this.begin("mu"); if (yytext) return 'CONTENT'; } [^\x00]+ { return 'CONTENT'; } -"{{>" { return 'OPEN_PARTIAL'; } -"{{#" { return 'OPEN_BLOCK'; } -"{{/" { return 'OPEN_ENDBLOCK'; } -"{{^" { return 'OPEN_INVERSE'; } -"{{"\s*"else" { return 'OPEN_INVERSE'; } -"{{{" { return 'OPEN_UNESCAPED'; } -"{{&" { return 'OPEN_UNESCAPED'; } -"{{!"[\s\S]*?"}}" { yytext = yytext.substr(3,yyleng-5); this.begin("INITIAL"); return 'COMMENT'; } -"{{" { return 'OPEN'; } +"{{>" { return 'OPEN_PARTIAL'; } +"{{#" { return 'OPEN_BLOCK'; } +"{{/" { return 'OPEN_ENDBLOCK'; } +"{{^" { return 'OPEN_INVERSE'; } +"{{"\s*"else" { return 'OPEN_INVERSE'; } +"{{{" { return 'OPEN_UNESCAPED'; } +"{{&" { return 'OPEN_UNESCAPED'; } +"{{!"[\s\S]*?"}}" { yytext = yytext.substr(3,yyleng-5); this.begin("INITIAL"); return 'COMMENT'; } +"{{" { return 'OPEN'; } -"=" { return 'EQUALS'; } -"."/[} ] { return 'ID'; } -".." { return 'ID'; } -[\/.] { return 'SEP'; } -\s+ { /*ignore whitespace*/ } -"}}}" { this.begin("INITIAL"); return 'CLOSE'; } -"}}" { this.begin("INITIAL"); return 'CLOSE'; } -'"'("\\"["]|[^"])*'"' { yytext = yytext.substr(1,yyleng-2).replace(/\\"/g,'"'); return 'STRING'; } -"true"/[}\s] { return 'BOOLEAN'; } -"false"/[}\s] { return 'BOOLEAN'; } -[0-9]+/[}\s] { return 'INTEGER'; } -[a-zA-Z0-9_$-]+/[=}\s\/.] { return 'ID'; } +"=" { return 'EQUALS'; } +"."/[} ] { return 'ID'; } +".." { return 'ID'; } +[\/.] { return 'SEP'; } +\s+ { /*ignore whitespace*/ } +"}}}" { this.begin("INITIAL"); return 'CLOSE'; } +"}}" { this.begin("INITIAL"); return 'CLOSE'; } +'"'("\\"["]|[^"])*'"' { yytext = yytext.substr(1,yyleng-2).replace(/\\"/g,'"'); return 'STRING'; } +"true"/[}\s] { return 'BOOLEAN'; } +"false"/[}\s] { return 'BOOLEAN'; } +[0-9]+/[}\s] { return 'INTEGER'; } +[a-zA-Z0-9_$-]+/[=}\s\/.] { return 'ID'; } \[[^\]]*\] { yytext = yytext.substr(1, yyleng-2); return 'ID'; } -. { return 'INVALID'; } +. { return 'INVALID'; } -<> { return 'EOF'; } +<> { return 'EOF'; }