lib/rouge/lexers/racket.rb in rouge-3.17.0 vs lib/rouge/lexers/racket.rb in rouge-3.18.0
- old
+ new
@@ -486,10 +486,13 @@
id = /[^\s\(\)\[\]\{\}'`,.]+/i
state :root do
# comments
rule %r/;.*$/, Comment::Single
+ rule %r/#!.*/, Comment::Single
+ rule %r/#\|/, Comment::Multiline, :block_comment
+ rule %r/#;/, Comment::Multiline, :sexp_comment
rule %r/\s+/m, Text
rule %r/[+-]inf[.][f0]/, Num::Float
rule %r/[+-]nan[.]0/, Num::Float
rule %r/[-]min[.]0/, Num::Float
@@ -508,11 +511,11 @@
rule %r/"(\\\\|\\"|[^"])*"/, Str
rule %r/['`]#{id}/i, Str::Symbol
rule %r/#\\([()\/'"._!\$%& ?=+-]{1}|[a-z0-9]+)/i,
Str::Char
- rule %r/#t|#f/, Name::Constant
+ rule %r/#t(rue)?|#f(alse)?/i, Name::Constant
rule %r/(?:'|#|`|,@|,|\.)/, Operator
rule %r/(['#])(\s*)(\()/m do
groups Str::Symbol, Text, Punctuation
end
@@ -520,9 +523,29 @@
# () [] {} are all permitted as like pairs
rule %r/\(|\[|\{/, Punctuation, :command
rule %r/\)|\]|\}/, Punctuation
rule id, Name::Variable
+ end
+
+ state :block_comment do
+ rule %r/[^|#]+/, Comment::Multiline
+ rule %r/\|#/, Comment::Multiline, :pop!
+ rule %r/#\|/, Comment::Multiline, :block_comment
+ rule %r/[|#]/, Comment::Multiline
+ end
+
+ state :sexp_comment do
+ rule %r/[({\[]/, Comment::Multiline, :sexp_comment_inner
+ rule %r/"(?:\\"|[^"])*?"/, Comment::Multiline, :pop!
+ rule %r/[^\s]+/, Comment::Multiline, :pop!
+ rule(//) { pop! }
+ end
+
+ state :sexp_comment_inner do
+ rule %r/[^(){}\[\]]+/, Comment::Multiline
+ rule %r/[)}\]]/, Comment::Multiline, :pop!
+ rule %r/[({\[]/, Comment::Multiline, :sexp_comment_inner
end
state :command do
rule id, Name::Function do |m|
if self.class.keywords.include? m[0]