Make the ID node capable of handling paths
TODO: handle invalid paths in the tokenizer or parser
TODO: invalidate "{{ foo/ bar }}"
This commit is contained in:
@@ -33,6 +33,11 @@ Handlebars.HandlebarsLexer.prototype.lex = function() {
|
||||
if(lookahead === "") return;
|
||||
|
||||
if(this.state == "MUSTACHE") {
|
||||
if(this.peek() === "/") {
|
||||
this.getchar();
|
||||
return "SEP";
|
||||
}
|
||||
|
||||
// chomp optional whitespace
|
||||
while(this.peek() === " ") { this.ignorechar(); }
|
||||
|
||||
@@ -64,7 +69,7 @@ Handlebars.HandlebarsLexer.prototype.lex = function() {
|
||||
// All other cases are IDs or errors
|
||||
} else {
|
||||
// grab alphanumeric characters
|
||||
while(this.peek().match(/[0-9A-Za-z]/)) { this.getchar() }
|
||||
while(this.peek().match(/[0-9A-Za-z\.]/)) { this.getchar() }
|
||||
|
||||
// if any characters were grabbed => ID
|
||||
if(this.yytext.length) { return "ID" }
|
||||
|
||||
Reference in New Issue
Block a user