rouge 3.6.0 → 3.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/rouge/demos/ada +26 -0
- data/lib/rouge/demos/apex +9 -0
- data/lib/rouge/demos/armasm +12 -0
- data/lib/rouge/demos/batchfile +3 -0
- data/lib/rouge/demos/bbcbasic +6 -0
- data/lib/rouge/demos/clean +6 -0
- data/lib/rouge/demos/cmhg +8 -0
- data/lib/rouge/demos/csvs +8 -0
- data/lib/rouge/demos/cuda +11 -0
- data/lib/rouge/demos/cython +6 -0
- data/lib/rouge/demos/eex +1 -0
- data/lib/rouge/demos/epp +4 -0
- data/lib/rouge/demos/gdscript +18 -0
- data/lib/rouge/demos/haxe +5 -0
- data/lib/rouge/demos/hocon +8 -0
- data/lib/rouge/demos/hql +5 -0
- data/lib/rouge/demos/jsl +3 -0
- data/lib/rouge/demos/liquid +0 -1
- data/lib/rouge/demos/lustre +6 -0
- data/lib/rouge/demos/lutin +18 -0
- data/lib/rouge/demos/mason +22 -0
- data/lib/rouge/demos/msgtrans +4 -0
- data/lib/rouge/demos/opentype_feature_file +6 -0
- data/lib/rouge/demos/plist +1 -132
- data/lib/rouge/demos/reasonml +12 -0
- data/lib/rouge/demos/robot_framework +27 -0
- data/lib/rouge/demos/sas +13 -0
- data/lib/rouge/demos/sparql +6 -0
- data/lib/rouge/demos/terraform +0 -15
- data/lib/rouge/formatters/html_line_table.rb +3 -1
- data/lib/rouge/formatters/tex.rb +14 -12
- data/lib/rouge/guessers/disambiguation.rb +17 -0
- data/lib/rouge/lexers/ada.rb +162 -0
- data/lib/rouge/lexers/apex.rb +126 -0
- data/lib/rouge/lexers/armasm.rb +145 -0
- data/lib/rouge/lexers/batchfile.rb +164 -0
- data/lib/rouge/lexers/bbcbasic.rb +112 -0
- data/lib/rouge/lexers/clean.rb +156 -0
- data/lib/rouge/lexers/cmhg.rb +34 -0
- data/lib/rouge/lexers/common_lisp.rb +1 -1
- data/lib/rouge/lexers/console.rb +1 -1
- data/lib/rouge/lexers/coq.rb +12 -9
- data/lib/rouge/lexers/cpp.rb +4 -1
- data/lib/rouge/lexers/csvs.rb +44 -0
- data/lib/rouge/lexers/cuda.rb +35 -0
- data/lib/rouge/lexers/cython.rb +151 -0
- data/lib/rouge/lexers/eex.rb +51 -0
- data/lib/rouge/lexers/elixir.rb +20 -9
- data/lib/rouge/lexers/epp.rb +51 -0
- data/lib/rouge/lexers/escape.rb +3 -0
- data/lib/rouge/lexers/gdscript.rb +171 -0
- data/lib/rouge/lexers/gherkin.rb +4 -2
- data/lib/rouge/lexers/graphql.rb +10 -3
- data/lib/rouge/lexers/handlebars.rb +14 -3
- data/lib/rouge/lexers/haxe.rb +246 -0
- data/lib/rouge/lexers/hocon.rb +86 -0
- data/lib/rouge/lexers/hql.rb +139 -0
- data/lib/rouge/lexers/html.rb +2 -2
- data/lib/rouge/lexers/http.rb +5 -5
- data/lib/rouge/lexers/igorpro.rb +1 -1
- data/lib/rouge/lexers/javascript.rb +1 -1
- data/lib/rouge/lexers/jsl.rb +55 -0
- data/lib/rouge/lexers/json.rb +43 -5
- data/lib/rouge/lexers/julia.rb +1 -1
- data/lib/rouge/lexers/kotlin.rb +21 -28
- data/lib/rouge/lexers/liquid.rb +82 -108
- data/lib/rouge/lexers/lustre.rb +79 -0
- data/lib/rouge/lexers/lutin.rb +33 -0
- data/lib/rouge/lexers/make.rb +39 -12
- data/lib/rouge/lexers/mason.rb +115 -0
- data/lib/rouge/lexers/matlab.rb +4 -2
- data/lib/rouge/lexers/matlab/builtins.yml +3515 -0
- data/lib/rouge/lexers/msgtrans.rb +26 -0
- data/lib/rouge/lexers/ocaml.rb +12 -48
- data/lib/rouge/lexers/ocaml/common.rb +53 -0
- data/lib/rouge/lexers/opentype_feature_file.rb +113 -0
- data/lib/rouge/lexers/php.rb +31 -9
- data/lib/rouge/lexers/php/builtins.rb +181 -174
- data/lib/rouge/lexers/plain_text.rb +1 -1
- data/lib/rouge/lexers/puppet.rb +2 -2
- data/lib/rouge/lexers/q.rb +1 -1
- data/lib/rouge/lexers/r.rb +2 -3
- data/lib/rouge/lexers/reasonml.rb +65 -0
- data/lib/rouge/lexers/robot_framework.rb +249 -0
- data/lib/rouge/lexers/rust.rb +12 -9
- data/lib/rouge/lexers/sas.rb +563 -0
- data/lib/rouge/lexers/sed.rb +1 -1
- data/lib/rouge/lexers/shell.rb +5 -3
- data/lib/rouge/lexers/smarty.rb +10 -10
- data/lib/rouge/lexers/sparql.rb +129 -0
- data/lib/rouge/lexers/sql.rb +26 -6
- data/lib/rouge/lexers/swift.rb +1 -1
- data/lib/rouge/lexers/terraform.rb +8 -0
- data/lib/rouge/tex_theme_renderer.rb +5 -1
- data/lib/rouge/themes/magritte.rb +3 -3
- data/lib/rouge/themes/thankful_eyes.rb +1 -1
- data/lib/rouge/themes/tulip.rb +1 -1
- data/lib/rouge/version.rb +1 -1
- data/rouge.gemspec +4 -3
- metadata +61 -6
- data/lib/rouge/lexers/matlab/builtins.rb +0 -13
data/lib/rouge/lexers/liquid.rb
CHANGED
@@ -12,12 +12,12 @@ module Rouge
|
|
12
12
|
state :root do
|
13
13
|
rule %r/[^\{]+/, Text
|
14
14
|
|
15
|
-
rule %r/(\{
|
15
|
+
rule %r/(\{%-?)(\s*)/ do
|
16
16
|
groups Punctuation, Text::Whitespace
|
17
17
|
push :tag_or_block
|
18
18
|
end
|
19
19
|
|
20
|
-
rule %r/(\{\{)(\s*)/ do
|
20
|
+
rule %r/(\{\{-?)(\s*)/ do
|
21
21
|
groups Punctuation, Text::Whitespace
|
22
22
|
push :output
|
23
23
|
end
|
@@ -27,78 +27,70 @@ module Rouge
|
|
27
27
|
|
28
28
|
state :tag_or_block do
|
29
29
|
# builtin logic blocks
|
30
|
-
rule %r/(if|unless|
|
30
|
+
rule %r/(if|elsif|unless|case)\b/, Keyword::Reserved, :condition
|
31
|
+
rule %r/(when)\b/, Keyword::Reserved, :when
|
31
32
|
|
32
|
-
rule %r/(
|
33
|
-
groups Keyword::Reserved, Text::Whitespace
|
34
|
-
push :when
|
35
|
-
end
|
36
|
-
|
37
|
-
rule %r/(else)(\s*)(%\})/ do
|
33
|
+
rule %r/(else)(\s*)(-?%\})/ do
|
38
34
|
groups Keyword::Reserved, Text::Whitespace, Punctuation
|
39
35
|
pop!
|
40
36
|
end
|
41
37
|
|
42
38
|
# other builtin blocks
|
43
|
-
rule %r/(capture)(\s+)([^\s%]+)(\s*)(
|
44
|
-
groups Name::Tag, Text::Whitespace, Name::
|
39
|
+
rule %r/(capture|(?:in|de)crement)(\s+)([^\s%]+)(\s*)(-?%\})/ do
|
40
|
+
groups Name::Tag, Text::Whitespace, Name::Variable, Text::Whitespace, Punctuation
|
45
41
|
pop!
|
46
42
|
end
|
47
43
|
|
48
|
-
rule %r/(comment)(\s*)(
|
44
|
+
rule %r/(comment)(\s*)(-?%\})/ do
|
49
45
|
groups Name::Tag, Text::Whitespace, Punctuation
|
50
46
|
push :comment
|
51
47
|
end
|
52
48
|
|
53
|
-
rule %r/(raw)(\s*)(
|
49
|
+
rule %r/(raw)(\s*)(-?%\})/ do
|
54
50
|
groups Name::Tag, Text::Whitespace, Punctuation
|
55
51
|
push :raw
|
56
52
|
end
|
57
53
|
|
58
|
-
rule %r/assign/, Name::Tag, :assign
|
59
|
-
rule %r/include/, Name::Tag, :include
|
60
|
-
|
61
54
|
# end of block
|
62
|
-
rule %r/(end(?:
|
55
|
+
rule %r/(end(?:if|unless|case))(\s*)(-?%\})/ do
|
63
56
|
groups Keyword::Reserved, Text::Whitespace, Punctuation
|
64
57
|
pop!
|
65
58
|
end
|
66
59
|
|
67
|
-
rule %r/(end(?:[^\s%]+))(\s*)(
|
60
|
+
rule %r/(end(?:[^\s%]+))(\s*)(-?%\})/ do
|
68
61
|
groups Name::Tag, Text::Whitespace, Punctuation
|
69
62
|
pop!
|
70
63
|
end
|
71
64
|
|
72
65
|
# builtin tags
|
73
|
-
rule %r/(
|
74
|
-
|
75
|
-
token Text::Whitespace, m[2]
|
66
|
+
rule %r/(assign|echo)\b/, Name::Tag, :assign
|
67
|
+
rule %r/(include|render)\b/, Name::Tag, :include
|
76
68
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
69
|
+
rule %r/(cycle)(\s+)(?:([^\s:]*)(\s*)(:))?(\s*)/ do |m|
|
70
|
+
token_class = case m[3]
|
71
|
+
when %r/'[^']*'/ then Str::Single
|
72
|
+
when %r/"[^"]*"/ then Str::Double
|
73
|
+
else
|
74
|
+
Name::Attribute
|
75
|
+
end
|
84
76
|
|
85
|
-
|
86
|
-
|
77
|
+
groups Name::Tag, Text::Whitespace, token_class,
|
78
|
+
Text::Whitespace, Punctuation, Text::Whitespace
|
87
79
|
|
88
80
|
push :variable_tag_markup
|
89
81
|
end
|
90
82
|
|
91
83
|
# iteration
|
92
84
|
rule %r/
|
93
|
-
(for)(\s+)
|
85
|
+
(for|tablerow)(\s+)
|
94
86
|
([\w-]+)(\s+)
|
95
87
|
(in)(\s+)
|
96
88
|
(
|
97
|
-
(?: [^\s
|
89
|
+
(?: [^\s%,\|'"] | (?:"[^"]*"|'[^']*') )+
|
98
90
|
)(\s*)
|
99
91
|
/x do |m|
|
100
92
|
groups Name::Tag, Text::Whitespace, Name::Variable, Text::Whitespace,
|
101
|
-
|
93
|
+
Name::Tag, Text::Whitespace
|
102
94
|
|
103
95
|
token_class = case m[7]
|
104
96
|
when %r/'[^']*'/ then Str::Single
|
@@ -119,105 +111,76 @@ module Rouge
|
|
119
111
|
end
|
120
112
|
|
121
113
|
state :output do
|
122
|
-
|
123
|
-
|
114
|
+
rule %r/(\|)(\s*)([a-zA-Z_][^\s}\|:]*)/ do
|
115
|
+
groups Punctuation, Text::Whitespace, Name::Function
|
116
|
+
push :filters
|
117
|
+
end
|
124
118
|
|
125
|
-
|
126
|
-
|
119
|
+
mixin :end_of_tag
|
120
|
+
mixin :generic
|
127
121
|
end
|
128
122
|
|
129
123
|
state :filters do
|
130
|
-
|
131
|
-
|
132
|
-
rule(/\}\}/) { token Punctuation; reset_stack }
|
133
|
-
|
134
|
-
rule %r/([^\s\|:]+)(:?)(\s*)/ do
|
135
|
-
groups Name::Function, Punctuation, Text::Whitespace
|
136
|
-
push :filter_markup
|
124
|
+
rule %r/(\|)(\s*)([a-zA-Z_][^\s%}\|:]*)/ do
|
125
|
+
groups Punctuation, Text::Whitespace, Name::Function
|
137
126
|
end
|
138
|
-
end
|
139
|
-
|
140
|
-
state :filter_markup do
|
141
|
-
rule %r/\|/, Punctuation, :pop!
|
142
127
|
|
143
128
|
mixin :end_of_tag
|
144
129
|
mixin :end_of_block
|
145
|
-
mixin :
|
130
|
+
mixin :variable_param_markup
|
146
131
|
end
|
147
132
|
|
148
133
|
state :condition do
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
rule %r/([=!><]=?)/, Operator
|
153
|
-
|
154
|
-
rule %r/\b(?:(!)|(not\b))/ do
|
155
|
-
groups Operator, Operator::Word
|
156
|
-
end
|
157
|
-
|
158
|
-
rule %r/(contains)/, Operator::Word
|
134
|
+
rule %r/([=!]=|[<>]=?)/, Operator
|
135
|
+
rule %r/(and|or|contains)\b/, Operator::Word
|
159
136
|
|
137
|
+
mixin :end_of_block
|
160
138
|
mixin :generic
|
161
|
-
mixin :whitespace
|
162
139
|
end
|
163
140
|
|
164
141
|
state :when do
|
165
142
|
mixin :end_of_block
|
166
|
-
mixin :whitespace
|
167
143
|
mixin :generic
|
168
144
|
end
|
169
145
|
|
170
|
-
state :operator do
|
171
|
-
rule %r/(\s*)((?:=|!|>|<)=?)(\s*)/ do
|
172
|
-
groups Text::Whitespace, Operator, Text::Whitespace
|
173
|
-
pop!
|
174
|
-
end
|
175
|
-
|
176
|
-
rule %r/(\s*)(\bcontains\b)(\s*)/ do
|
177
|
-
groups Text::Whitespace, Operator::Word, Text::Whitespace
|
178
|
-
pop!
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
146
|
state :end_of_tag do
|
183
|
-
rule(
|
147
|
+
rule(/-?\}\}/) { token Punctuation; reset_stack }
|
184
148
|
end
|
185
149
|
|
186
150
|
state :end_of_block do
|
187
|
-
rule(
|
151
|
+
rule(/-?%\}/) { token Punctuation; reset_stack }
|
188
152
|
end
|
189
153
|
|
190
154
|
# states for unknown markup
|
191
155
|
state :param_markup do
|
192
156
|
mixin :whitespace
|
157
|
+
mixin :keyword
|
193
158
|
mixin :string
|
159
|
+
mixin :number
|
194
160
|
|
195
161
|
rule %r/([^\s=:]+)(\s*)(=|:)/ do
|
196
162
|
groups Name::Attribute, Text::Whitespace, Operator
|
197
163
|
end
|
198
164
|
|
199
|
-
rule %r/
|
200
|
-
groups Punctuation, Text::Whitespace, Text, Text::Whitespace, Punctuation
|
201
|
-
end
|
202
|
-
|
203
|
-
mixin :number
|
204
|
-
mixin :keyword
|
205
|
-
|
206
|
-
rule %r/,/, Punctuation
|
165
|
+
rule %r/[,:]/, Punctuation
|
207
166
|
end
|
208
167
|
|
209
168
|
state :default_param_markup do
|
210
169
|
mixin :param_markup
|
211
|
-
|
170
|
+
|
171
|
+
rule %r/\S+/, Text
|
212
172
|
end
|
213
173
|
|
214
174
|
state :variable_param_markup do
|
215
175
|
mixin :param_markup
|
216
176
|
mixin :variable
|
217
|
-
|
177
|
+
|
178
|
+
rule %r/\S+/, Text
|
218
179
|
end
|
219
180
|
|
220
181
|
state :tag_markup do
|
182
|
+
rule %r/(reversed)\b/, Name::Attribute
|
183
|
+
|
221
184
|
mixin :end_of_block
|
222
185
|
mixin :default_param_markup
|
223
186
|
end
|
@@ -229,12 +192,14 @@ module Rouge
|
|
229
192
|
|
230
193
|
# states for different values types
|
231
194
|
state :keyword do
|
232
|
-
rule %r
|
195
|
+
rule %r/(false|true|nil)\b/, Keyword::Constant
|
233
196
|
end
|
234
197
|
|
235
198
|
state :variable do
|
236
|
-
rule %r
|
237
|
-
rule %r
|
199
|
+
rule %r/(empty|blank|forloop\.[^\s%}\|:]+)\b/, Name::Builtin
|
200
|
+
rule %r/\.(?=\w)|\[|\]/, Punctuation
|
201
|
+
rule %r/(first|last|size)\b/, Name::Function
|
202
|
+
rule %r/[a-zA-Z_][\w-]*\??/, Name::Variable
|
238
203
|
end
|
239
204
|
|
240
205
|
state :string do
|
@@ -243,21 +208,17 @@ module Rouge
|
|
243
208
|
end
|
244
209
|
|
245
210
|
state :number do
|
211
|
+
rule %r/-/, Operator
|
246
212
|
rule %r/\d+\.\d+/, Num::Float
|
247
213
|
rule %r/\d+/, Num::Integer
|
248
214
|
end
|
249
215
|
|
250
|
-
state :array_index do
|
251
|
-
rule %r/\[/, Punctuation
|
252
|
-
rule %r/\]/, Punctuation
|
253
|
-
end
|
254
|
-
|
255
216
|
state :generic do
|
256
|
-
mixin :
|
217
|
+
mixin :whitespace
|
257
218
|
mixin :keyword
|
258
219
|
mixin :string
|
259
|
-
mixin :variable
|
260
220
|
mixin :number
|
221
|
+
mixin :variable
|
261
222
|
end
|
262
223
|
|
263
224
|
state :whitespace do
|
@@ -265,18 +226,20 @@ module Rouge
|
|
265
226
|
end
|
266
227
|
|
267
228
|
state :comment do
|
268
|
-
rule %r/
|
229
|
+
rule %r/[^\{]+/, Comment
|
230
|
+
|
231
|
+
rule %r/(\{%-?)(\s*)(endcomment)(\s*)(-?%\})/ do
|
269
232
|
groups Punctuation, Text::Whitespace, Name::Tag, Text::Whitespace, Punctuation
|
270
233
|
reset_stack
|
271
234
|
end
|
272
235
|
|
273
|
-
rule %r
|
236
|
+
rule %r/\{/, Comment
|
274
237
|
end
|
275
238
|
|
276
239
|
state :raw do
|
277
240
|
rule %r/[^\{]+/, Text
|
278
241
|
|
279
|
-
rule %r/(\{
|
242
|
+
rule %r/(\{%-?)(\s*)(endraw)(\s*)(-?%\})/ do
|
280
243
|
groups Punctuation, Text::Whitespace, Name::Tag, Text::Whitespace, Punctuation
|
281
244
|
reset_stack
|
282
245
|
end
|
@@ -285,27 +248,38 @@ module Rouge
|
|
285
248
|
end
|
286
249
|
|
287
250
|
state :assign do
|
288
|
-
|
289
|
-
mixin :end_of_block
|
251
|
+
rule %r/=/, Operator
|
290
252
|
|
291
|
-
rule %r/(\s*)(
|
292
|
-
groups Text::Whitespace,
|
253
|
+
rule %r/(\|)(\s*)([a-zA-Z_][^\s%\|:]*)/ do
|
254
|
+
groups Punctuation, Text::Whitespace, Name::Function
|
255
|
+
push :filters
|
293
256
|
end
|
294
257
|
|
295
|
-
|
296
|
-
|
258
|
+
mixin :end_of_block
|
297
259
|
mixin :generic
|
298
260
|
end
|
299
261
|
|
300
262
|
state :include do
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
groups Name::Attribute, Punctuation, Name::Attribute
|
263
|
+
rule %r/(\{\{-?)(\s*)/ do
|
264
|
+
groups Punctuation, Text::Whitespace
|
265
|
+
push :output_embed
|
305
266
|
end
|
306
267
|
|
268
|
+
rule %r/(with|for)\b/, Name::Tag
|
269
|
+
rule %r/[^\s\.]+(\.[^\s\.]+)+\b/, Name::Other
|
270
|
+
|
307
271
|
mixin :variable_tag_markup
|
308
272
|
end
|
273
|
+
|
274
|
+
state :output_embed do
|
275
|
+
rule %r/(\|)(\s*)([a-zA-Z_][^\s}\|:]*)/ do
|
276
|
+
groups Punctuation, Text::Whitespace, Name::Function
|
277
|
+
end
|
278
|
+
|
279
|
+
rule %r/-?\}\}/, Punctuation, :pop!
|
280
|
+
|
281
|
+
mixin :variable_param_markup
|
282
|
+
end
|
309
283
|
end
|
310
284
|
end
|
311
285
|
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class Lustre < RegexLexer
|
7
|
+
title "Lustre"
|
8
|
+
desc 'The Lustre programming language (Verimag)'
|
9
|
+
tag 'lustre'
|
10
|
+
filenames '*.lus'
|
11
|
+
mimetypes 'text/x-lustre'
|
12
|
+
|
13
|
+
def self.keywords
|
14
|
+
@keywords ||= Set.new %w(
|
15
|
+
extern unsafe assert const current enum function let node operator
|
16
|
+
returns step struct tel type var model package needs provides uses is
|
17
|
+
body end include merge
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.word_operators
|
22
|
+
@word_operators ||= Set.new %w(
|
23
|
+
div and xor mod or not nor if then else fby pre when with
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.primitives
|
28
|
+
@primitives ||= Set.new %w(int real bool)
|
29
|
+
end
|
30
|
+
|
31
|
+
operator = %r([,!$%&*+./:<=>?@^|~#-]+)
|
32
|
+
id = /[a-z_][\w']*/i
|
33
|
+
|
34
|
+
state :root do
|
35
|
+
rule %r/\s+/m, Text
|
36
|
+
rule %r/false|true/, Keyword::Constant
|
37
|
+
rule %r(\-\-.*), Comment::Single
|
38
|
+
rule %r(/\*.*?\*/)m, Comment::Multiline
|
39
|
+
rule %r(\(\*.*?\*\))m, Comment::Multiline
|
40
|
+
rule id do |m|
|
41
|
+
match = m[0]
|
42
|
+
if self.class.keywords.include? match
|
43
|
+
token Keyword
|
44
|
+
elsif self.class.word_operators.include? match
|
45
|
+
token Operator::Word
|
46
|
+
elsif self.class.primitives.include? match
|
47
|
+
token Keyword::Type
|
48
|
+
else
|
49
|
+
token Name
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
rule %r/[(){}\[\];]+/, Punctuation
|
54
|
+
rule operator, Operator
|
55
|
+
|
56
|
+
rule %r/-?\d[\d_]*(.[\d_]*)?(e[+-]?\d[\d_]*)/i, Num::Float
|
57
|
+
rule %r/\d[\d_]*/, Num::Integer
|
58
|
+
|
59
|
+
rule %r/'(?:(\\[\\"'ntbr ])|(\\[0-9]{3})|(\\x\h{2}))'/, Str::Char
|
60
|
+
rule %r/'[.]'/, Str::Char
|
61
|
+
rule %r/"/, Str::Double, :string
|
62
|
+
rule %r/[~?]#{id}/, Name::Variable
|
63
|
+
end
|
64
|
+
|
65
|
+
state :string do
|
66
|
+
rule %r/[^\\"]+/, Str::Double
|
67
|
+
mixin :escape_sequence
|
68
|
+
rule %r/\\\n/, Str::Double
|
69
|
+
rule %r/"/, Str::Double, :pop!
|
70
|
+
end
|
71
|
+
|
72
|
+
state :escape_sequence do
|
73
|
+
rule %r/\\[\\"'ntbr]/, Str::Escape
|
74
|
+
rule %r/\\\d{3}/, Str::Escape
|
75
|
+
rule %r/\\x\h{2}/, Str::Escape
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# adapted from lustre.rf (adapted from ocaml.rb), hence some ocaml-ism migth remains
|
5
|
+
module Rouge
|
6
|
+
module Lexers
|
7
|
+
load_lexer 'lustre.rb'
|
8
|
+
|
9
|
+
class Lutin < Lustre
|
10
|
+
title "Lutin"
|
11
|
+
desc 'The Lutin programming language (Verimag)'
|
12
|
+
tag 'lutin'
|
13
|
+
filenames '*.lut'
|
14
|
+
mimetypes 'text/x-lutin'
|
15
|
+
|
16
|
+
def self.keywords
|
17
|
+
@keywords ||= Set.new %w(
|
18
|
+
let in node extern system returns weak strong assert raise try catch
|
19
|
+
trap do exist erun run type ref exception include false true
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.word_operators
|
24
|
+
@word_operators ||= Set.new %w(
|
25
|
+
div and xor mod or not nor if then else pre)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.primitives
|
29
|
+
@primitives ||= Set.new %w(int real bool trace loop fby)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|