1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

coco: cc71308 (partial) break continue debugger -> STATEMENT

This commit is contained in:
Jeremy Ashkenas 2010-11-14 15:15:13 -05:00
parent f31798bbb4
commit eb959b3879
5 changed files with 182 additions and 187 deletions

View file

@ -28,13 +28,9 @@
],
Line: [o('Expression'), o('Statement')],
Statement: [
o('Return'), o('Throw'), o('BREAK', function() {
o('Return'), o('Throw'), o('Comment'), o('STATEMENT', function() {
return new Literal($1);
}), o('CONTINUE', function() {
return new Literal($1);
}), o('DEBUGGER', function() {
return new Literal($1);
}), o('Comment')
})
],
Expression: [o('Value'), o('Invocation'), o('Code'), o('Operation'), o('Assign'), o('If'), o('Try'), o('While'), o('For'), o('Switch'), o('Class')],
Block: [

View file

@ -104,6 +104,10 @@
case 'null':
case 'undefined':
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

@ -78,10 +78,8 @@ grammar =
Statement: [
o 'Return'
o 'Throw'
o 'BREAK', -> new Literal $1
o 'CONTINUE', -> new Literal $1
o 'DEBUGGER', -> new Literal $1
o 'Comment'
o 'STATEMENT', -> new Literal $1
]
# All the different types of expressions in our language. The basic unit of

View file

@ -126,6 +126,7 @@ exports.Lexer = class Lexer
when '==', '!=' then 'COMPARE'
when '&&', '||' then 'LOGIC'
when 'true', 'false', 'null', 'undefined' then 'BOOL'
when 'break', 'continue', 'debugger' then 'STATEMENT'
else tag
@token tag, id