lib/rouge/lexers/q.rb in rouge-3.4.1 vs lib/rouge/lexers/q.rb in rouge-3.5.0

- old
+ new

@@ -34,27 +34,27 @@ ] end state :root do # q allows a file to start with a shebang - rule /#!(.*?)$/, Comment::Preproc, :top - rule //, Text, :top + rule %r/#!(.*?)$/, Comment::Preproc, :top + rule %r//, Text, :top end state :top do # indented lines at the top of the file are ignored by q - rule /^[ \t\r]+.*$/, Comment::Special - rule /\n+/, Text - rule //, Text, :base + rule %r/^[ \t\r]+.*$/, Comment::Special + rule %r/\n+/, Text + rule %r//, Text, :base end state :base do - rule /\n+/m, Text + rule %r/\n+/m, Text rule(/^.\)/, Keyword::Declaration) # Identifiers, word operators, etc. - rule /#{identifier}/ do |m| + rule %r/#{identifier}/ do |m| if self.class.keywords.include? m[0] token Keyword elsif self.class.word_operators.include? m[0] token Operator::Word elsif self.class.builtins.include? m[0] @@ -100,25 +100,25 @@ rule(/[0-9]+[hij]?/, Num::Integer) ## symbols and paths rule(%r{(`:[:a-z0-9._\/]*|`(?:[a-z0-9.][:a-z0-9._]*)?)}i, Str::Symbol) rule(/(?:<=|>=|<>|::)|[?:$%&|@._#*^\-+~,!><=]:?/, Operator) - rule /[{}\[\]();]/, Punctuation + rule %r/[{}\[\]();]/, Punctuation # commands rule(/\\.*\n/, Text) end state :string do rule(/"/, Str, :pop!) - rule /\\([\\nr]|[01][0-7]{2})/, Str::Escape - rule /[^\\"\n]+/, Str - rule /\\/, Str # stray backslash + rule %r/\\([\\nr]|[01][0-7]{2})/, Str::Escape + rule %r/[^\\"\n]+/, Str + rule %r/\\/, Str # stray backslash end state :bottom do - rule /.*\z/m, Comment::Multiline + rule %r/.*\z/m, Comment::Multiline end end end end