rouge 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,109 +15,138 @@ module Rouge
15
15
  return true if text.shebang? 'praat'
16
16
  end
17
17
 
18
- keywords = %w(
19
- if then else elsif elif endif fi for from to endfor endproc while
20
- endwhile repeat until select plus minus demo assert stopwatch
21
- nocheck nowarn noprogress editor endeditor clearinfo
22
- )
23
-
24
- functions_string = %w(
25
- backslashTrigraphsToUnicode chooseDirectory chooseReadFile
26
- chooseWriteFile date demoKey do environment extractLine extractWord
27
- fixed info left mid percent readFile replace replace_regex right
28
- selected string unicodeToBackslashTrigraphs
29
- )
30
-
31
- functions_numeric = %w(
32
- abs appendFile appendFileLine appendInfo appendInfoLine arccos arccosh
33
- arcsin arcsinh arctan arctan2 arctanh barkToHertz beginPause
34
- beginSendPraat besselI besselK beta beta2 binomialP binomialQ boolean
35
- ceiling chiSquareP chiSquareQ choice comment cos cosh createDirectory
36
- deleteFile demoClicked demoClickedIn demoCommandKeyPressed
37
- demoExtraControlKeyPressed demoInput demoKeyPressed
38
- demoOptionKeyPressed demoShiftKeyPressed demoShow demoWaitForInput
39
- demoWindowTitle demoX demoY differenceLimensToPhon do editor endPause
40
- endSendPraat endsWith erb erbToHertz erf erfc exitScript exp
41
- extractNumber fileReadable fisherP fisherQ floor gaussP gaussQ hash
42
- hertzToBark hertzToErb hertzToMel hertzToSemitones imax imin
43
- incompleteBeta incompleteGammaP index index_regex integer invBinomialP
44
- invBinomialQ invChiSquareQ invFisherQ invGaussQ invSigmoid invStudentQ
45
- length ln lnBeta lnGamma log10 log2 max melToHertz min minusObject
46
- natural number numberOfColumns numberOfRows numberOfSelected
47
- objectsAreIdentical option optionMenu pauseScript
48
- phonToDifferenceLimens plusObject positive randomBinomial randomGauss
49
- randomInteger randomPoisson randomUniform real readFile removeObject
50
- rindex rindex_regex round runScript runSystem runSystem_nocheck
51
- selectObject selected semitonesToHertz sentence sentencetext sigmoid
52
- sin sinc sincpi sinh soundPressureToPhon sqrt startsWith studentP
53
- studentQ tan tanh text variableExists word writeFile writeFileLine
54
- writeInfo writeInfoLine
55
- )
56
-
57
- functions_array = %w(
58
- linear randomGauss randomInteger randomUniform zero
59
- )
60
-
61
- functions_matrix = %w(
62
- linear mul mul_fast mul_metal mul_nt mul_tn mul_tt outer peaks
63
- randomGamma randomGauss randomInteger randomUniform softmaxPerRow
64
- solve transpose zero
65
- )
66
-
67
- functions_string_vector = %w(
68
- empty fileNames folderNames readLinesFromFile splitByWhitespace
69
- )
70
-
71
- objects = %w(
72
- Activation AffineTransform AmplitudeTier Art Artword Autosegment
73
- BarkFilter BarkSpectrogram CCA Categories Cepstrogram Cepstrum
74
- Cepstrumc ChebyshevSeries ClassificationTable Cochleagram Collection
75
- ComplexSpectrogram Configuration Confusion ContingencyTable Corpus
76
- Correlation Covariance CrossCorrelationTable CrossCorrelationTableList
77
- CrossCorrelationTables DTW DataModeler Diagonalizer Discriminant
78
- Dissimilarity Distance Distributions DurationTier EEG ERP ERPTier
79
- EditCostsTable EditDistanceTable Eigen Excitation Excitations
80
- ExperimentMFC FFNet FeatureWeights FileInMemory FilesInMemory Formant
81
- FormantFilter FormantGrid FormantModeler FormantPoint FormantTier
82
- GaussianMixture HMM HMM_Observation HMM_ObservationSequence HMM_State
83
- HMM_StateSequence HMMObservation HMMObservationSequence HMMState
84
- HMMStateSequence Harmonicity ISpline Index Intensity IntensityTier
85
- IntervalTier KNN KlattGrid KlattTable LFCC LPC Label LegendreSeries
86
- LinearRegression LogisticRegression LongSound Ltas MFCC MSpline ManPages
87
- Manipulation Matrix MelFilter MelSpectrogram MixingMatrix Movie Network
88
- OTGrammar OTHistory OTMulti PCA PairDistribution ParamCurve Pattern
89
- Permutation Photo Pitch PitchModeler PitchTier PointProcess Polygon
90
- Polynomial PowerCepstrogram PowerCepstrum Procrustes RealPoint RealTier
91
- ResultsMFC Roots SPINET SSCP SVD Salience ScalarProduct Similarity
92
- SimpleString SortedSetOfString Sound Speaker Spectrogram Spectrum
93
- SpectrumTier SpeechSynthesizer SpellingChecker Strings StringsIndex
94
- Table TableOfReal TextGrid TextInterval TextPoint TextTier Tier
95
- Transition VocalTract VocalTractTier Weight WordList
96
- )
97
-
98
- variables_numeric = %w(
99
- all average e left macintosh mono pi praatVersion right stereo
100
- undefined unix windows
101
- )
102
-
103
- variables_string = %w(
104
- praatVersion tab shellDirectory homeDirectory
105
- preferencesDirectory newline temporaryDirectory
106
- defaultDirectory
107
- )
108
-
109
- object_attributes = %w(
110
- ncol nrow xmin ymin xmax ymax nx ny dx dy
111
- )
18
+ def self.keywords
19
+ @keywords ||= %w(
20
+ if then else elsif elif endif fi for from to endfor endproc while
21
+ endwhile repeat until select plus minus demo assert stopwatch
22
+ nocheck nowarn noprogress editor endeditor clearinfo
23
+ )
24
+ end
25
+
26
+ def self.functions_string
27
+ @functions_string ||= %w(
28
+ backslashTrigraphsToUnicode$ chooseDirectory$ chooseReadFile$
29
+ chooseWriteFile$ date$ demoKey$ do$ environment$ extractLine$ extractWord$
30
+ fixed$ info$ left$ mid$ percent$ readFile$ replace$ replace_regex$ right$
31
+ selected$ string$ unicodeToBackslashTrigraphs$
32
+ )
33
+ end
34
+
35
+ def self.functions_numeric
36
+ @functions_numeric ||= %w(
37
+ abs appendFile appendFileLine appendInfo appendInfoLine arccos arccosh
38
+ arcsin arcsinh arctan arctan2 arctanh barkToHertz beginPause
39
+ beginSendPraat besselI besselK beta beta2 binomialP binomialQ boolean
40
+ ceiling chiSquareP chiSquareQ choice comment cos cosh createDirectory
41
+ deleteFile demoClicked demoClickedIn demoCommandKeyPressed
42
+ demoExtraControlKeyPressed demoInput demoKeyPressed
43
+ demoOptionKeyPressed demoShiftKeyPressed demoShow demoWaitForInput
44
+ demoWindowTitle demoX demoY differenceLimensToPhon do editor endPause
45
+ endSendPraat endsWith erb erbToHertz erf erfc exitScript exp
46
+ extractNumber fileReadable fisherP fisherQ floor gaussP gaussQ hash
47
+ hertzToBark hertzToErb hertzToMel hertzToSemitones imax imin
48
+ incompleteBeta incompleteGammaP index index_regex integer invBinomialP
49
+ invBinomialQ invChiSquareQ invFisherQ invGaussQ invSigmoid invStudentQ
50
+ length ln lnBeta lnGamma log10 log2 max melToHertz min minusObject
51
+ natural number numberOfColumns numberOfRows numberOfSelected
52
+ objectsAreIdentical option optionMenu pauseScript
53
+ phonToDifferenceLimens plusObject positive randomBinomial randomGauss
54
+ randomInteger randomPoisson randomUniform real readFile removeObject
55
+ rindex rindex_regex round runScript runSystem runSystem_nocheck
56
+ selectObject selected semitonesToHertz sentence sentencetext sigmoid
57
+ sin sinc sincpi sinh soundPressureToPhon sqrt startsWith studentP
58
+ studentQ tan tanh text variableExists word writeFile writeFileLine
59
+ writeInfo writeInfoLine
60
+ )
61
+ end
62
+
63
+ def self.functions_array
64
+ @functions_array ||= %w(
65
+ linear# randomGauss# randomInteger# randomUniform# zero#
66
+ )
67
+ end
68
+
69
+ def self.functions_matrix
70
+ @functions_matrix ||= %w(
71
+ linear## mul## mul_fast## mul_metal## mul_nt## mul_tn## mul_tt## outer## peaks##
72
+ randomGamma## randomGauss## randomInteger## randomUniform## softmaxPerRow##
73
+ solve## transpose## zero##
74
+ )
75
+ end
76
+
77
+ def self.functions_string_vector
78
+ @functions_string_vector ||= %w(
79
+ empty$# fileNames$# folderNames$# readLinesFromFile$# splitByWhitespace$#
80
+ )
81
+ end
82
+
83
+ def self.functions_builtin
84
+ @functions_builtin ||=
85
+ self.functions_string |
86
+ self.functions_numeric |
87
+ self.functions_array |
88
+ self.functions_matrix |
89
+ self.functions_string_vector
90
+ end
91
+
92
+ def self.objects
93
+ @objects ||= %w(
94
+ Activation AffineTransform AmplitudeTier Art Artword Autosegment
95
+ BarkFilter BarkSpectrogram CCA Categories Cepstrogram Cepstrum
96
+ Cepstrumc ChebyshevSeries ClassificationTable Cochleagram Collection
97
+ ComplexSpectrogram Configuration Confusion ContingencyTable Corpus
98
+ Correlation Covariance CrossCorrelationTable CrossCorrelationTableList
99
+ CrossCorrelationTables DTW DataModeler Diagonalizer Discriminant
100
+ Dissimilarity Distance Distributions DurationTier EEG ERP ERPTier
101
+ EditCostsTable EditDistanceTable Eigen Excitation Excitations
102
+ ExperimentMFC FFNet FeatureWeights FileInMemory FilesInMemory Formant
103
+ FormantFilter FormantGrid FormantModeler FormantPoint FormantTier
104
+ GaussianMixture HMM HMM_Observation HMM_ObservationSequence HMM_State
105
+ HMM_StateSequence HMMObservation HMMObservationSequence HMMState
106
+ HMMStateSequence Harmonicity ISpline Index Intensity IntensityTier
107
+ IntervalTier KNN KlattGrid KlattTable LFCC LPC Label LegendreSeries
108
+ LinearRegression LogisticRegression LongSound Ltas MFCC MSpline ManPages
109
+ Manipulation Matrix MelFilter MelSpectrogram MixingMatrix Movie Network
110
+ OTGrammar OTHistory OTMulti PCA PairDistribution ParamCurve Pattern
111
+ Permutation Photo Pitch PitchModeler PitchTier PointProcess Polygon
112
+ Polynomial PowerCepstrogram PowerCepstrum Procrustes RealPoint RealTier
113
+ ResultsMFC Roots SPINET SSCP SVD Salience ScalarProduct Similarity
114
+ SimpleString SortedSetOfString Sound Speaker Spectrogram Spectrum
115
+ SpectrumTier SpeechSynthesizer SpellingChecker Strings StringsIndex
116
+ Table TableOfReal TextGrid TextInterval TextPoint TextTier Tier
117
+ Transition VocalTract VocalTractTier Weight WordList
118
+ )
119
+ end
120
+
121
+ def self.variables_numeric
122
+ @variables_numeric ||= %w(
123
+ all average e left macintosh mono pi praatVersion right stereo
124
+ undefined unix windows
125
+ )
126
+ end
127
+
128
+ def self.variables_string
129
+ @variables_string ||= %w(
130
+ praatVersion$ tab$ shellDirectory$ homeDirectory$
131
+ preferencesDirectory$ newline$ temporaryDirectory$
132
+ defaultDirectory$
133
+ )
134
+ end
135
+
136
+ def self.object_attributes
137
+ @object_attributes ||= %w(
138
+ ncol nrow xmin ymin xmax ymax nx ny dx dy
139
+ )
140
+ end
112
141
 
