rouge 4.0.0 → 4.1.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/cisco_ios +19 -0
- data/lib/rouge/demos/coq +4 -1
- data/lib/rouge/formatters/html.rb +12 -11
- data/lib/rouge/guessers/disambiguation.rb +2 -1
- data/lib/rouge/lexers/cisco_ios.rb +83 -0
- data/lib/rouge/lexers/coq.rb +132 -68
- data/lib/rouge/lexers/cpp.rb +5 -1
- data/lib/rouge/lexers/csharp.rb +13 -12
- data/lib/rouge/lexers/ghc_cmm.rb +1 -1
- data/lib/rouge/lexers/gherkin/keywords.rb +4 -4
- data/lib/rouge/lexers/http.rb +1 -1
- data/lib/rouge/lexers/java.rb +1 -0
- data/lib/rouge/lexers/javascript.rb +24 -1
- data/lib/rouge/lexers/llvm/keywords.rb +2 -2
- data/lib/rouge/lexers/php.rb +3 -1
- data/lib/rouge/lexers/powershell.rb +6 -0
- data/lib/rouge/lexers/praat.rb +193 -124
- data/lib/rouge/lexers/python.rb +8 -5
- data/lib/rouge/lexers/systemd.rb +1 -1
- data/lib/rouge/lexers/vala.rb +1 -1
- data/lib/rouge/lexers/yaml.rb +2 -4
- data/lib/rouge/themes/github.rb +137 -62
- data/lib/rouge/version.rb +1 -1
- data/lib/rouge.rb +3 -5
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 555fb3207f31723860f17a269418bbaea9dff23c0ae97dc5f27fabd797fc4ad5
|
4
|
+
data.tar.gz: ad0c9a8de4f66de72f487f8310abda1e763c92816ef2de031a7aea89bcd155c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcdb09306c5640839523e4ade20a7a272d835f0cd7eec7d2a3b43ae4598d5f0ef50ce2c64e24de31d98e10501f5a8ea53b0e064b51a0e3166756a0669e76b3e9
|
7
|
+
data.tar.gz: 8c2deba5fc1d897f655642ed01f1817743d249fe1a8dabcc9de873b5203378b63315c5f5fd18c25a479d97aed5e726c9efffb43b1f0c83fbcc6aaf75ce1cf23d
|
data/Gemfile
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
interface FastEthernet0.20
|
2
|
+
encapsulation dot1Q 20
|
3
|
+
no ip route-cache
|
4
|
+
bridge-group 1
|
5
|
+
no bridge-group 1 source-learning
|
6
|
+
bridge-group 1 spanning-disabled
|
7
|
+
|
8
|
+
! Supports shortened versions of config words, too
|
9
|
+
inter gi0.10
|
10
|
+
encap dot1q 10 native
|
11
|
+
inter gi0
|
12
|
+
|
13
|
+
banner login # Authenticate yourself! #
|
14
|
+
|
15
|
+
! Supports #, $ and % to delimit banners, and multiline
|
16
|
+
banner motd $
|
17
|
+
Attention!
|
18
|
+
We will be having scheduled system maintenance on this device.
|
19
|
+
$
|
data/lib/rouge/demos/coq
CHANGED
@@ -5,6 +5,14 @@ module Rouge
|
|
5
5
|
module Formatters
|
6
6
|
# Transforms a token stream into HTML output.
|
7
7
|
class HTML < Formatter
|
8
|
+
TABLE_FOR_ESCAPE_HTML = {
|
9
|
+
'&' => '&',
|
10
|
+
'<' => '<',
|
11
|
+
'>' => '>',
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
ESCAPE_REGEX = /[&<>]/.freeze
|
15
|
+
|
8
16
|
tag 'html'
|
9
17
|
|
10
18
|
# @yield the html output.
|
@@ -22,20 +30,14 @@ module Rouge
|
|
22
30
|
if tok == Token::Tokens::Text
|
23
31
|
safe_val
|
24
32
|
else
|
25
|
-
shortname = tok.shortname
|
26
|
-
or raise "unknown token: #{tok.inspect} for #{safe_val.inspect}"
|
33
|
+
shortname = tok.shortname or raise "unknown token: #{tok.inspect} for #{safe_val.inspect}"
|
27
34
|
|
28
35
|
"<span class=\"#{shortname}\">#{safe_val}</span>"
|
29
36
|
end
|
30
37
|
end
|
31
38
|
|
32
|
-
|
33
|
-
'&' => '&',
|
34
|
-
'<' => '<',
|
35
|
-
'>' => '>',
|
36
|
-
}
|
39
|
+
private
|
37
40
|
|
38
|
-
private
|
39
41
|
# A performance-oriented helper method to escape `&`, `<` and `>` for the rendered
|
40
42
|
# HTML from this formatter.
|
41
43
|
#
|
@@ -46,10 +48,9 @@ module Rouge
|
|
46
48
|
# Returns either the given `value` argument string as is or a new string with the
|
47
49
|
# special characters replaced with their escaped counterparts.
|
48
50
|
def escape_special_html_chars(value)
|
49
|
-
|
50
|
-
return value unless value =~ escape_regex
|
51
|
+
return value unless value =~ ESCAPE_REGEX
|
51
52
|
|
52
|
-
value.gsub(
|
53
|
+
value.gsub(ESCAPE_REGEX, TABLE_FOR_ESCAPE_HTML)
|
53
54
|
end
|
54
55
|
end
|
55
56
|
end
|
@@ -133,7 +133,8 @@ module Rouge
|
|
133
133
|
end
|
134
134
|
|
135
135
|
disambiguate '*.pp' do
|
136
|
-
next
|
136
|
+
next Puppet if matches?(/(::)?([a-z]\w*::)/)
|
137
|
+
next Pascal if matches?(/^(function|begin|var)\b/)
|
137
138
|
next Pascal if matches?(/\b(end(;|\.))/)
|
138
139
|
|
139
140
|
Puppet
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Based on/regexes mostly from Brandon Bennett's pygments-routerlexers:
|
5
|
+
# https://github.com/nemith/pygments-routerlexers
|
6
|
+
|
7
|
+
module Rouge
|
8
|
+
module Lexers
|
9
|
+
class CiscoIos < RegexLexer
|
10
|
+
title 'Cisco IOS'
|
11
|
+
desc 'Cisco IOS configuration lexer'
|
12
|
+
tag 'cisco_ios'
|
13
|
+
filenames '*.cfg'
|
14
|
+
mimetypes 'text/x-cisco-conf'
|
15
|
+
|
16
|
+
state :root do
|
17
|
+
rule %r/^!.*/, Comment::Single
|
18
|
+
|
19
|
+
rule %r/^(version\s+)(.*)$/ do
|
20
|
+
groups Keyword, Num::Float
|
21
|
+
end
|
22
|
+
|
23
|
+
rule %r/(desc*r*i*p*t*i*o*n*)(.*?)$/ do
|
24
|
+
groups Keyword, Comment::Single
|
25
|
+
end
|
26
|
+
|
27
|
+
rule %r/^(inte*r*f*a*c*e*|controller|router \S+|voice translation-\S+|voice-port|line)(.*)$/ do
|
28
|
+
groups Keyword::Type, Name::Function
|
29
|
+
end
|
30
|
+
|
31
|
+
rule %r/(password|secret)(\s+[57]\s+)(\S+)/ do
|
32
|
+
groups Keyword, Num, String::Double
|
33
|
+
end
|
34
|
+
|
35
|
+
rule %r/(permit|deny)/, Operator::Word
|
36
|
+
|
37
|
+
rule %r/^(banner\s+)(motd\s+|login\s+)([#$%])/ do
|
38
|
+
groups Keyword, Name::Function, Str::Delimiter
|
39
|
+
push :cisco_ios_text
|
40
|
+
end
|
41
|
+
|
42
|
+
rule %r/^(dial-peer\s+\S+\s+)(\S+)(.*?)$/ do
|
43
|
+
groups Keyword, Name::Attribute, Keyword
|
44
|
+
end
|
45
|
+
|
46
|
+
rule %r/^(vlan\s+)(\d+)$/ do
|
47
|
+
groups Keyword, Name::Attribute
|
48
|
+
end
|
49
|
+
|
50
|
+
# IPv4 Address/Prefix
|
51
|
+
rule %r/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(\/\d{1,2})?/, Num
|
52
|
+
|
53
|
+
# NSAP
|
54
|
+
rule %r/49\.\d{4}\.\d{4}\.\d{4}\.\d{4}\.\d{2}/, Num
|
55
|
+
|
56
|
+
# MAC Address
|
57
|
+
rule %r/[a-f0-9]{4}\.[a-f0-9]{4}\.[a-f0-9]{4}/, Num::Hex
|
58
|
+
|
59
|
+
rule %r/^(\s*no\s+)(\S+)/ do
|
60
|
+
groups Keyword::Constant, Keyword
|
61
|
+
end
|
62
|
+
|
63
|
+
rule %r/^[^\n\r]\s*\S+/, Keyword
|
64
|
+
|
65
|
+
# Obfuscated Passwords
|
66
|
+
rule %r/\*+/, Name::Entity
|
67
|
+
|
68
|
+
rule %r/(?<= )\d+(?= )/, Num
|
69
|
+
|
70
|
+
# Newline catcher, avoid errors on empty lines
|
71
|
+
rule %r/\n+/m, Text
|
72
|
+
|
73
|
+
# This one goes last, a text catch-all
|
74
|
+
rule %r/./, Text
|
75
|
+
end
|
76
|
+
|
77
|
+
state :cisco_ios_text do
|
78
|
+
rule %r/[^#$%]/, Text
|
79
|
+
rule %r/[#$%]/, Str::Delimiter, :pop!
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/lib/rouge/lexers/coq.rb
CHANGED
@@ -25,7 +25,7 @@ module Rouge
|
|
25
25
|
Variables Class Instance Global Local Include
|
26
26
|
Printing Notation Infix Arguments Hint Rewrite Immediate
|
27
27
|
Qed Defined Opaque Transparent Existing
|
28
|
-
Compute Eval Print SearchAbout Search About Check
|
28
|
+
Compute Eval Print SearchAbout Search About Check Admitted
|
29
29
|
)
|
30
30
|
end
|
31
31
|
|
@@ -56,16 +56,6 @@ module Rouge
|
|
56
56
|
)
|
57
57
|
end
|
58
58
|
|
59
|
-
def self.keyopts
|
60
|
-
@keyopts ||= Set.new %w(
|
61
|
-
:= => -> /\\ \\/ _ ; :> : ⇒ → ↔ ⇔ ≔ ≡ ∀ ∃ ∧ ∨ ¬ ⊤ ⊥ ⊢ ⊨ ∈
|
62
|
-
)
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.end_sentence
|
66
|
-
@end_sentence ||= Punctuation::Indicator
|
67
|
-
end
|
68
|
-
|
69
59
|
def self.classify(x)
|
70
60
|
if self.coq.include? x
|
71
61
|
return Keyword
|
@@ -82,58 +72,133 @@ module Rouge
|
|
82
72
|
end
|
83
73
|
end
|
84
74
|
|
85
|
-
|
86
|
-
|
87
|
-
|
75
|
+
# https://github.com/coq/coq/blob/110921a449fcb830ec2a1cd07e3acc32319feae6/clib/unicode.ml#L67
|
76
|
+
# https://coq.inria.fr/refman/language/core/basic.html#grammar-token-ident
|
77
|
+
id_first = /\p{L}/
|
78
|
+
id_first_underscore = /(?:\p{L}|_)/
|
79
|
+
id_subsequent = /(?:\p{L}|\p{N}|_|')/ # a few missing? some mathematical ' primes and subscripts
|
80
|
+
id = /(?:#{id_first}#{id_subsequent}*)|(?:#{id_first_underscore}#{id_subsequent}+)/i
|
81
|
+
dot_id = /\.(#{id})/i
|
88
82
|
dot_space = /\.(\s+)/
|
89
|
-
module_type = /Module(\s+)Type(\s+)/
|
90
|
-
set_options = /(Set|Unset)(\s+)(Universe|Printing|Implicit|Strict)(\s+)(Polymorphism|All|Notations|Arguments|Universes|Implicit)(\s*)\./m
|
91
83
|
|
92
84
|
state :root do
|
93
|
-
|
85
|
+
mixin :begin_proof
|
86
|
+
mixin :sentence
|
87
|
+
end
|
88
|
+
|
89
|
+
state :sentence do
|
90
|
+
mixin :comment_whitespace
|
91
|
+
mixin :module_setopts
|
92
|
+
# After parsing the id, end up in sentence_postid
|
93
|
+
rule id do |m|
|
94
|
+
@name = m[0]
|
95
|
+
@id_dotted = false
|
96
|
+
push :sentence_postid
|
97
|
+
push :continue_id
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
state :begin_proof do
|
102
|
+
rule %r/(Proof)(\s*)(\.)(\s+)/i do
|
103
|
+
groups Keyword, Text::Whitespace, Punctuation::Indicator, Text::Whitespace
|
104
|
+
push :proof_mode
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
state :proof_mode do
|
109
|
+
mixin :comment_whitespace
|
110
|
+
mixin :module_setopts
|
111
|
+
mixin :begin_proof
|
112
|
+
|
113
|
+
rule %r/(Qed|Defined|Save|Admitted)(\s*)(\.)(\s+)/i do
|
114
|
+
groups Keyword, Text::Whitespace, Punctuation::Indicator, Text::Whitespace
|
115
|
+
pop!
|
116
|
+
end
|
117
|
+
# the whole point of parsing Proof/Qed, normally some of these will be operators
|
118
|
+
rule %r/(?:\-+|\++|\*+)/, Punctuation
|
119
|
+
rule %r/[{}]/, Punctuation
|
120
|
+
# toplevel_selector
|
121
|
+
rule %r/(!|all|par)(:)/ do
|
122
|
+
groups Keyword::Pseudo, Punctuation
|
123
|
+
end
|
124
|
+
# numbered goals 1: {} 1,2: {}
|
125
|
+
rule %r/\d+/, Num::Integer, :numeric_labels
|
126
|
+
# [named_goal]: { ... }
|
127
|
+
rule %r/(\[)(\s*)(#{id})(\s*)(\])(\s*)(:)/ do
|
128
|
+
groups Punctuation, Text::Whitespace, Name::Constant, Text::Whitespace, Punctuation, Text::Whitespace, Punctuation
|
129
|
+
end
|
130
|
+
# After parsing the id, end up in sentence_postid
|
131
|
+
rule id do |m|
|
132
|
+
@name = m[0]
|
133
|
+
@id_dotted = false
|
134
|
+
push :sentence_postid
|
135
|
+
push :continue_id
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
state :numeric_labels do
|
140
|
+
mixin :whitespace
|
141
|
+
rule %r/(,)(\s*)(\d+)/ do
|
142
|
+
groups Punctuation, Text::Whitespace, Num::Integer
|
143
|
+
end
|
144
|
+
|
145
|
+
rule %r(:), Punctuation, :pop!
|
146
|
+
end
|
147
|
+
|
148
|
+
state :whitespace do
|
94
149
|
rule %r/\s+/m, Text::Whitespace
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
150
|
+
end
|
151
|
+
|
152
|
+
state :comment_whitespace do
|
153
|
+
rule %r/[(][*](?![)])/, Comment, :comment
|
154
|
+
mixin :whitespace
|
155
|
+
end
|
156
|
+
|
157
|
+
state :module_setopts do
|
158
|
+
rule %r/(Module)(\s+)(Type)(\s+)/ do
|
159
|
+
groups Keyword, Text::Whitespace, Keyword, Text::Whitespace
|
100
160
|
end
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
end
|
109
|
-
token self.class.end_sentence , '.'
|
161
|
+
|
162
|
+
rule %r(
|
163
|
+
(Set|Unset)(\s+)
|
164
|
+
(Universe|Printing|Implicit|Strict)(\s+)
|
165
|
+
(Polymorphism|All|Notations|Arguments|Universes|Implicit)?(\s*)(\.)
|
166
|
+
)x do
|
167
|
+
groups Keyword, Text::Whitespace, Keyword, Text::Whitespace, Keyword, Text::Whitespace, Punctuation::Indicator
|
110
168
|
end
|
169
|
+
end
|
170
|
+
|
171
|
+
state :sentence_postid do
|
172
|
+
mixin :comment_whitespace
|
173
|
+
mixin :module_setopts
|
174
|
+
|
175
|
+
# up here to beat the id rule for lambda
|
176
|
+
rule %r(:=|=>|;|:>|:|::|_), Punctuation
|
177
|
+
rule %r(->|/\\|\\/|;|:>|[⇒→↔⇔≔≡∀∃∧∨¬⊤⊥⊢⊨∈λ]), Operator
|
178
|
+
|
111
179
|
rule id do |m|
|
112
180
|
@name = m[0]
|
113
|
-
@
|
181
|
+
@id_dotted = false
|
114
182
|
push :continue_id
|
115
183
|
end
|
116
|
-
|
117
|
-
|
184
|
+
|
185
|
+
# must be followed by whitespace, so that we don't match notations like sym.(a + b)
|
186
|
+
rule %r/\.(?=\s)/, Punctuation::Indicator, :pop! # :sentence_postid
|
118
187
|
|
119
188
|
rule %r/-?\d[\d_]*(.[\d_]*)?(e[+-]?\d[\d_]*)/i, Num::Float
|
120
|
-
rule %r
|
189
|
+
rule %r/-?\d[\d_]*/, Num::Integer
|
121
190
|
|
122
191
|
rule %r/'(?:(\\[\\"'ntbr ])|(\\[0-9]{3})|(\\x\h{2}))'/, Str::Char
|
123
192
|
rule %r/'/, Keyword
|
124
193
|
rule %r/"/, Str::Double, :string
|
125
194
|
rule %r/[~?]#{id}/, Name::Variable
|
126
195
|
|
127
|
-
rule %r
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
else
|
134
|
-
token Error
|
135
|
-
end
|
136
|
-
end
|
196
|
+
rule %r(`{|[{}\[\]()?|;,.]), Punctuation
|
197
|
+
rule %r([!@^|~#.%/]+), Operator
|
198
|
+
# any other combo of S (symbol), P (punctuation) and some extras just to be sure
|
199
|
+
rule %r((?:\p{S}|\p{Pc}|[./\:\<=>\-+*])+), Operator
|
200
|
+
|
201
|
+
rule %r/./, Error
|
137
202
|
end
|
138
203
|
|
139
204
|
state :comment do
|
@@ -144,48 +209,47 @@ module Rouge
|
|
144
209
|
end
|
145
210
|
|
146
211
|
state :string do
|
147
|
-
rule %r/
|
148
|
-
|
149
|
-
rule %r/\\\n/, Str::Double
|
212
|
+
rule %r/[^"]+/, Str::Double
|
213
|
+
rule %r/""/, Str::Double
|
150
214
|
rule %r/"/, Str::Double, :pop!
|
151
215
|
end
|
152
216
|
|
153
|
-
state :escape_sequence do
|
154
|
-
rule %r/\\[\\"'ntbr]/, Str::Escape
|
155
|
-
end
|
156
|
-
|
157
217
|
state :continue_id do
|
158
218
|
# the stream starts with an id (stored in @name) and continues here
|
159
219
|
rule dot_id do |m|
|
160
|
-
token Name::Namespace
|
161
|
-
token Punctuation
|
162
|
-
@
|
220
|
+
token Name::Namespace, @name
|
221
|
+
token Punctuation, '.'
|
222
|
+
@id_dotted = true
|
163
223
|
@name = m[1]
|
164
224
|
end
|
225
|
+
|
165
226
|
rule dot_space do |m|
|
166
|
-
if @
|
167
|
-
token Name::Constant
|
227
|
+
if @id_dotted
|
228
|
+
token Name::Constant, @name
|
168
229
|
else
|
169
|
-
token self.class.classify(@name)
|
230
|
+
token self.class.classify(@name), @name
|
170
231
|
end
|
171
|
-
|
172
|
-
token
|
232
|
+
|
233
|
+
token Punctuation::Indicator, '.'
|
234
|
+
token Text::Whitespace, m[1]
|
173
235
|
@name = false
|
174
|
-
@
|
175
|
-
pop!
|
236
|
+
@id_dotted = false
|
237
|
+
pop! # :continue_id
|
238
|
+
pop! # :sentence_postid
|
176
239
|
end
|
240
|
+
|
177
241
|
rule %r// do
|
178
|
-
if @
|
179
|
-
token Name::Constant
|
242
|
+
if @id_dotted
|
243
|
+
token Name::Constant, @name
|
180
244
|
else
|
181
|
-
token self.class.classify(@name)
|
245
|
+
token self.class.classify(@name), @name
|
182
246
|
end
|
183
247
|
@name = false
|
184
|
-
@
|
185
|
-
|
248
|
+
@id_dotted = false
|
249
|
+
# we finished parsing an id, drop back into the sentence_postid that was pushed first.
|
250
|
+
pop! # :continue_id
|
186
251
|
end
|
187
252
|
end
|
188
|
-
|
189
253
|
end
|
190
254
|
end
|
191
255
|
end
|
data/lib/rouge/lexers/cpp.rb
CHANGED
@@ -71,7 +71,11 @@ module Rouge
|
|
71
71
|
rule %r/\bnullptr\b/, Name::Builtin
|
72
72
|
rule %r/(?:u8|u|U|L)?R"([a-zA-Z0-9_{}\[\]#<>%:;.?*\+\-\/\^&|~!=,"']{,16})\(.*?\)\1"/m, Str
|
73
73
|
rule %r/(::|<=>)/, Operator
|
74
|
-
rule %r/[{
|
74
|
+
rule %r/[{]/, Punctuation
|
75
|
+
rule %r/}/ do
|
76
|
+
token Punctuation
|
77
|
+
pop! if in_state?(:function) # pop :function
|
78
|
+
end
|
75
79
|
end
|
76
80
|
|
77
81
|
state :classname do
|
data/lib/rouge/lexers/csharp.rb
CHANGED
@@ -27,19 +27,19 @@ module Rouge
|
|
27
27
|
static switch this throw true try typeof unchecked unsafe
|
28
28
|
virtual void volatile while
|
29
29
|
add alias async await get global partial remove set value where
|
30
|
-
yield nameof
|
31
|
-
ascending by descending equals from group in into join let
|
32
|
-
orderby select
|
30
|
+
yield nameof notnull
|
31
|
+
ascending by descending equals from group in init into join let
|
32
|
+
on orderby select unmanaged when and not or with
|
33
33
|
)
|
34
34
|
|
35
35
|
keywords_type = %w(
|
36
|
-
bool byte char decimal double dynamic float int long
|
37
|
-
sbyte short string uint ulong ushort var
|
36
|
+
bool byte char decimal double dynamic float int long nint nuint
|
37
|
+
object sbyte short string uint ulong ushort var
|
38
38
|
)
|
39
39
|
|
40
40
|
cpp_keywords = %w(
|
41
41
|
if endif else elif define undef line error warning region
|
42
|
-
endregion pragma
|
42
|
+
endregion pragma nullable
|
43
43
|
)
|
44
44
|
|
45
45
|
state :whitespace do
|
@@ -81,14 +81,15 @@ module Rouge
|
|
81
81
|
rule %r/@"(""|[^"])*"/m, Str
|
82
82
|
rule %r/"(\\.|.)*?["\n]/, Str
|
83
83
|
rule %r/'(\\.|.)'/, Str::Char
|
84
|
-
rule %r/
|
84
|
+
rule %r/0b[_01]+[lu]?/i, Num
|
85
|
+
rule %r/0x[_0-9a-f]+[lu]?/i, Num
|
85
86
|
rule %r(
|
86
|
-
[0-9]
|
87
|
-
([.][0-9]*)? # decimal
|
88
|
-
(e[+-][0-9]
|
89
|
-
[
|
87
|
+
[0-9](?:[_0-9]*[0-9])?
|
88
|
+
([.][0-9](?:[_0-9]*[0-9])?)? # decimal
|
89
|
+
(e[+-]?[0-9](?:[_0-9]*[0-9])?)? # exponent
|
90
|
+
[fldum]? # type
|
90
91
|
)ix, Num
|
91
|
-
rule %r/\b(?:class|struct|interface)\b/, Keyword, :class
|
92
|
+
rule %r/\b(?:class|record|struct|interface)\b/, Keyword, :class
|
92
93
|
rule %r/\b(?:namespace|using)\b/, Keyword, :namespace
|
93
94
|
rule %r/^#[ \t]*(#{cpp_keywords.join('|')})\b.*?\n/,
|
94
95
|
Comment::Preproc
|
data/lib/rouge/lexers/ghc_cmm.rb
CHANGED
@@ -22,7 +22,7 @@ module Rouge
|
|
22
22
|
ws = %r(\s|//.*?\n|/[*](?:[^*]|(?:[*][^/]))*[*]+/)mx
|
23
23
|
|
24
24
|
# Make sure that this is not a preprocessor macro, e.g. `#if` or `#define`.
|
25
|
-
id = %r((
|
25
|
+
id = %r((?!\#[a-zA-Z])[\w#\$%_']+)
|
26
26
|
|
27
27
|
complex_id = %r(
|
28
28
|
(?:[\w#$%_']|\(\)|\(,\)|\[\]|[0-9])*
|