rouge 3.19.0 → 3.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rouge.rb +1 -0
- data/lib/rouge/cli.rb +32 -2
- data/lib/rouge/demos/augeas +16 -0
- data/lib/rouge/demos/bibtex +12 -0
- data/lib/rouge/demos/brightscript +6 -0
- data/lib/rouge/demos/email +11 -0
- data/lib/rouge/demos/hlsl +20 -0
- data/lib/rouge/demos/j +12 -0
- data/lib/rouge/demos/janet +3 -0
- data/lib/rouge/demos/livescript +15 -0
- data/lib/rouge/demos/ocl +4 -0
- data/lib/rouge/demos/postscript +9 -0
- data/lib/rouge/demos/rescript +26 -0
- data/lib/rouge/demos/ssh +4 -0
- data/lib/rouge/demos/systemd +4 -0
- data/lib/rouge/demos/velocity +9 -0
- data/lib/rouge/demos/zig +6 -0
- data/lib/rouge/formatters/html_line_highlighter.rb +24 -0
- data/lib/rouge/formatters/html_line_table.rb +1 -3
- data/lib/rouge/formatters/html_linewise.rb +2 -3
- data/lib/rouge/lexer.rb +38 -20
- data/lib/rouge/lexers/apex.rb +9 -7
- data/lib/rouge/lexers/augeas.rb +93 -0
- data/lib/rouge/lexers/batchfile.rb +3 -2
- data/lib/rouge/lexers/bibtex.rb +115 -0
- data/lib/rouge/lexers/brightscript.rb +147 -0
- data/lib/rouge/lexers/cmake.rb +10 -0
- data/lib/rouge/lexers/cpp.rb +12 -5
- data/lib/rouge/lexers/crystal.rb +14 -9
- data/lib/rouge/lexers/css.rb +3 -1
- data/lib/rouge/lexers/diff.rb +1 -1
- data/lib/rouge/lexers/docker.rb +2 -2
- data/lib/rouge/lexers/elm.rb +5 -5
- data/lib/rouge/lexers/email.rb +39 -0
- data/lib/rouge/lexers/ghc_core.rb +2 -1
- data/lib/rouge/lexers/graphql.rb +1 -1
- data/lib/rouge/lexers/hack.rb +1 -1
- data/lib/rouge/lexers/haskell.rb +27 -19
- data/lib/rouge/lexers/hlsl.rb +166 -0
- data/lib/rouge/lexers/html.rb +7 -7
- data/lib/rouge/lexers/http.rb +8 -2
- data/lib/rouge/lexers/isbl.rb +2 -2
- data/lib/rouge/lexers/j.rb +244 -0
- data/lib/rouge/lexers/janet.rb +218 -0
- data/lib/rouge/lexers/javascript.rb +11 -5
- data/lib/rouge/lexers/jinja.rb +22 -7
- data/lib/rouge/lexers/jsl.rb +20 -8
- data/lib/rouge/lexers/jsonnet.rb +4 -3
- data/lib/rouge/lexers/jsp.rb +2 -3
- data/lib/rouge/lexers/jsx.rb +47 -59
- data/lib/rouge/lexers/julia.rb +4 -2
- data/lib/rouge/lexers/kotlin.rb +8 -4
- data/lib/rouge/lexers/livescript.rb +310 -0
- data/lib/rouge/lexers/ocaml/common.rb +1 -1
- data/lib/rouge/lexers/ocl.rb +85 -0
- data/lib/rouge/lexers/opentype_feature_file.rb +26 -42
- data/lib/rouge/lexers/perl.rb +27 -7
- data/lib/rouge/lexers/php.rb +274 -128
- data/lib/rouge/lexers/postscript.rb +93 -0
- data/lib/rouge/lexers/powershell.rb +44 -32
- data/lib/rouge/lexers/python.rb +1 -1
- data/lib/rouge/lexers/q.rb +1 -1
- data/lib/rouge/lexers/reasonml.rb +6 -5
- data/lib/rouge/lexers/rego.rb +27 -12
- data/lib/rouge/lexers/rescript.rb +119 -0
- data/lib/rouge/lexers/ruby.rb +1 -1
- data/lib/rouge/lexers/rust.rb +6 -3
- data/lib/rouge/lexers/sass/common.rb +1 -0
- data/lib/rouge/lexers/smarty.rb +1 -1
- data/lib/rouge/lexers/ssh.rb +33 -0
- data/lib/rouge/lexers/systemd.rb +34 -0
- data/lib/rouge/lexers/tsx.rb +10 -3
- data/lib/rouge/lexers/twig.rb +4 -4
- data/lib/rouge/lexers/typescript.rb +1 -12
- data/lib/rouge/lexers/typescript/common.rb +18 -4
- data/lib/rouge/lexers/velocity.rb +71 -0
- data/lib/rouge/lexers/wollok.rb +0 -1
- data/lib/rouge/lexers/xml.rb +5 -3
- data/lib/rouge/lexers/yaml.rb +5 -3
- data/lib/rouge/lexers/zig.rb +139 -0
- data/lib/rouge/regex_lexer.rb +56 -1
- data/lib/rouge/themes/base16.rb +1 -0
- data/lib/rouge/themes/bw.rb +1 -0
- data/lib/rouge/themes/colorful.rb +1 -0
- data/lib/rouge/themes/github.rb +1 -0
- data/lib/rouge/themes/gruvbox.rb +2 -0
- data/lib/rouge/themes/igor_pro.rb +1 -0
- data/lib/rouge/themes/magritte.rb +1 -0
- data/lib/rouge/themes/monokai.rb +1 -0
- data/lib/rouge/themes/pastie.rb +1 -0
- data/lib/rouge/themes/thankful_eyes.rb +1 -0
- data/lib/rouge/themes/tulip.rb +1 -0
- data/lib/rouge/version.rb +1 -1
- metadata +33 -2
data/lib/rouge/lexers/crystal.rb
CHANGED
@@ -25,8 +25,7 @@ module Rouge
|
|
25
25
|
)xi, Str::Symbol
|
26
26
|
|
27
27
|
# special symbols
|
28
|
-
rule %r(:(
|
29
|
-
Str::Symbol
|
28
|
+
rule %r(:(?:===|=?~|\[\][=?]?|\*\*=?|\/\/=?|[=^*/+-]=?|&[&*+-]?=?|\|\|?=?|![=~]?|%=?|<=>|<<?=?|>>?=?|\.\.\.?)), Str::Symbol
|
30
29
|
|
31
30
|
rule %r/:'(\\\\|\\'|[^'])*'/, Str::Symbol
|
32
31
|
rule %r/:"/, Str::Symbol, :simple_sym
|
@@ -36,7 +35,7 @@ module Rouge
|
|
36
35
|
# %-sigiled strings
|
37
36
|
# %(abc), %[abc], %<abc>, %.abc., %r.abc., etc
|
38
37
|
delimiter_map = { '{' => '}', '[' => ']', '(' => ')', '<' => '>' }
|
39
|
-
rule %r/%([rqswQWxiI])?([^\w\s])/ do |m|
|
38
|
+
rule %r/%([rqswQWxiI])?([^\w\s}])/ do |m|
|
40
39
|
open = Regexp.escape(m[2])
|
41
40
|
close = Regexp.escape(delimiter_map[m[2]] || m[2])
|
42
41
|
interp = /[rQWxI]/ === m[1]
|
@@ -79,9 +78,11 @@ module Rouge
|
|
79
78
|
state :strings do
|
80
79
|
mixin :symbols
|
81
80
|
rule %r/\b[a-z_]\w*?[?!]?:\s+/, Str::Symbol, :expr_start
|
82
|
-
rule %r/'(\\\\|\\'|[^'])*'/, Str::Single
|
83
81
|
rule %r/"/, Str::Double, :simple_string
|
84
82
|
rule %r/(?<!\.)`/, Str::Backtick, :simple_backtick
|
83
|
+
rule %r/(')(\\u[a-fA-F0-9]{4}|\\u\{[a-fA-F0-9]{1,6}\}|\\[abefnrtv])?(\\\\|\\'|[^'])*(')/ do
|
84
|
+
groups Str::Single, Str::Escape, Str::Single, Str::Single
|
85
|
+
end
|
85
86
|
end
|
86
87
|
|
87
88
|
state :regex_flags do
|
@@ -154,11 +155,13 @@ module Rouge
|
|
154
155
|
mixin :whitespace
|
155
156
|
rule %r/__END__/, Comment::Preproc, :end_part
|
156
157
|
|
157
|
-
rule %r/
|
158
|
+
rule %r/0o[0-7]+(?:_[0-7]+)*/, Num::Oct
|
158
159
|
rule %r/0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*/, Num::Hex
|
159
160
|
rule %r/0b[01]+(?:_[01]+)*/, Num::Bin
|
160
|
-
rule %r/\d+\.\d+(e[\+\-]?\d+)
|
161
|
-
rule %r
|
161
|
+
rule %r/\d+\.\d+(e[\+\-]?\d+)?(_f32)?/i, Num::Float
|
162
|
+
rule %r/\d+(e[\+\-]?\d+)/i, Num::Float
|
163
|
+
rule %r/\d+_f32/i, Num::Float
|
164
|
+
rule %r/[\d]+(?:_\d+)*(_[iu]\d+)?/, Num::Integer
|
162
165
|
|
163
166
|
rule %r/@\[([^\]]+)\]/, Name::Decorator
|
164
167
|
|
@@ -183,7 +186,7 @@ module Rouge
|
|
183
186
|
groups Keyword, Text, Name::Namespace
|
184
187
|
end
|
185
188
|
|
186
|
-
rule %r/(def\b)(\s*)/ do
|
189
|
+
rule %r/(def|macro\b)(\s*)/ do
|
187
190
|
groups Keyword, Text
|
188
191
|
push :funcname
|
189
192
|
end
|
@@ -212,8 +215,9 @@ module Rouge
|
|
212
215
|
|
213
216
|
rule %r/[a-zA-Z_]\w*[?!]/, Name, :expr_start
|
214
217
|
rule %r/[a-zA-Z_]\w*/, Name, :method_call
|
215
|
-
rule %r
|
218
|
+
rule %r/\*\*|\/\/|>=|<=|<=>|<<?|>>?|=~|={3}|!~|&&?|\|\||\./,
|
216
219
|
Operator, :expr_start
|
220
|
+
rule %r/{%|%}/, Punctuation
|
217
221
|
rule %r/[-+\/*%=<>&!^|~]=?/, Operator, :expr_start
|
218
222
|
rule(/[?]/) { token Punctuation; push :ternary; push :expr_start }
|
219
223
|
rule %r<[\[({,:\\;/]>, Punctuation, :expr_start
|
@@ -346,6 +350,7 @@ module Rouge
|
|
346
350
|
mixin :string_intp
|
347
351
|
rule %r/\\([\\abefnrstv#"']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})/,
|
348
352
|
Str::Escape
|
353
|
+
rule %r/\\u([a-fA-F0-9]{4}|\{[^}]+\})/, Str::Escape
|
349
354
|
rule %r/\\./, Str::Escape
|
350
355
|
end
|
351
356
|
|
data/lib/rouge/lexers/css.rb
CHANGED
@@ -11,7 +11,9 @@ module Rouge
|
|
11
11
|
filenames '*.css'
|
12
12
|
mimetypes 'text/css'
|
13
13
|
|
14
|
-
|
14
|
+
# Documentation: https://www.w3.org/TR/CSS21/syndata.html#characters
|
15
|
+
|
16
|
+
identifier = /[\p{L}_-][\p{Word}\p{Cf}-]*/
|
15
17
|
number = /-?(?:[0-9]+(\.[0-9]+)?|\.[0-9]+)/
|
16
18
|
|
17
19
|
def self.attributes
|
data/lib/rouge/lexers/diff.rb
CHANGED
@@ -14,7 +14,7 @@ module Rouge
|
|
14
14
|
def self.detect?(text)
|
15
15
|
return true if text.start_with?('Index: ')
|
16
16
|
return true if text =~ %r(\Adiff[^\n]*?\ba/[^\n]*\bb/)
|
17
|
-
return true if text =~
|
17
|
+
return true if text =~ /---.*?\n[+][+][+]/ || text =~ /[+][+][+].*?\n---/
|
18
18
|
end
|
19
19
|
|
20
20
|
state :root do
|
data/lib/rouge/lexers/docker.rb
CHANGED
@@ -7,8 +7,8 @@ module Rouge
|
|
7
7
|
title "Docker"
|
8
8
|
desc "Dockerfile syntax"
|
9
9
|
tag 'docker'
|
10
|
-
aliases 'dockerfile'
|
11
|
-
filenames 'Dockerfile', '*.Dockerfile', '*.docker'
|
10
|
+
aliases 'dockerfile', 'Dockerfile'
|
11
|
+
filenames 'Dockerfile', '*.Dockerfile', '*.docker'
|
12
12
|
mimetypes 'text/x-dockerfile-config'
|
13
13
|
|
14
14
|
KEYWORDS = %w(
|
data/lib/rouge/lexers/elm.rb
CHANGED
@@ -78,13 +78,13 @@ module Rouge
|
|
78
78
|
rule %r/"/, Str::Double, :pop!
|
79
79
|
end
|
80
80
|
|
81
|
-
# Multiple line string with
|
81
|
+
# Multiple line string with triple double quotes, e.g. """ multi """
|
82
82
|
state :multiline_string do
|
83
|
-
rule %r
|
84
|
-
rule %r
|
85
|
-
rule %r
|
83
|
+
rule %r/\\"/, Str::Escape
|
84
|
+
rule %r/"""/, Str, :pop!
|
85
|
+
rule %r/[^"]+/, Str
|
86
|
+
rule %r/"/, Str
|
86
87
|
end
|
87
|
-
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class Email < RegexLexer
|
7
|
+
tag 'email'
|
8
|
+
aliases 'eml', 'e-mail'
|
9
|
+
filenames '*.eml'
|
10
|
+
mimetypes 'message/rfc822'
|
11
|
+
|
12
|
+
title "Email"
|
13
|
+
desc "An email message"
|
14
|
+
|
15
|
+
start do
|
16
|
+
push :fields
|
17
|
+
end
|
18
|
+
|
19
|
+
state :fields do
|
20
|
+
rule %r/[:]/, Operator, :field_body
|
21
|
+
rule %r/[^\n\r:]+/, Name::Tag
|
22
|
+
rule %r/[\n\r]/, Name::Tag
|
23
|
+
end
|
24
|
+
|
25
|
+
state :field_body do
|
26
|
+
rule(/(\r?\n){2}/) { token Text; pop!(2) }
|
27
|
+
rule %r/\r?\n(?![ \v\t\f])/, Text, :pop!
|
28
|
+
rule %r/[^\n\r]+/, Name::Attribute
|
29
|
+
rule %r/[\n\r]/, Name::Attribute
|
30
|
+
end
|
31
|
+
|
32
|
+
state :root do
|
33
|
+
rule %r/\n/, Text
|
34
|
+
rule %r/^>.*/, Comment
|
35
|
+
rule %r/.+/, Text
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/rouge/lexers/graphql.rb
CHANGED
data/lib/rouge/lexers/hack.rb
CHANGED
data/lib/rouge/lexers/haskell.rb
CHANGED
@@ -17,8 +17,8 @@ module Rouge
|
|
17
17
|
end
|
18
18
|
|
19
19
|
reserved = %w(
|
20
|
-
_ case class data default deriving do else if in
|
21
|
-
|
20
|
+
_ case class data default deriving do else if in infix infixl infixr
|
21
|
+
instance let newtype of then type where
|
22
22
|
)
|
23
23
|
|
24
24
|
ascii = %w(
|
@@ -54,14 +54,31 @@ module Rouge
|
|
54
54
|
state :root do
|
55
55
|
mixin :basic
|
56
56
|
|
57
|
-
rule %r
|
58
|
-
rule %r
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
rule %r/[
|
63
|
-
rule %r/[
|
64
|
-
rule %r
|
57
|
+
rule %r/'(?=(?:.|\\\S+)')/, Str::Char, :character
|
58
|
+
rule %r/"/, Str, :string
|
59
|
+
|
60
|
+
rule %r/\d+e[+-]?\d+/i, Num::Float
|
61
|
+
rule %r/\d+\.\d+(e[+-]?\d+)?/i, Num::Float
|
62
|
+
rule %r/0o[0-7]+/i, Num::Oct
|
63
|
+
rule %r/0x[\da-f]+/i, Num::Hex
|
64
|
+
rule %r/\d+/, Num::Integer
|
65
|
+
|
66
|
+
rule %r/[\w']+/ do |m|
|
67
|
+
match = m[0]
|
68
|
+
if match == "import"
|
69
|
+
token Keyword::Reserved
|
70
|
+
push :import
|
71
|
+
elsif match == "module"
|
72
|
+
token Keyword::Reserved
|
73
|
+
push :module
|
74
|
+
elsif reserved.include?(match)
|
75
|
+
token Keyword::Reserved
|
76
|
+
elsif match =~ /\A'?[A-Z]/
|
77
|
+
token Keyword::Type
|
78
|
+
else
|
79
|
+
token Name
|
80
|
+
end
|
81
|
+
end
|
65
82
|
|
66
83
|
# lambda operator
|
67
84
|
rule %r(\\(?![:!#\$\%&*+.\\/<=>?@^\|~-]+)), Name::Function
|
@@ -72,15 +89,6 @@ module Rouge
|
|
72
89
|
# other operators
|
73
90
|
rule %r([:!#\$\%&*+.\\/<=>?@^\|~-]+), Operator
|
74
91
|
|
75
|
-
rule %r/\d+e[+-]?\d+/i, Num::Float
|
76
|
-
rule %r/\d+\.\d+(e[+-]?\d+)?/i, Num::Float
|
77
|
-
rule %r/0o[0-7]+/i, Num::Oct
|
78
|
-
rule %r/0x[\da-f]+/i, Num::Hex
|
79
|
-
rule %r/\d+/, Num::Integer
|
80
|
-
|
81
|
-
rule %r/'/, Str::Char, :character
|
82
|
-
rule %r/"/, Str, :string
|
83
|
-
|
84
92
|
rule %r/\[\s*\]/, Keyword::Type
|
85
93
|
rule %r/\(\s*\)/, Name::Builtin
|
86
94
|
|
@@ -0,0 +1,166 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
load_lexer 'c.rb'
|
7
|
+
|
8
|
+
class HLSL < C
|
9
|
+
title "HLSL"
|
10
|
+
desc "HLSL, the High Level Shading Language for DirectX (docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl)"
|
11
|
+
tag 'hlsl'
|
12
|
+
filenames '*.hlsl', '*.hlsli'
|
13
|
+
mimetypes 'text/x-hlsl'
|
14
|
+
|
15
|
+
def self.keywords
|
16
|
+
@keywords ||= Set.new %w(
|
17
|
+
asm asm_fragment break case cbuffer centroid class column_major
|
18
|
+
compile compile_fragment const continue default discard do else export
|
19
|
+
extern for fxgroup globallycoherent groupshared if in inline inout
|
20
|
+
interface line lineadj linear namespace nointerpolation noperspective
|
21
|
+
NULL out packoffset pass pixelfragment point precise return register
|
22
|
+
row_major sample sampler shared stateblock stateblock_state static
|
23
|
+
struct switch tbuffer technique technique10 technique11 texture
|
24
|
+
typedef triangle uniform vertexfragment volatile while
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.keywords_type
|
29
|
+
@keywords_type ||= Set.new %w(
|
30
|
+
dword matrix snorm string unorm unsigned void vector BlendState Buffer
|
31
|
+
ByteAddressBuffer ComputeShader DepthStencilState DepthStencilView
|
32
|
+
DomainShader GeometryShader HullShader InputPatch LineStream
|
33
|
+
OutputPatch PixelShader PointStream RasterizerState RenderTargetView
|
34
|
+
RasterizerOrderedBuffer RasterizerOrderedByteAddressBuffer
|
35
|
+
RasterizerOrderedStructuredBuffer RasterizerOrderedTexture1D
|
36
|
+
RasterizerOrderedTexture1DArray RasterizerOrderedTexture2D
|
37
|
+
RasterizerOrderedTexture2DArray RasterizerOrderedTexture3D RWBuffer
|
38
|
+
RWByteAddressBuffer RWStructuredBuffer RWTexture1D RWTexture1DArray
|
39
|
+
RWTexture2D RWTexture2DArray RWTexture3D SamplerState
|
40
|
+
SamplerComparisonState StructuredBuffer Texture1D Texture1DArray
|
41
|
+
Texture2D Texture2DArray Texture2DMS Texture2DMSArray Texture3D
|
42
|
+
TextureCube TextureCubeArray TriangleStream VertexShader
|
43
|
+
|
44
|
+
bool1 bool2 bool3 bool4 BOOL1 BOOL2 BOOL3 BOOL4
|
45
|
+
int1 int2 int3 int4
|
46
|
+
half1 half2 half3 half4
|
47
|
+
float1 float2 float3 float4
|
48
|
+
double1 double2 double3 double4
|
49
|
+
|
50
|
+
bool1x1 bool1x2 bool1x3 bool1x4 bool2x1 bool2x2 bool2x3 bool2x4
|
51
|
+
bool3x1 bool3x2 bool3x3 bool3x4 bool4x1 bool4x2 bool4x3 bool4x4
|
52
|
+
BOOL1x1 BOOL1x2 BOOL1x3 BOOL1x4 BOOL2x1 BOOL2x2 BOOL2x3 BOOL2x4
|
53
|
+
BOOL3x1 BOOL3x2 BOOL3x3 BOOL3x4 BOOL4x1 BOOL4x2 BOOL4x3 BOOL4x4
|
54
|
+
half1x1 half1x2 half1x3 half1x4 half2x1 half2x2 half2x3 half2x4
|
55
|
+
half3x1 half3x2 half3x3 half3x4 half4x1 half4x2 half4x3 half4x4
|
56
|
+
int1x1 int1x2 int1x3 int1x4 int2x1 int2x2 int2x3 int2x4
|
57
|
+
int3x1 int3x2 int3x3 int3x4 int4x1 int4x2 int4x3 int4x4
|
58
|
+
float1x1 float1x2 float1x3 float1x4 float2x1 float2x2 float2x3 float2x4
|
59
|
+
float3x1 float3x2 float3x3 float3x4 float4x1 float4x2 float4x3 float4x4
|
60
|
+
double1x1 double1x2 double1x3 double1x4 double2x1 double2x2 double2x3 double2x4
|
61
|
+
double3x1 double3x2 double3x3 double3x4 double4x1 double4x2 double4x3 double4x4
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.reserved
|
66
|
+
@reserved ||= Set.new %w(
|
67
|
+
auto catch char const_cast delete dynamic_cast enum explicit friend
|
68
|
+
goto long mutable new operator private protected public
|
69
|
+
reinterpret_cast short signed sizeof static_cast template this throw
|
70
|
+
try typename union unsigned using virtual
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.builtins
|
75
|
+
@builtins ||= Set.new %w(
|
76
|
+
abort abs acos all AllMemoryBarrier AllMemoryBarrierWithGroupSync any
|
77
|
+
AppendStructuredBuffer asdouble asfloat asin asint asuint asuint atan
|
78
|
+
atan2 ceil CheckAccessFullyMapped clamp clip CompileShader
|
79
|
+
ConsumeStructuredBuffer cos cosh countbits cross D3DCOLORtoUBYTE4 ddx
|
80
|
+
ddx_coarse ddx_fine ddy ddy_coarse ddy_fine degrees determinant
|
81
|
+
DeviceMemoryBarrier DeviceMemoryBarrierWithGroupSync distance dot dst
|
82
|
+
errorf EvaluateAttributeAtCentroid EvaluateAttributeAtSample
|
83
|
+
EvaluateAttributeSnapped exp exp2 f16tof32 f32tof16 faceforward
|
84
|
+
firstbithigh firstbitlow floor fma fmod frac frexp fwidth
|
85
|
+
GetRenderTargetSampleCount GetRenderTargetSamplePosition
|
86
|
+
GlobalOrderedCountIncrement GroupMemoryBarrier
|
87
|
+
GroupMemoryBarrierWithGroupSync InterlockedAdd InterlockedAnd
|
88
|
+
InterlockedCompareExchange InterlockedCompareStore InterlockedExchange
|
89
|
+
InterlockedMax InterlockedMin InterlockedOr InterlockedXor isfinite
|
90
|
+
isinf isnan ldexp length lerp lit log log10 log2 mad max min modf
|
91
|
+
msad4 mul noise normalize pow printf Process2DQuadTessFactorsAvg
|
92
|
+
Process2DQuadTessFactorsMax Process2DQuadTessFactorsMin
|
93
|
+
ProcessIsolineTessFactors ProcessQuadTessFactorsAvg
|
94
|
+
ProcessQuadTessFactorsMax ProcessQuadTessFactorsMin
|
95
|
+
ProcessTriTessFactorsAvg ProcessTriTessFactorsMax
|
96
|
+
ProcessTriTessFactorsMin QuadReadLaneAt QuadSwapX QuadSwapY radians
|
97
|
+
rcp reflect refract reversebits round rsqrt saturate sign sin sincos
|
98
|
+
sinh smoothstep sqrt step tan tanh tex1D tex1D tex1Dbias tex1Dgrad
|
99
|
+
tex1Dlod tex1Dproj tex2D tex2D tex2Dbias tex2Dgrad tex2Dlod tex2Dproj
|
100
|
+
tex3D tex3D tex3Dbias tex3Dgrad tex3Dlod tex3Dproj texCUBE texCUBE
|
101
|
+
texCUBEbias texCUBEgrad texCUBElod texCUBEproj transpose trunc
|
102
|
+
WaveAllBitAnd WaveAllMax WaveAllMin WaveAllBitOr WaveAllBitXor
|
103
|
+
WaveAllEqual WaveAllProduct WaveAllSum WaveAllTrue WaveAnyTrue
|
104
|
+
WaveBallot WaveGetLaneCount WaveGetLaneIndex WaveGetOrderedIndex
|
105
|
+
WaveIsHelperLane WaveOnce WavePrefixProduct WavePrefixSum
|
106
|
+
WaveReadFirstLane WaveReadLaneAt
|
107
|
+
|
108
|
+
SV_CLIPDISTANCE SV_CLIPDISTANCE0 SV_CLIPDISTANCE1 SV_CULLDISTANCE
|
109
|
+
SV_CULLDISTANCE0 SV_CULLDISTANCE1 SV_COVERAGE SV_DEPTH
|
110
|
+
SV_DEPTHGREATEREQUAL SV_DEPTHLESSEQUAL SV_DISPATCHTHREADID
|
111
|
+
SV_DOMAINLOCATION SV_GROUPID SV_GROUPINDEX SV_GROUPTHREADID
|
112
|
+
SV_GSINSTANCEID SV_INNERCOVERAGE SV_INSIDETESSFACTOR SV_INSTANCEID
|
113
|
+
SV_ISFRONTFACE SV_OUTPUTCONTROLPOINTID SV_POSITION SV_PRIMITIVEID
|
114
|
+
SV_RENDERTARGETARRAYINDEX SV_SAMPLEINDEX SV_STENCILREF SV_TESSFACTOR
|
115
|
+
SV_VERTEXID SV_VIEWPORTARRAYINDEX
|
116
|
+
|
117
|
+
allow_uav_condition branch call domain earlydepthstencil fastopt
|
118
|
+
flatten forcecase instance loop maxtessfactor numthreads
|
119
|
+
outputcontrolpoints outputtopology partitioning patchconstantfunc
|
120
|
+
unroll
|
121
|
+
|
122
|
+
BINORMAL BINORMAL0 BINORMAL1 BINORMAL2 BINORMAL3 BINORMAL4
|
123
|
+
BLENDINDICES0 BLENDINDICES1 BLENDINDICES2 BLENDINDICES3 BLENDINDICES4
|
124
|
+
BLENDWEIGHT0 BLENDWEIGHT1 BLENDWEIGHT2 BLENDWEIGHT3 BLENDWEIGHT4 COLOR
|
125
|
+
COLOR0 COLOR1 COLOR2 COLOR3 COLOR4 NORMAL NORMAL0 NORMAL1 NORMAL2
|
126
|
+
NORMAL3 NORMAL4 POSITION POSITION0 POSITION1 POSITION2 POSITION3
|
127
|
+
POSITION4 POSITIONT PSIZE0 PSIZE1 PSIZE2 PSIZE3 PSIZE4 TANGENT
|
128
|
+
TANGENT0 TANGENT1 TANGENT2 TANGENT3 TANGENT4 TESSFACTOR0 TESSFACTOR1
|
129
|
+
TESSFACTOR2 TESSFACTOR3 TESSFACTOR4 TEXCOORD0 TEXCOORD1 TEXCOORD2
|
130
|
+
TEXCOORD3 TEXCOORD4
|
131
|
+
|
132
|
+
FOG PSIZE
|
133
|
+
|
134
|
+
VFACE VPOS
|
135
|
+
|
136
|
+
DEPTH0 DEPTH1 DEPTH2 DEPTH3 DEPTH4
|
137
|
+
)
|
138
|
+
end
|
139
|
+
|
140
|
+
ws = %r((?:\s|//.*?\n|/[*].*?[*]/)+)
|
141
|
+
id = /[a-zA-Z_][a-zA-Z0-9_]*/
|
142
|
+
|
143
|
+
state :root do
|
144
|
+
mixin :expr_whitespace
|
145
|
+
rule %r(
|
146
|
+
([\w*\s]+?[\s*]) # return arguments
|
147
|
+
(#{id}) # function name
|
148
|
+
(\s*\([^;]*?\)(?:\s*:\s+#{id})?) # signature
|
149
|
+
(#{ws}?)({|;) # open brace or semicolon
|
150
|
+
)mx do |m|
|
151
|
+
# This is copied from the C lexer
|
152
|
+
recurse m[1]
|
153
|
+
token Name::Function, m[2]
|
154
|
+
recurse m[3]
|
155
|
+
recurse m[4]
|
156
|
+
token Punctuation, m[5]
|
157
|
+
if m[5] == ?{
|
158
|
+
push :function
|
159
|
+
end
|
160
|
+
end
|
161
|
+
rule %r/\{/, Punctuation, :function
|
162
|
+
mixin :statements
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
data/lib/rouge/lexers/html.rb
CHANGED
@@ -7,7 +7,7 @@ module Rouge
|
|
7
7
|
title "HTML"
|
8
8
|
desc "HTML, the markup language of the web"
|
9
9
|
tag 'html'
|
10
|
-
filenames '*.htm', '*.html', '*.xhtml'
|
10
|
+
filenames '*.htm', '*.html', '*.xhtml', '*.cshtml'
|
11
11
|
mimetypes 'text/html', 'application/xhtml+xml'
|
12
12
|
|
13
13
|
def self.detect?(text)
|
@@ -47,13 +47,13 @@ module Rouge
|
|
47
47
|
rule %r(</), Name::Tag, :tag_end
|
48
48
|
rule %r/</, Name::Tag, :tag_start
|
49
49
|
|
50
|
-
rule %r(<\s*[
|
51
|
-
rule %r(<\s*/\s*[
|
50
|
+
rule %r(<\s*[\p{L}:_-][\p{Word}\p{Cf}:.·-]*), Name::Tag, :tag # opening tags
|
51
|
+
rule %r(<\s*/\s*[\p{L}:_-][\p{Word}\p{Cf}:.·-]*\s*>), Name::Tag # closing tags
|
52
52
|
end
|
53
53
|
|
54
54
|
state :tag_end do
|
55
55
|
mixin :tag_end_end
|
56
|
-
rule %r/[
|
56
|
+
rule %r/[\p{L}:_-][\p{Word}\p{Cf}:.·-]*/ do
|
57
57
|
token Name::Tag
|
58
58
|
goto :tag_end_end
|
59
59
|
end
|
@@ -67,7 +67,7 @@ module Rouge
|
|
67
67
|
state :tag_start do
|
68
68
|
rule %r/\s+/, Text
|
69
69
|
|
70
|
-
rule %r/[
|
70
|
+
rule %r/[\p{L}:_-][\p{Word}\p{Cf}:.·-]*/ do
|
71
71
|
token Name::Tag
|
72
72
|
goto :tag
|
73
73
|
end
|
@@ -83,8 +83,8 @@ module Rouge
|
|
83
83
|
|
84
84
|
state :tag do
|
85
85
|
rule %r/\s+/m, Text
|
86
|
-
rule %r/[
|
87
|
-
rule %r/[
|
86
|
+
rule %r/[\p{L}:_\[\]()*.-][\p{Word}\p{Cf}:.·\[\]()*-]*\s*=\s*/m, Name::Attribute, :attr
|
87
|
+
rule %r/[\p{L}:_*#-][\p{Word}\p{Cf}:.·*#-]*/, Name::Attribute
|
88
88
|
rule %r(/?\s*>)m, Name::Tag, :pop!
|
89
89
|
end
|
90
90
|
|