113
142
  state :root do
114
143
  rule %r/(\s+)(#.*?$)/ do
115
144
  groups Text, Comment::Single
116
145
  end
117
146
 
118
- rule %r/^#.*?$/, Comment::Single
119
- rule %r/;[^\n]*/, Comment::Single
120
- rule %r/\s+/, Text
147
+ rule %r/^#.*?$/, Comment::Single
148
+ rule %r/;[^\n]*/, Comment::Single
149
+ rule %r/\s+/, Text
121
150
 
122
151
  rule %r/(\bprocedure)(\s+)/ do
123
152
  groups Keyword, Text
@@ -129,12 +158,11 @@ module Rouge
129
158
  push :procedure_call
130
159
  end
131
160
 
132
- rule %r/@/, Name::Function, :procedure_call
161
+ rule %r/@/, Name::Function, :procedure_call
133
162
 
134
163
  mixin :function_call
135
164
 
136
165
  rule %r/\b(?:select all)\b/, Keyword
137
- rule %r/\b(?:#{keywords.join('|')})\b/, Keyword
138
166
 
139
167
  rule %r/(\bform\b)(\s+)([^\n]+)/ do
140
168
  groups Keyword, Text, Literal::String
@@ -156,10 +184,27 @@ module Rouge
156
184
 
157
185
  rule %r/"/, Literal::String, :string
158
186
 
159
- rule %r/\b(?:#{objects.join('|')})(?=\s+\S+\n)/, Name::Class, :string_unquoted
187
+ rule %r/\b([A-Z][a-zA-Z0-9]+)(?=\s+\S+\n)/ do |m|
188
+ match = m[0]
189
+ if self.class.objects.include?(match)
190
+ token Name::Class
191
+ push :string_unquoted
192
+ else
193
+ token Keyword
194
+ end
195
+ end
160
196
 
161
197
  rule %r/\b(?=[A-Z])/, Text, :command
162
198
  rule %r/(\.{3}|[)(,\$])/, Punctuation
199
+
200
+ rule %r/[a_z]+/ do |m|
201
+ match = m[0]
202
+ if self.class.keywords.include?(match)
203
+ token Keyword
204
+ else
205
+ token Text
206
+ end
207
+ end
163
208
  end
164
209
 
165
210
  state :command do
@@ -178,7 +223,7 @@ module Rouge
178
223
  push :comma_list
179
224
  end
180
225
 
181
- rule %r/[\s]/, Text, :pop!
226
+ rule %r/[\s]/, Text, :pop!
182
227
  end
183
228
 
184
229
  state :procedure_call do
@@ -186,7 +231,7 @@ module Rouge
186
231
 
187
232
  rule %r/(:|\s*\()/, Punctuation, :pop!
188
233
 
189
- rule %r/'/, Name::Function
234
+ rule %r/'/, Name::Function
190
235
  rule %r/[^:\('\s]+/, Name::Function
191
236
 
192
237
  rule %r/(?=\s+)/ do
@@ -205,11 +250,17 @@ module Rouge
205
250
  end
206
251
 
207
252
  state :function_call do
208
- rule %r/\b(#{functions_string.join('|')})\$(?=\s*[:(])/, Name::Function, :function
209
- rule %r/\b(#{functions_array.join('|')})#(?=\s*[:(])/, Name::Function, :function
210
- rule %r/\b(#{functions_matrix.join('|')})##(?=\s*[:(])/, Name::Function, :function
211
- rule %r/\b(#{functions_string_vector.join('|')})\$#(?=\s*[:(])/, Name::Function, :function
212
- rule %r/\b(#{functions_numeric.join('|')})(?=\s*[:(])/, Name::Function, :function
253
+ rule %r/\b([a-z][a-zA-Z0-9_.]+)(\$#|##|\$|#)?(?=\s*[:(])/ do |m|
254
+ match = m[0]
255
+ if self.class.functions_builtin.include?(match)
256
+ token Name::Function
257
+ push :function
258
+ elsif self.class.keywords.include?(match)
259
+ token Keyword
260
+ else
261
+ token Operator::Word
262
+ end
263
+ end
213
264
  end
214
265
 
215
266
  state :function do
@@ -230,7 +281,7 @@ module Rouge
230
281
  rule %r/\s*[\]\})\n]/, Text, :pop!
231
282
 
232
283
  rule %r/\s+/, Text
233
- rule %r/"/, Literal::String, :string
284
+ rule %r/"/, Literal::String, :string
234
285
  rule %r/\b(if|then|else|fi|endif)\b/, Keyword
235
286
 
236
287
  mixin :function_call
@@ -263,15 +314,28 @@ module Rouge
263
314
  mixin :operator
264
315
  mixin :number
265
316
 
266
- rule %r/\b(?:#{variables_string.join('|')})\$/, Name::Builtin
267
- rule %r/\b(?:#{variables_numeric.join('|')})(?!\$)\b/, Name::Builtin
317
+ rule %r/\b([A-Z][a-zA-Z0-9]+)_/ do |m|
318
+ match = m[1]
319
+ if (['Object'] | self.class.objects).include?(match)
320
+ token Name::Builtin
321
+ push :object_reference
322
+ else
323
+ token Name::Variable
324
+ end
325
+ end
268
326
 
269
- rule %r/\b(Object|#{objects.join('|')})_/ do
270
- token Name::Builtin
271
- push :object_reference
327
+ rule %r/\.?[a-z][a-zA-Z0-9_.]*(\$#|##|\$|#)?/ do |m|
328
+ match = m[0]
329
+ if self.class.variables_string.include?(match) ||
330
+ self.class.variables_numeric.include?(match)
331
+ token Name::Builtin
332
+ elsif self.class.keywords.include?(match)
333
+ token Keyword
334
+ else
335
+ token Name::Variable
336
+ end
272
337
  end
273
338
 
274
- rule %r/\.?[a-z][a-zA-Z0-9_.]*(\$#|##|\$|#)?/, Text
275
339
  rule %r/[\[\]]/, Text, :comma_list
276
340
  mixin :string_interpolated
277
341
  end
@@ -284,7 +348,13 @@ module Rouge
284
348
  mixin :string_interpolated
285
349
  rule %r/([a-z][a-zA-Z0-9_]*|\d+)/, Name::Builtin
286
350
 
287
- rule %r/\.(#{object_attributes.join('|')})\b/, Name::Builtin, :pop!
351
+ rule %r/\.([a-z]+)\b/ do |m|
352
+ match = m[1]
353
+ if self.class.object_attributes.include?(match)
354
+ token Name::Builtin
355
+ pop!
356
+ end
357
+ end
288
358
 
289
359
  rule %r/\$/, Name::Builtin
290
360
  rule %r/\[/, Text, :pop!
@@ -292,7 +362,7 @@ module Rouge
292
362
 
293
363
  state :operator do
294
364
  # This rule incorrectly matches === or +++++, which are not operators
295
- rule %r/([+\/*<>=!-]=?|[&*|][&*|]?|\^|<>)/, Operator
365
+ rule %r/([+\/*<>=!-]=?|[&*|][&*|]?|\^|<>)/, Operator
296
366
  rule %r/(?<![\w.])(and|or|not|div|mod)(?![\w.])/, Operator::Word
297
367
  end
298
368
 
@@ -302,23 +372,23 @@ module Rouge
302
372
 
303
373
  state :string_unquoted do
304
374
  rule %r/\n\s*\.{3}/, Punctuation
305
- rule %r/\n/, Text, :pop!
306
- rule %r/\s/, Text
375
+ rule %r/\n/, Text, :pop!
376
+ rule %r/\s/, Text
307
377
 
308
378
  mixin :string_interpolated
309
379
 
310
- rule %r/'/, Literal::String
311
- rule %r/[^'\n]+/, Literal::String
380
+ rule %r/'/, Literal::String
381
+ rule %r/[^'\n]+/, Literal::String
312
382
  end
313
383
 
314
384
  state :string do
315
385
  rule %r/\n\s*\.{3}/, Punctuation
316
- rule %r/"/, Literal::String, :pop!
386
+ rule %r/"/, Literal::String, :pop!
317
387
 
318
388
  mixin :string_interpolated
319
389
 
320
- rule %r/'/, Literal::String
321
- rule %r/[^'"\n]+/, Literal::String
390
+ rule %r/'/, Literal::String
391
+ rule %r/[^'"\n]+/, Literal::String
322
392
  end
323
393
 
324
394
  state :old_form do
@@ -363,7 +433,6 @@ module Rouge
363
433
 
364
434
  rule %r/\bendform\b/, Keyword, :pop!
365
435
  end
366
-
367
436
  end
368
437
  end
369
438
  end
@@ -40,7 +40,7 @@ module Rouge
40
40
  end
41
41
 
42
42
  def self.builtins_pseudo
43
- @builtins_pseudo ||= %w(self None Ellipsis NotImplemented False True)
43
+ @builtins_pseudo ||= %w(None Ellipsis NotImplemented False True)
44
44
  end
45
45
 
46
46
  def self.exceptions
@@ -86,6 +86,8 @@ module Rouge
86
86
  rule %r/\\\n/, Text
87
87
  rule %r/\\/, Text
88
88
 
89
+ rule %r/@#{dotted_identifier}/i, Name::Decorator
90
+
89
91
  rule %r/(in|is|and|or|not)\b/, Operator::Word
90
92
  rule %r/(<<|>>|\/\/|\*\*)=?/, Operator
91
93
  rule %r/[-~+\/*%=<>&^|@]=?|!=/, Operator
@@ -93,13 +95,13 @@ module Rouge
93
95
  rule %r/(from)((?:\\\s|\s)+)(#{dotted_identifier})((?:\\\s|\s)+)(import)/ do
94
96
  groups Keyword::Namespace,
95
97
  Text,
96
- Name::Namespace,
98
+ Name,
97
99
  Text,
98
100
  Keyword::Namespace
99
101
  end
100
102
 
101
103
  rule %r/(import)(\s+)(#{dotted_identifier})/ do
102
- groups Keyword::Namespace, Text, Name::Namespace
104
+ groups Keyword::Namespace, Text, Name
103
105
  end
104
106
 
105
107
  rule %r/(def)((?:\s|\\\s)+)/ do
@@ -112,6 +114,9 @@ module Rouge
112
114
  push :classname
113
115
  end
114
116
 
117
+ rule %r/([a-z_]\w*)[ \t]*(?=(\(.*\)))/m, Name::Function
118
+ rule %r/([A-Z_]\w*)[ \t]*(?=(\(.*\)))/m, Name::Class
119
+
115
120
  # TODO: not in python 3
116
121
  rule %r/`.*?`/, Str::Backtick
117
122
  rule %r/([rfbu]{0,2})('''|"""|['"])/i do |m|
@@ -120,8 +125,6 @@ module Rouge
120
125
  push :generic_string
121
126
  end
122
127
 
123
- rule %r/@#{dotted_identifier}/i, Name::Decorator
124
-
125
128
  # using negative lookbehind so we don't match property names
126
129
  rule %r/(?<!\.)#{identifier}/ do |m|
127
130
  if self.class.keywords.include? m[0]
@@ -27,7 +27,7 @@ module Rouge
27
27
  rule %r/(.*?)(\\\n)/ do
28
28
  groups Text, Str::Escape
29
29
  end
30
- rule %r/(.*)'/, Text, :pop!
30
+ rule %r/(.*)'?/, Text, :pop!
31
31
  end
32
32
  end
33
33
  end
@@ -5,7 +5,7 @@ module Rouge
5
5
  module Lexers
6
6
  class Vala < RegexLexer
7
7
  tag 'vala'
8
- filenames '*.vala'
8
+ filenames '*.vala', '*.vapi'
9
9
  mimetypes 'text/x-vala'
10
10
 
11
11
  title "Vala"
@@ -18,8 +18,6 @@ module Rouge
18
18
  return true if text =~ /\A\s*%YAML/m
19
19
  end
20
20
 
21
- SPECIAL_VALUES = Regexp.union(%w(true false null))
22
-
23
21
  # NB: Tabs are forbidden in YAML, which is why you see things
24
22
  # like /[ ]+/.
25
23
 
@@ -175,7 +173,7 @@ module Rouge
175
173
 
176
174
  state :block_nodes do
177
175
  # implicit key
178
- rule %r/([^#,:?\[\]{}"'\n]+)(:)(?=\s|$)/ do |m|
176
+ rule %r/([^#,?\[\]{}"'\n]+)(:)(?=\s|$)/ do |m|
179
177
  groups Name::Attribute, Punctuation::Indicator
180
178
  set_indent m[0], :implicit => true
181
179
  end
@@ -340,7 +338,7 @@ module Rouge
340
338
  end
341
339
 
342
340
  rule %r/[ ]+/, Str
343
- rule SPECIAL_VALUES, Name::Constant
341
+ rule %r((true|false|null)\b), Keyword::Constant
344
342
  rule %r/\d+(?:\.\d+)?(?=(\r?\n)| +#)/, Literal::Number, :pop!
345
343
 
346
344
  # regular non-whitespace characters