lib/rouge/lexers/plsql.rb in rouge-4.2.0 vs lib/rouge/lexers/plsql.rb in rouge-4.2.1
- old
+ new
@@ -470,11 +470,11 @@
end
rule %r/'/, Operator, :single_string
# A double-quoted string refers to a database object in our default SQL
rule %r/"/, Operator, :double_string
# preprocessor directive treated as special comment
- rule %r/(\$(?:IF|THEN|ELSE|ELSIF|ERROR|END|(?:\$\$?\w[\w\d]*)))(\s+)/im do
+ rule %r/(\$(?:IF|THEN|ELSE|ELSIF|ERROR|END|(?:\$\$?[a-z]\w*)))(\s+)/im do
groups Comment::Preproc, Text
end
# Numbers
rule %r/[+-]?(?:(?:\.\d+(?:[eE][+-]?\d+)?)|\d+\.(?:\d+(?:[eE][+-]?\d+)?)?)[fFdD]?/, Num::Float
@@ -501,11 +501,11 @@
rule %r/[;:()\[\],.]/, Punctuation
# Special processing for keywords with multiple contexts
#
# this madness is to keep the word "replace" from being treated as a builtin function in this context
- rule %r/(create)(\s+)(?:(or)(\s+)(replace)(\s+))?(package|function|procedure|type)(?:(\s+)(body))?(\s+)(\w[\w\d\$]*)/im do
+ rule %r/(create)(\s+)(?:(or)(\s+)(replace)(\s+))?(package|function|procedure|type)(?:(\s+)(body))?(\s+)([a-z][\w$]*)/im do
groups Keyword::Reserved, Text, Keyword::Reserved, Text, Keyword::Reserved, Text, Keyword::Reserved, Text, Keyword::Reserved, Text, Name
end
# similar for MERGE keywords
rule %r/(when)(\s+)(?:(not)(\s+))?(matched)(\s+)(then)(\s+)(update|insert)\b(?:(\s+)(set)(\s+))?/im do
groups Keyword::Reserved, Text, Keyword::Reserved, Text, Keyword::Reserved, Text, Keyword::Reserved, Text, Keyword::Reserved, Text, Keyword::Reserved, Text
@@ -513,11 +513,11 @@
#
# General keyword classification with sepcial attention to names
# in a chained "dot" notation.
#
- rule %r/(\w[\w\d\$]*)(\.(?=\w))?/ do |m|
+ rule %r/([a-zA-Z][\w$]*)(\.(?=\w))?/ do |m|
if self.class.keywords_type.include? m[1].upcase
tok = Keyword::Type
elsif self.class.keywords_func.include? m[1].upcase
tok = Name::Function
elsif self.class.keywords_reserved.include? m[1].upcase
@@ -554,14 +554,14 @@
rule %r/[^\\"]+/m, Name::Variable
end
state :dotnames do
# if we are followed by a dot and another name, we are an ordinary name
- rule %r/(\w[\w\d\$]*)(\.(?=\w))/ do
+ rule %r/([a-zA-Z][\w\$]*)(\.(?=\w))/ do
groups Name, Punctuation
end
# this rule WILL be true if something pushed into our state. That is our state contract
- rule %r/\w[\w\d\$]*/ do |m|
+ rule %r/[a-zA-Z][\w\$]*/ do |m|
if self.class.keywords_func.include? m[0].upcase
# The Function lookup allows collection methods like COUNT, FIRST, LAST, etc.. to be
# classified correctly. Occasionally misidentifies ordinary names as builtin functions,
# but seems to be as correct as we can get without becoming a full blown parser
token Name::Function