Skip to content

Commit

Permalink
Fix order of token and state commands to be consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximeKjaer committed Jun 14, 2019
1 parent 02b524d commit c7cb938
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions lib/rouge/lexers/xpath.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ def self.constructorTypes
end
rule /(map|array|empty-sequence)/, Keyword # constructors
rule /(#{XPath.kindTest})(\s*)(#{XPath.openParen})/ do # kindtest
push :kindtest
groups Keyword, Text::Whitespace, Punctuation
push :kindtest
end
rule /(#{XPath.kindTestForPi})(\s*)(#{XPath.openParen})/ do # processing instruction kindtest
push :kindtestforpi
groups Keyword, Text::Whitespace, Punctuation
push :kindtestforpi
end
rule /(#{XPath.eqName})(\s*)(#{XPath.openParen})/ do # function call
groups Name::Function, Text::Whitespace, Punctuation
Expand All @@ -125,16 +125,16 @@ def self.constructorTypes

# Type commands
rule /(cast|castable)(\s+)(as)/ do
goto :singletype
groups Keyword, Text::Whitespace, Keyword
goto :singletype
end
rule /(treat)(\s+)(as)/ do
goto :itemtype
groups Keyword, Text::Whitespace, Keyword
goto :itemtype
end
rule /(instance)(\s+)(of)/ do
goto :itemtype
groups Keyword, Text::Whitespace, Keyword
goto :itemtype
end
rule /\b(as)\b/ do
token Keyword
Expand Down Expand Up @@ -190,8 +190,8 @@ def self.constructorTypes
push :kindtestforpi
end
rule /(item)(\s*)(#{XPath.openParen})(\s*)(\))/ do
goto :occurrenceindicator
groups Keyword::Type, Text::Whitespace, Punctuation, Text::Whitespace, Punctuation
goto :occurrenceindicator
end
rule /(#{XPath.constructorTypes})(\s*)(#{XPath.openParen})/ do
groups Keyword::Type, Text::Whitespace, Punctuation
Expand Down Expand Up @@ -247,8 +247,8 @@ def self.constructorTypes
rule /[?*]/, Operator
rule /,/, Punctuation
rule /(element|schema-element)(\s*)(#{XPath.openParen})/ do
push :kindtest
groups Keyword::Type, Text::Whitespace, Punctuation
push :kindtest
end
rule XPath.eqName, Name::Tag

Expand Down
6 changes: 3 additions & 3 deletions lib/rouge/lexers/xquery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def self.keywords
rule /%/, Keyword::Declaration, :annotation

rule /(\(#)(\s*)(#{XPath.eqName})/ do
push :pragma
groups Comment::Preproc, Text::Whitespace, Name::Tag
push :pragma
end

rule /``\[/, Str, :str_constructor
Expand Down Expand Up @@ -99,12 +99,12 @@ def self.keywords
state :start_tag do
rule /\s+/m, Text::Whitespace
rule /([\w.:-]+\s*=)(")/m do
push :quot_attr
groups Name::Attribute, Str
push :quot_attr
end
rule /([\w.:-]+\s*=)(')/m do
push :apos_attr
groups Name::Attribute, Str
push :apos_attr
end
rule />/, Name::Tag, :tag_content
rule %r(/>), Name::Tag, :pop!
Expand Down

0 comments on commit c7cb938

Please sign in to comment.