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:
parent
f31798bbb4
commit
eb959b3879
5 changed files with 182 additions and 187 deletions
|
@ -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: [
|
||||
|
|
|
@ -104,6 +104,10 @@
|
|||
case 'null':
|
||||
case 'undefined':
|
||||
return 'BOOL';
|
||||
case 'break':
|
||||
case 'continue':
|
||||
case 'debugger':
|
||||
return 'STATEMENT';
|
||||
default:
|
||||
return tag;
|
||||
}
|
||||
|
|
352
lib/parser.js
352
lib/parser.js
File diff suppressed because one or more lines are too long
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue