lib/rouge/lexers/coffeescript.rb in rouge-3.3.0 vs lib/rouge/lexers/coffeescript.rb in rouge-3.4.0

- old
+ new

@@ -16,16 +16,24 @@ return true if text.shebang? 'coffee' end def self.keywords @keywords ||= Set.new %w( - for in of while break return continue switch when then if else - throw try catch finally new delete typeof instanceof super - extends this class by + for by while until loop break continue return + switch when then if else do yield throw try catch finally await + new delete typeof instanceof super extends this class + import export debugger ) end + def self.reserved + @reserved ||= Set.new %w( + case function var void with const let enum + native implements interface package private protected public static + ) + end + def self.constants @constants ||= Set.new %w( true false yes no on off null NaN Infinity undefined ) end @@ -41,11 +49,11 @@ id = /[$a-zA-Z_][a-zA-Z0-9_]*/ state :comments_and_whitespace do rule /\s+/m, Text - rule /###\s*\n.*?###/m, Comment::Multiline + rule /###[^#].*?###/m, Comment::Multiline rule /#.*$/, Comment::Single end state :multiline_regex do # this order is important, so that #{ isn't interpreted @@ -75,11 +83,11 @@ state :root do rule(%r(^(?=\s|/|<!--))) { push :slash_starts_regex } mixin :comments_and_whitespace rule %r( - [+][+]|--|~|&&|\band\b|\bor\b|\bis\b|\bisnt\b|\bnot\b|[?]|:|=| - [|][|]|\\(?=\n)|(<<|>>>?|==?|!=?|[-<>+*`%&|^/])=? + [+][+]|--|~|&&|\band\b|\bor\b|\bis\b|\bisnt\b|\bnot\b|\bin\b|\bof\b| + [?]|:|=|[|][|]|\\(?=\n)|(<<|>>>?|==?|!=?|[-<>+*`%&|^/])=? )x, Operator, :slash_starts_regex rule /[-=]>/, Name::Function rule /(@)([ \t]*)(#{id})/ do