rouge 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +14 -2
- data/lib/rouge.rb +45 -41
- data/lib/rouge/cli.rb +26 -2
- data/lib/rouge/demos/escape +3 -0
- data/lib/rouge/demos/supercollider +11 -0
- data/lib/rouge/demos/xojo +13 -0
- data/lib/rouge/formatter.rb +36 -0
- data/lib/rouge/formatters/html.rb +2 -0
- data/lib/rouge/formatters/html_linewise.rb +6 -11
- data/lib/rouge/formatters/html_table.rb +20 -31
- data/lib/rouge/formatters/terminal256.rb +1 -0
- data/lib/rouge/guessers/disambiguation.rb +13 -0
- data/lib/rouge/guessers/source.rb +1 -1
- data/lib/rouge/lexer.rb +44 -13
- data/lib/rouge/lexers/c.rb +6 -29
- data/lib/rouge/lexers/coffeescript.rb +14 -6
- data/lib/rouge/lexers/common_lisp.rb +1 -1
- data/lib/rouge/lexers/console.rb +2 -2
- data/lib/rouge/lexers/coq.rb +1 -1
- data/lib/rouge/lexers/csharp.rb +0 -1
- data/lib/rouge/lexers/diff.rb +8 -4
- data/lib/rouge/lexers/docker.rb +1 -1
- data/lib/rouge/lexers/escape.rb +55 -0
- data/lib/rouge/lexers/go.rb +1 -1
- data/lib/rouge/lexers/graphql.rb +10 -0
- data/lib/rouge/lexers/html.rb +1 -0
- data/lib/rouge/lexers/java.rb +4 -0
- data/lib/rouge/lexers/javascript.rb +12 -16
- data/lib/rouge/lexers/jinja.rb +15 -1
- data/lib/rouge/lexers/julia.rb +140 -17
- data/lib/rouge/lexers/kotlin.rb +11 -4
- data/lib/rouge/lexers/markdown.rb +21 -4
- data/lib/rouge/lexers/matlab.rb +9 -2
- data/lib/rouge/lexers/objective_c.rb +7 -12
- data/lib/rouge/lexers/perl.rb +38 -6
- data/lib/rouge/lexers/powershell.rb +1 -1
- data/lib/rouge/lexers/rust.rb +1 -1
- data/lib/rouge/lexers/scala.rb +28 -2
- data/lib/rouge/lexers/shell.rb +1 -1
- data/lib/rouge/lexers/slim.rb +2 -2
- data/lib/rouge/lexers/supercollider.rb +116 -0
- data/lib/rouge/lexers/xml.rb +1 -1
- data/lib/rouge/lexers/xojo.rb +61 -0
- data/lib/rouge/regex_lexer.rb +12 -12
- data/lib/rouge/themes/bw.rb +41 -0
- data/lib/rouge/token.rb +30 -22
- data/lib/rouge/version.rb +1 -1
- metadata +10 -4
data/lib/rouge/lexers/kotlin.rb
CHANGED
@@ -19,9 +19,9 @@ module Rouge
|
|
19
19
|
external false final finally for fun get if import in infix
|
20
20
|
inline inner interface internal is lateinit noinline null
|
21
21
|
object open operator out override package private protected
|
22
|
-
public reified return sealed set super tailrec this
|
23
|
-
true try typealias typeof val var vararg when where
|
24
|
-
yield
|
22
|
+
public reified return sealed set super suspend tailrec this
|
23
|
+
throw true try typealias typeof val var vararg when where
|
24
|
+
while yield
|
25
25
|
)
|
26
26
|
|
27
27
|
name = %r'@?[_\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Nl}][\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Nl}\p{Nd}\p{Pc}\p{Cf}\p{Mn}\p{Mc}]*'
|
@@ -73,7 +73,8 @@ module Rouge
|
|
73
73
|
rule %r'[^\S\n]+', Text
|
74
74
|
rule %r'\\\n', Text # line continuation
|
75
75
|
rule %r'//.*?$', Comment::Single
|
76
|
-
rule %r'/[*]
|
76
|
+
rule %r'/[*].*[*]/', Comment::Multiline # single line block comment
|
77
|
+
rule %r'/[*].*', Comment::Multiline, :comment # multiline block comment
|
77
78
|
rule %r'\n', Text
|
78
79
|
rule %r'::|!!|\?[:.]', Operator
|
79
80
|
rule %r"(\.\.)", Operator
|
@@ -122,6 +123,12 @@ module Rouge
|
|
122
123
|
rule %r'(\s+)', Text
|
123
124
|
rule id, Name::Property
|
124
125
|
end
|
126
|
+
|
127
|
+
state :comment do
|
128
|
+
rule %r'\s*/[*].*', Comment::Multiline, :comment
|
129
|
+
rule %r'.*[*]/', Comment::Multiline, :pop!
|
130
|
+
rule %r'.*', Comment::Multiline
|
131
|
+
end
|
125
132
|
end
|
126
133
|
end
|
127
134
|
end
|
@@ -32,16 +32,33 @@ module Rouge
|
|
32
32
|
rule /^#(?=[^#]).*?$/, Generic::Heading
|
33
33
|
rule /^##*.*?$/, Generic::Subheading
|
34
34
|
|
35
|
-
rule
|
36
|
-
|
35
|
+
rule /^([ \t]*)(```|~~~)([^\n]*\n)((.*?)(\2))?/m do |m|
|
36
|
+
name = m[3].strip
|
37
|
+
sublexer = Lexer.find_fancy(name.empty? ? "guess" : name, m[5], @options)
|
37
38
|
sublexer ||= PlainText.new(@options.merge(:token => Str::Backtick))
|
38
39
|
sublexer.reset!
|
39
40
|
|
40
41
|
token Text, m[1]
|
41
42
|
token Punctuation, m[2]
|
42
43
|
token Name::Label, m[3]
|
43
|
-
|
44
|
-
|
44
|
+
if m[5]
|
45
|
+
delegate sublexer, m[5]
|
46
|
+
end
|
47
|
+
|
48
|
+
if m[6]
|
49
|
+
token Punctuation, m[6]
|
50
|
+
else
|
51
|
+
push do
|
52
|
+
rule /^([ \t]*)(#{m[2]})/ do |mb|
|
53
|
+
pop!
|
54
|
+
token Text, mb[1]
|
55
|
+
token Punctuation, mb[2]
|
56
|
+
end
|
57
|
+
rule /^.*\n/ do |mb|
|
58
|
+
delegate sublexer, mb[1]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
45
62
|
end
|
46
63
|
|
47
64
|
rule /\n\n(( |\t).*?\n|\n)+/, Str::Backtick
|
data/lib/rouge/lexers/matlab.rb
CHANGED
@@ -58,15 +58,22 @@ module Rouge
|
|
58
58
|
rule /\d+L/, Num::Integer::Long
|
59
59
|
rule /\d+/, Num::Integer
|
60
60
|
|
61
|
-
rule /'(?=(.*'))/, Str::Single, :
|
61
|
+
rule /'(?=(.*'))/, Str::Single, :chararray
|
62
|
+
rule /"(?=(.*"))/, Str::Double, :string
|
62
63
|
rule /'/, Operator
|
63
64
|
end
|
64
65
|
|
65
|
-
state :
|
66
|
+
state :chararray do
|
66
67
|
rule /[^']+/, Str::Single
|
67
68
|
rule /''/, Str::Escape
|
68
69
|
rule /'/, Str::Single, :pop!
|
69
70
|
end
|
71
|
+
|
72
|
+
state :string do
|
73
|
+
rule /[^"]+/, Str::Double
|
74
|
+
rule /""/, Str::Escape
|
75
|
+
rule /"/, Str::Double, :pop!
|
76
|
+
end
|
70
77
|
end
|
71
78
|
end
|
72
79
|
end
|
@@ -44,15 +44,8 @@ module Rouge
|
|
44
44
|
rule /@\d+l?/, Num::Integer
|
45
45
|
rule /\bin\b/, Keyword
|
46
46
|
|
47
|
-
rule /@(?:interface|implementation)\b
|
48
|
-
|
49
|
-
goto :classname
|
50
|
-
end
|
51
|
-
|
52
|
-
rule /@(?:class|protocol)\b/ do
|
53
|
-
token Keyword
|
54
|
-
goto :forward_classname
|
55
|
-
end
|
47
|
+
rule /@(?:interface|implementation)\b/, Keyword, :classname
|
48
|
+
rule /@(?:class|protocol)\b/, Keyword, :forward_classname
|
56
49
|
|
57
50
|
rule /@([[:alnum:]]+)/ do |m|
|
58
51
|
if self.class.at_keywords.include? m[1]
|
@@ -80,7 +73,7 @@ module Rouge
|
|
80
73
|
rule /\{/, Punctuation, :pop!
|
81
74
|
rule /;/, Error
|
82
75
|
|
83
|
-
mixin :
|
76
|
+
mixin :statements
|
84
77
|
end
|
85
78
|
|
86
79
|
state :message do
|
@@ -160,8 +153,10 @@ module Rouge
|
|
160
153
|
([(].*?[)])?(\s*)
|
161
154
|
(?=#{id}:?)
|
162
155
|
)ix do |m|
|
163
|
-
token Keyword, m[1]
|
164
|
-
|
156
|
+
token Keyword, m[1]
|
157
|
+
token Text, m[2]
|
158
|
+
recurse(m[3]) if m[3]
|
159
|
+
token Text, m[4]
|
165
160
|
push :method_definition
|
166
161
|
end
|
167
162
|
end
|
data/lib/rouge/lexers/perl.rb
CHANGED
@@ -93,9 +93,10 @@ module Rouge
|
|
93
93
|
rule %r(m?/(\\\\|\\/|[^/\n])*/[msixpodualngc]*), re_tok
|
94
94
|
rule %r(m(?=[/!\\{<\[\(@%\$])), re_tok, :balanced_regex
|
95
95
|
|
96
|
-
#
|
97
|
-
|
98
|
-
rule %r(m(\
|
96
|
+
# arbitrary non-whitespace delimiters
|
97
|
+
rule %r(m\s*([^\w\s])((\\\\|\\\1)|[^\1])*?\1[msixpodualngc]*)m, re_tok
|
98
|
+
rule %r(m\s+(\w)((\\\\|\\\1)|[^\1])*?\1[msixpodualngc]*)m, re_tok
|
99
|
+
|
99
100
|
rule %r(((?<==~)|(?<=\())\s*/(\\\\|\\/|[^/])*/[msixpodualngc]*),
|
100
101
|
re_tok, :balanced_regex
|
101
102
|
|
@@ -120,9 +121,9 @@ module Rouge
|
|
120
121
|
rule /\d+(_\d*)*e[+-]?\d+(_\d*)*/i, Num::Float
|
121
122
|
rule /\d+(_\d+)*/, Num::Integer
|
122
123
|
|
123
|
-
rule /'
|
124
|
-
rule /"
|
125
|
-
rule
|
124
|
+
rule /'/, Punctuation, :sq
|
125
|
+
rule /"/, Punctuation, :dq
|
126
|
+
rule /`/, Punctuation, :bq
|
126
127
|
rule /<([^\s>]+)>/, re_tok
|
127
128
|
rule /(q|qq|qw|qr|qx)\{/, Str::Other, :cb_string
|
128
129
|
rule /(q|qq|qw|qr|qx)\(/, Str::Other, :rb_string
|
@@ -178,6 +179,26 @@ module Rouge
|
|
178
179
|
rule /;/, Punctuation, :pop!
|
179
180
|
end
|
180
181
|
|
182
|
+
state :sq do
|
183
|
+
rule /\\[']/, Str::Escape
|
184
|
+
rule /[^\\']+/, Str::Single
|
185
|
+
rule /'/, Punctuation, :pop!
|
186
|
+
end
|
187
|
+
|
188
|
+
state :dq do
|
189
|
+
mixin :string_intp
|
190
|
+
rule /\\[\\tnr"]/, Str::Escape
|
191
|
+
rule /[^\\"]+?/, Str::Double
|
192
|
+
rule /"/, Punctuation, :pop!
|
193
|
+
end
|
194
|
+
|
195
|
+
state :bq do
|
196
|
+
mixin :string_intp
|
197
|
+
rule /\\[\\tnr`]/, Str::Escape
|
198
|
+
rule /[^\\`]+?/, Str::Backtick
|
199
|
+
rule /`/, Punctuation, :pop!
|
200
|
+
end
|
201
|
+
|
181
202
|
[[:cb, '\{', '\}'],
|
182
203
|
[:rb, '\(', '\)'],
|
183
204
|
[:sb, '\[', '\]'],
|
@@ -192,6 +213,17 @@ module Rouge
|
|
192
213
|
end
|
193
214
|
end
|
194
215
|
|
216
|
+
state :in_interp do
|
217
|
+
rule /}/, Str::Interpol, :pop!
|
218
|
+
rule /\s+/, Text
|
219
|
+
rule /[a-z_]\w*/i, Str::Interpol
|
220
|
+
end
|
221
|
+
|
222
|
+
state :string_intp do
|
223
|
+
rule /[$@][{]/, Str::Interpol, :in_interp
|
224
|
+
rule /[$@][a-z_]\w*/i, Str::Interpol
|
225
|
+
end
|
226
|
+
|
195
227
|
state :end_part do
|
196
228
|
# eat the rest of the stream
|
197
229
|
rule /.+/m, Comment::Preproc, :pop!
|
data/lib/rouge/lexers/rust.rb
CHANGED
data/lib/rouge/lexers/scala.rb
CHANGED
@@ -47,12 +47,38 @@ module Rouge
|
|
47
47
|
rule %r(/\*), Comment::Multiline, :comment
|
48
48
|
|
49
49
|
rule /@#{idrest}/, Name::Decorator
|
50
|
+
|
51
|
+
rule /(def)(\s+)(#{idrest}|#{op}+|`[^`]+`)(\s*)/ do
|
52
|
+
groups Keyword, Text, Name::Function, Text
|
53
|
+
end
|
54
|
+
|
55
|
+
rule /(val)(\s+)(#{idrest}|#{op}+|`[^`]+`)(\s*)/ do
|
56
|
+
groups Keyword, Text, Name::Variable, Text
|
57
|
+
end
|
58
|
+
|
59
|
+
rule /(this)(\n*)(\.)(#{idrest})/ do
|
60
|
+
groups Keyword, Text, Operator, Name::Property
|
61
|
+
end
|
62
|
+
|
63
|
+
rule /(#{idrest}|_)(\n*)(\.)(#{idrest})/ do
|
64
|
+
groups Name::Variable, Text, Operator, Name::Property
|
65
|
+
end
|
66
|
+
|
67
|
+
rule /#{upper}#{idrest}\b/, Name::Class
|
68
|
+
|
69
|
+
rule /(#{idrest})(#{whitespace}*)(\()/ do
|
70
|
+
groups Name::Function, Text, Operator
|
71
|
+
end
|
72
|
+
|
73
|
+
rule /(\.)(#{idrest})/ do
|
74
|
+
groups Operator, Name::Property
|
75
|
+
end
|
76
|
+
|
50
77
|
rule %r(
|
51
78
|
(#{keywords.join("|")})\b|
|
52
79
|
(<[%:-]|=>|>:|[#=@_\u21D2\u2190])(\b|(?=\s)|$)
|
53
80
|
)x, Keyword
|
54
|
-
rule /:(?!#{op})/, Keyword, :type
|
55
|
-
rule /#{upper}#{idrest}\b/, Name::Class
|
81
|
+
rule /:(?!#{op})/, Keyword, :type
|
56
82
|
rule /(true|false|null)\b/, Keyword::Constant
|
57
83
|
rule /(import|package)(\s+)/ do
|
58
84
|
groups Keyword, Text
|
data/lib/rouge/lexers/shell.rb
CHANGED
@@ -10,7 +10,7 @@ module Rouge
|
|
10
10
|
tag 'shell'
|
11
11
|
aliases 'bash', 'zsh', 'ksh', 'sh'
|
12
12
|
filenames '*.sh', '*.bash', '*.zsh', '*.ksh',
|
13
|
-
'.bashrc', '.zshrc', '.kshrc', '.profile', 'PKGBUILD'
|
13
|
+
'.bashrc', '.zshrc', '.kshrc', '.profile', 'APKBUILD', 'PKGBUILD'
|
14
14
|
|
15
15
|
mimetypes 'application/x-sh', 'application/x-shellscript'
|
16
16
|
|
data/lib/rouge/lexers/slim.rb
CHANGED
@@ -172,9 +172,9 @@ module Rouge
|
|
172
172
|
# Need at top
|
173
173
|
mixin :indented_block
|
174
174
|
|
175
|
-
rule(
|
175
|
+
rule(/[,\\]\s*\n/) { delegate ruby }
|
176
176
|
rule /[ ]\|[ \t]*\n/, Str::Escape
|
177
|
-
rule(/.*?(?=(
|
177
|
+
rule(/.*?(?=([,\\]$| \|)?[ \t]*$)/) { delegate ruby }
|
178
178
|
end
|
179
179
|
|
180
180
|
state :filter_block do
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class SuperCollider < RegexLexer
|
7
|
+
tag 'supercollider'
|
8
|
+
filenames '*.sc', '*.scd'
|
9
|
+
|
10
|
+
title "SuperCollider"
|
11
|
+
desc 'A cross-platform interpreted programming language for sound synthesis, algorithmic composition, and realtime performance'
|
12
|
+
|
13
|
+
def self.keywords
|
14
|
+
@keywords ||= Set.new %w(
|
15
|
+
var arg classvar const super this
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
# these aren't technically keywords, but we treat
|
20
|
+
# them as such because it makes things clearer 99%
|
21
|
+
# of the time
|
22
|
+
def self.reserved
|
23
|
+
@reserved ||= Set.new %w(
|
24
|
+
case do for forBy loop if while new newCopyArgs
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.constants
|
29
|
+
@constants ||= Set.new %w(
|
30
|
+
true false nil inf thisThread
|
31
|
+
thisMethod thisFunction thisProcess
|
32
|
+
thisFunctionDef currentEnvironment
|
33
|
+
topEnvironment
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
state :whitespace do
|
38
|
+
rule /\s+/m, Text
|
39
|
+
end
|
40
|
+
|
41
|
+
state :comments do
|
42
|
+
rule %r(//.*?$), Comment::Single
|
43
|
+
rule %r(/[*]) do
|
44
|
+
token Comment::Multiline
|
45
|
+
push :nested_comment
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
state :nested_comment do
|
50
|
+
rule %r(/[*]), Comment::Multiline, :nested_comment
|
51
|
+
rule %r([*]/), Comment::Multiline, :pop!
|
52
|
+
rule %r([^*/]+)m, Comment::Multiline
|
53
|
+
rule /./, Comment::Multiline
|
54
|
+
end
|
55
|
+
|
56
|
+
state :root do
|
57
|
+
mixin :whitespace
|
58
|
+
mixin :comments
|
59
|
+
|
60
|
+
rule /[\-+]?0[xX]\h+/, Num::Hex
|
61
|
+
|
62
|
+
# radix float
|
63
|
+
rule /[\-+]?\d+r[0-9a-zA-Z]*(\.[0-9A-Z]*)?/, Num::Float
|
64
|
+
|
65
|
+
# normal float
|
66
|
+
rule /[\-+]?((\d+(\.\d+)?([eE][\-+]?\d+)?(pi)?)|pi)/, Num::Float
|
67
|
+
|
68
|
+
rule /[\-+]?\d+/, Num::Integer
|
69
|
+
|
70
|
+
rule /\$(\\.|.)/, Str::Char
|
71
|
+
|
72
|
+
rule /"([^\\"]|\\.)*"/, Str
|
73
|
+
|
74
|
+
# symbols (single-quote notation)
|
75
|
+
rule /'([^\\']|\\.)*'/, Str::Other
|
76
|
+
|
77
|
+
# symbols (backslash notation)
|
78
|
+
rule /\\\w+/, Str::Other
|
79
|
+
|
80
|
+
# symbol arg
|
81
|
+
rule /[A-Za-z_]\w*:/, Name::Label
|
82
|
+
|
83
|
+
rule /[A-Z]\w*/, Name::Class
|
84
|
+
|
85
|
+
# primitive
|
86
|
+
rule /_\w+/, Name::Function
|
87
|
+
|
88
|
+
# main identifiers section
|
89
|
+
rule /[a-z]\w*/ do |m|
|
90
|
+
if self.class.keywords.include? m[0]
|
91
|
+
token Keyword
|
92
|
+
elsif self.class.constants.include? m[0]
|
93
|
+
token Keyword::Constant
|
94
|
+
elsif self.class.reserved.include? m[0]
|
95
|
+
token Keyword::Reserved
|
96
|
+
else
|
97
|
+
token Name
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# environment variables
|
102
|
+
rule /~\w+/, Name::Variable::Global
|
103
|
+
|
104
|
+
rule /[\{\}()\[\];,\.]/, Punctuation
|
105
|
+
|
106
|
+
# operators. treat # (array unpack) as an operator
|
107
|
+
rule /[\+\-\*\/&\|%<>=]+/, Operator
|
108
|
+
rule /[\^:#]/, Operator
|
109
|
+
|
110
|
+
# treat curry argument as a special operator
|
111
|
+
rule /\b_\b/, Name::Builtin
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
data/lib/rouge/lexers/xml.rb
CHANGED
@@ -0,0 +1,61 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class Xojo < RegexLexer
|
7
|
+
title "Xojo"
|
8
|
+
desc "Xojo"
|
9
|
+
tag 'xojo'
|
10
|
+
aliases 'realbasic'
|
11
|
+
filenames '*.xojo_code', '*.xojo_window', '*.xojo_toolbar', '*.xojo_menu'
|
12
|
+
|
13
|
+
keywords = %w(
|
14
|
+
addhandler aggregates array asc assigns attributes begin break
|
15
|
+
byref byval call case catch class const continue char ctype declare
|
16
|
+
delegate dim do downto each else elseif end enum event exception
|
17
|
+
exit extends false finally for function global goto if
|
18
|
+
implements inherits interface lib loop mod module
|
19
|
+
new next nil object of optional paramarray
|
20
|
+
private property protected public raise raiseevent rect redim
|
21
|
+
removehandler return select shared soft static step sub super
|
22
|
+
then to true try until using uend uhile
|
23
|
+
)
|
24
|
+
|
25
|
+
keywords_type = %w(
|
26
|
+
boolean cfstringref cgfloat cstring curency date double int8 int16
|
27
|
+
int32 int64 integer ostype pstring ptr short single
|
28
|
+
single string structure variant uinteger uint8 uint16 uint32 uint64
|
29
|
+
ushort windowptr wstring
|
30
|
+
)
|
31
|
+
|
32
|
+
operator_words = %w(
|
33
|
+
addressof and as in is isa mod not or xor
|
34
|
+
)
|
35
|
+
|
36
|
+
state :root do
|
37
|
+
rule /\s+/, Text::Whitespace
|
38
|
+
|
39
|
+
rule /rem\b.*?$/i, Comment::Single
|
40
|
+
rule /\/\/.*$/, Comment::Single
|
41
|
+
rule /\#tag Note.*\#tag EndNote/m, Comment::Preproc
|
42
|
+
rule /\s*[#].*$/x, Comment::Preproc
|
43
|
+
|
44
|
+
rule /".*?"/, Literal::String::Double
|
45
|
+
rule /[(){}!#,:]/, Punctuation
|
46
|
+
|
47
|
+
rule /\b(?:#{keywords.join('|')})\b/i, Keyword
|
48
|
+
rule /\b(?:#{keywords_type.join('|')})\b/i, Keyword::Declaration
|
49
|
+
|
50
|
+
rule /\b(?:#{operator_words.join('|')})\b/i, Operator
|
51
|
+
rule /[+-]?(\d+\.\d*|\d*\.\d+)/i, Literal::Number::Float
|
52
|
+
rule /[+-]?\d+/, Literal::Number::Integer
|
53
|
+
rule /&[CH][0-9a-f]+/i, Literal::Number::Hex
|
54
|
+
rule /&O[0-7]+/i, Literal::Number::Oct
|
55
|
+
|
56
|
+
rule /\b[\w\.]+\b/i, Text
|
57
|
+
rule(%r(<=|>=|<>|[=><\+\-\*\/\\]), Operator)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|