making debugger an expression.

This commit is contained in:
Jeremy Ashkenas 2011-11-25 08:35:20 -05:00
parent 6cb13f4c44
commit 35dc56d785
5 changed files with 165 additions and 161 deletions

View File

@ -59,6 +59,8 @@
return new Literal($1);
}), o('REGEX', function() {
return new Literal($1);
}), o('DEBUGGER', function() {
return new Literal($1);
}), o('BOOL', function() {
var val;
val = new Literal($1);

View File

@ -73,7 +73,7 @@
id = new String(id);
id.reserved = true;
} else if (__indexOf.call(RESERVED, id) >= 0) {
this.error("reserved word \"" + id + "\"");
this.error("reserved word \"" + word + "\"");
}
}
if (!forcedIdentifier) {
@ -95,7 +95,6 @@
return 'BOOL';
case 'break':
case 'continue':
case 'debugger':
return 'STATEMENT';
default:
return tag;

File diff suppressed because one or more lines are too long

View File

@ -126,6 +126,7 @@ grammar =
o 'AlphaNumeric'
o 'JS', -> new Literal $1
o 'REGEX', -> new Literal $1
o 'DEBUGGER', -> new Literal $1
o 'BOOL', ->
val = new Literal $1
val.isUndefined = yes if $1 is 'undefined'

View File

@ -112,7 +112,7 @@ exports.Lexer = class Lexer
id = new String id
id.reserved = yes
else if id in RESERVED
@error "reserved word \"#{id}\""
@error "reserved word \"#{word}\""
unless forcedIdentifier
id = COFFEE_ALIAS_MAP[id] if id in COFFEE_ALIASES
@ -121,7 +121,7 @@ exports.Lexer = class Lexer
when '==', '!=' then 'COMPARE'
when '&&', '||' then 'LOGIC'
when 'true', 'false', 'null', 'undefined' then 'BOOL'
when 'break', 'continue', 'debugger' then 'STATEMENT'
when 'break', 'continue' then 'STATEMENT'
else tag
@token tag, id