Add missing CoffeeScript keywords and reserved words #1061
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added missing keywords:
until
,loop
,do
,yield
(old ones),debugger
(an obscure one inhereted from JavaScript), andawait
,import
,export
(added in CoffeeScript 2).Added missing reserved words based on
RESERVED
list in CoffeeScript source code. (Previously there were no reserved words.)See https://coffeescript.org/annotated-source/lexer.html#constants
I also made
in
andof
into operators, as they can be used in arbitrary context, not just infor
loops, and also to be consistent withnot
(currently an operator). Before this PR, thenot in
operator formats rather inconsistently:As a bonus, this last change fixes #1056.
Not addressed by this PR:
for ... from
doesn't highlightfrom
(which is not a keyword), andfor own
doesn't highlightown
(also not a keyword). Should I add these to operators, or add more complex rules to capture the context where they actually matter? This PR or another PR? Actually, same forimport ... as
whichjavascript.rb
seems to just call a keyword (which is not correct -- you can assignas = 5
in JS and CS).