Fix highlighter
This commit is contained in:
@ -14,13 +14,13 @@ module Rouge
|
||||
mimetypes 'text/x-xpath'
|
||||
|
||||
state :basic do
|
||||
rule /\s+/, Text
|
||||
rule /[(][:](?![)])/, Comment, :nested_comment
|
||||
rule /\s+/, Text::Whitespace
|
||||
rule /[(]:(?![)])/, Comment, :nested_comment
|
||||
|
||||
rule /[\[\](){}|.,;!]/, Punctuation
|
||||
|
||||
rule /"[^"]*+"/, Str::Double
|
||||
rule /'[^']*+'/, Str::Single
|
||||
rule /"([^"]|"")*+"/, Str::Double
|
||||
rule /'([^']|'')*+'/, Str::Single
|
||||
|
||||
rule /\.\d++\b/, Num
|
||||
rule /\b\d++\./, Num
|
||||
@ -28,31 +28,34 @@ module Rouge
|
||||
end
|
||||
|
||||
state :operators do
|
||||
rule /(<|>|=<|>=|==|\/\/|[\/*+-])(?=\s|[a-zA-Z0-9\[])/, Operator
|
||||
rule /(<|>|=<|>=|==|\/\/|[|\/*+-])(?=\s|[a-zA-Z0-9\[])/, Operator
|
||||
# operators
|
||||
rule /(or|and|not|mod|ne|eq|lt|le|gt|ge)/, Operator
|
||||
rule /(or|and|not|mod|ne|eq|lt|le|gt|ge)/, Operator::Word
|
||||
# keywords
|
||||
rule /some|in|satisfies|as|is|for|every|cast|castable|treat|instance|of|to|if|then|else|return|let|intersect|except|union|div|idiv/, Keyword::Reserved
|
||||
# axes
|
||||
rule /(self|child|attribute|descendant|descendant-or-self|ancestor|ancestor-or-self|following|following-sibling|namespace|parent|preceding-sibling)::/, Keyword::Namespace
|
||||
# kind tests
|
||||
rule /(node|document-node|text|comment|namespace-node|processing-instruction|attribute|schema-attribute|element|schema-element|function)\(\)/, Keyword::Reserved
|
||||
# functions
|
||||
rule /[a-zA-Z\-]+(?=\()/, Name::Function
|
||||
end
|
||||
|
||||
state :names do
|
||||
# Function or node namespace
|
||||
rule /[a-zA-Z\-]+:/, Name::Namespace
|
||||
# Attributes
|
||||
rule /@[a-zA-Z][_\-a-zA-Z0-9]*/, Name::Attribute
|
||||
# XPath variables
|
||||
rule /\$[a-zA-Z][_\-a-zA-Z0-9]*/, Name::Variable
|
||||
# Functions
|
||||
rule /[a-zA-Z\-]+(?=\s*+\()/, Name::Function
|
||||
# Node names
|
||||
rule /[a-zA-Z]+/, Name::Tag
|
||||
rule /[a-zA-Z]+/, Name::Class
|
||||
end
|
||||
|
||||
state :root do
|
||||
mixin :basic
|
||||
mixin :names
|
||||
mixin :operators
|
||||
mixin :names
|
||||
end
|
||||
|
||||
state :nested_comment do
|
||||
@ -63,4 +66,4 @@ module Rouge
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user