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
@@ -0,0 +1,93 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class Augeas < RegexLexer
|
7
|
+
title "Augeas"
|
8
|
+
desc "The Augeas programming language (augeas.net)"
|
9
|
+
|
10
|
+
tag 'augeas'
|
11
|
+
aliases 'aug'
|
12
|
+
filenames '*.aug'
|
13
|
+
mimetypes 'text/x-augeas'
|
14
|
+
|
15
|
+
def self.reserved
|
16
|
+
@reserved ||= Set.new %w(
|
17
|
+
_ let del store value counter seq key label autoload incl excl
|
18
|
+
transform test get put in after set clear insa insb print_string
|
19
|
+
print_regexp print_endline print_tree lens_ctype lens_atype
|
20
|
+
lens_ktype lens_vtype lens_format_atype regexp_match
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
state :basic do
|
25
|
+
rule %r/\s+/m, Text
|
26
|
+
rule %r/\(\*/, Comment::Multiline, :comment
|
27
|
+
end
|
28
|
+
|
29
|
+
state :comment do
|
30
|
+
rule %r/\*\)/, Comment::Multiline, :pop!
|
31
|
+
rule %r/\(\*/, Comment::Multiline, :comment
|
32
|
+
rule %r/[^*)]+/, Comment::Multiline
|
33
|
+
rule %r/[*)]/, Comment::Multiline
|
34
|
+
end
|
35
|
+
|
36
|
+
state :root do
|
37
|
+
mixin :basic
|
38
|
+
|
39
|
+
rule %r/(:)(\w\w*)/ do
|
40
|
+
groups Punctuation, Keyword::Type
|
41
|
+
end
|
42
|
+
|
43
|
+
rule %r/\w[\w']*/ do |m|
|
44
|
+
name = m[0]
|
45
|
+
if name == "module"
|
46
|
+
token Keyword::Reserved
|
47
|
+
push :module
|
48
|
+
elsif self.class.reserved.include? name
|
49
|
+
token Keyword::Reserved
|
50
|
+
elsif name =~ /\A[A-Z]/
|
51
|
+
token Keyword::Namespace
|
52
|
+
else
|
53
|
+
token Name
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
rule %r/"/, Str, :string
|
58
|
+
rule %r/\//, Str, :regexp
|
59
|
+
|
60
|
+
rule %r([-*+.=?\|]+), Operator
|
61
|
+
rule %r/[\[\](){}:;]/, Punctuation
|
62
|
+
end
|
63
|
+
|
64
|
+
state :module do
|
65
|
+
rule %r/\s+/, Text
|
66
|
+
rule %r/[A-Z][a-zA-Z0-9_.]*/, Name::Namespace, :pop!
|
67
|
+
end
|
68
|
+
|
69
|
+
state :regexp do
|
70
|
+
rule %r/\//, Str::Regex, :pop!
|
71
|
+
rule %r/[^\\\/]+/, Str::Regex
|
72
|
+
rule %r/\\[\\\/]/, Str::Regex
|
73
|
+
rule %r/\\/, Str::Regex
|
74
|
+
end
|
75
|
+
|
76
|
+
state :string do
|
77
|
+
rule %r/"/, Str, :pop!
|
78
|
+
rule %r/\\/, Str::Escape, :escape
|
79
|
+
rule %r/[^\\"]+/, Str
|
80
|
+
end
|
81
|
+
|
82
|
+
state :escape do
|
83
|
+
rule %r/[abfnrtv"'&\\]/, Str::Escape, :pop!
|
84
|
+
rule %r/\^[\]\[A-Z@\^_]/, Str::Escape, :pop!
|
85
|
+
rule %r/o[0-7]+/i, Str::Escape, :pop!
|
86
|
+
rule %r/x[\da-f]+/i, Str::Escape, :pop!
|
87
|
+
rule %r/\d+/, Str::Escape, :pop!
|
88
|
+
rule %r/\s+/, Str::Escape, :pop!
|
89
|
+
rule %r/./, Str, :pop!
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -78,7 +78,8 @@ module Rouge
|
|
78
78
|
|
79
79
|
state :basic do
|
80
80
|
# Comments
|
81
|
-
rule %r
|
81
|
+
rule %r/@?\brem\b.*$/i, Comment
|
82
|
+
|
82
83
|
# Empty Labels
|
83
84
|
rule %r/^::.*$/, Comment
|
84
85
|
|
@@ -105,7 +106,7 @@ module Rouge
|
|
105
106
|
end
|
106
107
|
end
|
107
108
|
|
108
|
-
rule %r/([
|
109
|
+
rule %r/((?:[\/\+]|--?)[a-z]+)\s*/i, Name::Attribute
|
109
110
|
|
110
111
|
mixin :expansions
|
111
112
|
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Regular expressions based on https://github.com/SaswatPadhi/prismjs-bibtex
|
5
|
+
# and https://github.com/alecthomas/chroma/blob/master/lexers/b/bibtex.go
|
6
|
+
|
7
|
+
module Rouge
|
8
|
+
module Lexers
|
9
|
+
class BibTeX < RegexLexer
|
10
|
+
title 'BibTeX'
|
11
|
+
desc "BibTeX"
|
12
|
+
tag 'bibtex'
|
13
|
+
aliases 'bib'
|
14
|
+
filenames '*.bib'
|
15
|
+
|
16
|
+
valid_punctuation = Regexp.quote("@!$&.\\:;<>?[]^`|~*/+-")
|
17
|
+
valid_name = /[a-z_#{valid_punctuation}][\w#{valid_punctuation}]*/io
|
18
|
+
|
19
|
+
state :root do
|
20
|
+
mixin :whitespace
|
21
|
+
|
22
|
+
rule %r/@(#{valid_name})/o do |m|
|
23
|
+
match = m[1].downcase
|
24
|
+
|
25
|
+
if match == "comment"
|
26
|
+
token Comment
|
27
|
+
elsif match == "preamble"
|
28
|
+
token Name::Class
|
29
|
+
push :closing_brace
|
30
|
+
push :value
|
31
|
+
push :opening_brace
|
32
|
+
elsif match == "string"
|
33
|
+
token Name::Class
|
34
|
+
push :closing_brace
|
35
|
+
push :field
|
36
|
+
push :opening_brace
|
37
|
+
else
|
38
|
+
token Name::Class
|
39
|
+
push :closing_brace
|
40
|
+
push :command_body
|
41
|
+
push :opening_brace
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
rule %r/.+/, Comment
|
46
|
+
end
|
47
|
+
|
48
|
+
state :opening_brace do
|
49
|
+
mixin :whitespace
|
50
|
+
rule %r/[{(]/, Punctuation, :pop!
|
51
|
+
end
|
52
|
+
|
53
|
+
state :closing_brace do
|
54
|
+
mixin :whitespace
|
55
|
+
rule %r/[})]/, Punctuation, :pop!
|
56
|
+
end
|
57
|
+
|
58
|
+
state :command_body do
|
59
|
+
mixin :whitespace
|
60
|
+
rule %r/[^\s\,\}]+/ do
|
61
|
+
token Name::Label
|
62
|
+
pop!
|
63
|
+
push :fields
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
state :fields do
|
68
|
+
mixin :whitespace
|
69
|
+
rule %r/,/, Punctuation, :field
|
70
|
+
rule(//) { pop! }
|
71
|
+
end
|
72
|
+
|
73
|
+
state :field do
|
74
|
+
mixin :whitespace
|
75
|
+
rule valid_name do
|
76
|
+
token Name::Attribute
|
77
|
+
push :value
|
78
|
+
push :equal_sign
|
79
|
+
end
|
80
|
+
rule(//) { pop! }
|
81
|
+
end
|
82
|
+
|
83
|
+
state :equal_sign do
|
84
|
+
mixin :whitespace
|
85
|
+
rule %r/=/, Punctuation, :pop!
|
86
|
+
end
|
87
|
+
|
88
|
+
state :value do
|
89
|
+
mixin :whitespace
|
90
|
+
rule valid_name, Name::Variable
|
91
|
+
rule %r/"/, Literal::String, :quoted_string
|
92
|
+
rule %r/\{/, Literal::String, :braced_string
|
93
|
+
rule %r/\d+/, Literal::Number
|
94
|
+
rule %r/#/, Punctuation
|
95
|
+
rule(//) { pop! }
|
96
|
+
end
|
97
|
+
|
98
|
+
state :quoted_string do
|
99
|
+
rule %r/\{/, Literal::String, :braced_string
|
100
|
+
rule %r/"/, Literal::String, :pop!
|
101
|
+
rule %r/[^\{\"]+/, Literal::String
|
102
|
+
end
|
103
|
+
|
104
|
+
state :braced_string do
|
105
|
+
rule %r/\{/, Literal::String, :braced_string
|
106
|
+
rule %r/\}/, Literal::String, :pop!
|
107
|
+
rule %r/[^\{\}]+/, Literal::String
|
108
|
+
end
|
109
|
+
|
110
|
+
state :whitespace do
|
111
|
+
rule %r/\s+/, Text
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,147 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class Brightscript < RegexLexer
|
7
|
+
title "BrightScript"
|
8
|
+
desc "BrightScript Programming Language (https://developer.roku.com/en-ca/docs/references/brightscript/language/brightscript-language-reference.md)"
|
9
|
+
tag 'brightscript'
|
10
|
+
aliases 'bs', 'brs'
|
11
|
+
filenames '*.brs'
|
12
|
+
|
13
|
+
# https://developer.roku.com/en-ca/docs/references/brightscript/language/global-utility-functions.md
|
14
|
+
# https://developer.roku.com/en-ca/docs/references/brightscript/language/global-string-functions.md
|
15
|
+
# https://developer.roku.com/en-ca/docs/references/brightscript/language/global-math-functions.md
|
16
|
+
def self.name_builtin
|
17
|
+
@name_builtin ||= Set.new %w(
|
18
|
+
ABS ASC ATN CDBL CHR CINT CONTROL COPYFILE COS CREATEDIRECTORY CSNG
|
19
|
+
DELETEDIRECTORY DELETEFILE EXP FINDMEMBERFUNCTION FINDNODE FIX
|
20
|
+
FORMATDRIVEFORMATJSON GETINTERFACE INSTR INT LCASE LEFT LEN LISTDIR
|
21
|
+
LOG MATCHFILES MID MOVEFILE OBSERVEFIELD PARSEJSON PARSEXML
|
22
|
+
READASCIIFILE REBOOTSYSTEM RIGHT RND RUNGARBAGECOLLECTOR SGN SIN
|
23
|
+
SLEEP SQR STR STRI STRING STRINGI STRTOI SUBSTITUTE TANTEXTTOP TEXT
|
24
|
+
TRUCASE UPTIME VALVISIBLE VISIBLE WAIT
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
# https://developer.roku.com/en-ca/docs/references/brightscript/language/reserved-words.md
|
29
|
+
def self.keyword_reserved
|
30
|
+
@keyword_reserved ||= Set.new %w(
|
31
|
+
BOX CREATEOBJECT DIM EACH ELSE ELSEIF END ENDFUNCTION ENDIF ENDSUB
|
32
|
+
ENDWHILE EVAL EXIT EXITWHILE FALSE FOR FUNCTION GETGLOBALAA
|
33
|
+
GETLASTRUNCOMPILEERROR GETLASTRUNRUNTIMEERROR GOTO IF IN INVALID LET
|
34
|
+
LINE_NUM M NEXT OBJFUN POS PRINT REM RETURN RUN STEP STOP SUB TAB TO
|
35
|
+
TRUE TYPE WHILE
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
# These keywords are present in BrightScript, but not supported in standard .brs files
|
40
|
+
def self.keyword_reserved_unsupported
|
41
|
+
@keyword_reserved_unsupported ||= Set.new %w(
|
42
|
+
CLASS CONST IMPORT LIBRARY NAMESPACE PRIVATE PROTECTED PUBLIC
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
# https://developer.roku.com/en-ca/docs/references/brightscript/language/expressions-variables-types.md
|
47
|
+
def self.keyword_type
|
48
|
+
@keyword_type ||= Set.new %w(
|
49
|
+
BOOLEAN DIM DOUBLE DYNAMIC FLOAT FUNCTION INTEGER INTERFACE INVALID
|
50
|
+
LONGINTEGER OBJECT STRING VOID
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
# https://developer.roku.com/en-ca/docs/references/brightscript/language/expressions-variables-types.md#operators
|
55
|
+
def self.operator_word
|
56
|
+
@operator_word ||= Set.new %w(
|
57
|
+
AND AS MOD NOT OR THEN
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Scene graph components configured as builtins. See BrightScript component documentation e.g.
|
62
|
+
# https://developer.roku.com/en-ca/docs/references/brightscript/components/roappinfo.md
|
63
|
+
def self.builtins
|
64
|
+
@builtins ||= Set.new %w(
|
65
|
+
roAppendFile roAppInfo roAppManager roArray roAssociativeArray
|
66
|
+
roAudioGuide roAudioMetadata roAudioPlayer roAudioPlayerEvent
|
67
|
+
roAudioResourceroBitmap roBoolean roBoolean roBrightPackage roBrSub
|
68
|
+
roButton roByteArray roCaptionRenderer roCaptionRendererEvent
|
69
|
+
roCecInterface roCECStatusEvent roChannelStore roChannelStoreEvent
|
70
|
+
roClockWidget roCodeRegistrationScreen
|
71
|
+
roCodeRegistrationScreenEventroCompositor roControlDown roControlPort
|
72
|
+
roControlPort roControlUp roCreateFile roDatagramReceiver
|
73
|
+
roDatagramSender roDataGramSocket roDateTime roDeviceInfo
|
74
|
+
roDeviceInfoEvent roDoubleroEVPCipher roEVPDigest roFileSystem
|
75
|
+
roFileSystemEvent roFloat roFont roFontMetrics roFontRegistry
|
76
|
+
roFunction roGlobal roGpio roGridScreen roGridScreenEvent
|
77
|
+
roHdmiHotPlugEventroHdmiStatus roHdmiStatusEvent roHMAC roHttpAgent
|
78
|
+
roImageCanvas roImageCanvasEvent roImageMetadata roImagePlayer
|
79
|
+
roImageWidgetroInput roInputEvent roInt roInt roInvalid roInvalid
|
80
|
+
roIRRemote roKeyboard roKeyboardPress roKeyboardScreen
|
81
|
+
roKeyboardScreenEventroList roListScreen roListScreenEvent
|
82
|
+
roLocalization roLongInteger roMessageDialog roMessageDialogEvent
|
83
|
+
roMessagePort roMicrophone roMicrophoneEvent roNetworkConfiguration
|
84
|
+
roOneLineDialog roOneLineDialogEventroParagraphScreen
|
85
|
+
roParagraphScreenEvent roPath roPinEntryDialog roPinEntryDialogEvent
|
86
|
+
roPinentryScreen roPosterScreen roPosterScreenEventroProgramGuide
|
87
|
+
roQuadravoxButton roReadFile roRectangleroRegexroRegion roRegistry
|
88
|
+
roRegistrySection roResourceManager roRSA roRssArticle roRssParser
|
89
|
+
roScreen roSearchHistory roSearchScreen roSearchScreenEvent
|
90
|
+
roSerialPort roSGNode roSGNodeEvent roSGScreenroSGScreenEvent
|
91
|
+
roSlideShowroSlideShowEvent roSNS5 roSocketAddress roSocketEvent
|
92
|
+
roSpringboardScreen roSpringboardScreenEventroSprite roStorageInfo
|
93
|
+
roStreamSocket roStringroSystemLogroSystemLogEvent roSystemTime
|
94
|
+
roTextFieldroTextScreen roTextScreenEvent roTextToSpeech
|
95
|
+
roTextToSpeechEvent roTextureManager roTextureRequest
|
96
|
+
roTextureRequestEventroTextWidget roTimer roTimespan roTouchScreen
|
97
|
+
roTunerroTunerEvent roUniversalControlEvent roUrlEvent roUrlTransfer
|
98
|
+
roVideoEvent roVideoInput roVideoMode roVideoPlayer roVideoPlayerEvent
|
99
|
+
roVideoScreen roVideoScreenEventroWriteFile roXMLElement roXMLList
|
100
|
+
)
|
101
|
+
end
|
102
|
+
|
103
|
+
id = /[$a-z_][a-z0-9_]*/io
|
104
|
+
|
105
|
+
state :root do
|
106
|
+
rule %r/\s+/m, Text::Whitespace
|
107
|
+
|
108
|
+
# https://developer.roku.com/en-ca/docs/references/brightscript/language/expressions-variables-types.md#comments
|
109
|
+
rule %r/\'.*/, Comment::Single
|
110
|
+
rule %r/REM.*/i, Comment::Single
|
111
|
+
|
112
|
+
# https://developer.roku.com/en-ca/docs/references/brightscript/language/expressions-variables-types.md#operators
|
113
|
+
rule %r([~!%^&*+=\|?:<>/-]), Operator
|
114
|
+
|
115
|
+
rule %r/\d*\.\d+(e-?\d+)?/i, Num::Float
|
116
|
+
rule %r/\d+[lu]*/i, Num::Integer
|
117
|
+
|
118
|
+
rule %r/".*?"/, Str::Double
|
119
|
+
|
120
|
+
rule %r/#{id}(?=\s*[(])/, Name::Function
|
121
|
+
|
122
|
+
rule %r/[()\[\],.;{}]/, Punctuation
|
123
|
+
|
124
|
+
rule id do |m|
|
125
|
+
caseSensitiveChunk = m[0]
|
126
|
+
caseInsensitiveChunk = m[0].upcase
|
127
|
+
|
128
|
+
if self.class.builtins.include?(caseSensitiveChunk)
|
129
|
+
token Keyword::Reserved
|
130
|
+
elsif self.class.keyword_reserved.include?(caseInsensitiveChunk)
|
131
|
+
token Keyword::Reserved
|
132
|
+
elsif self.class.keyword_reserved_unsupported.include?(caseInsensitiveChunk)
|
133
|
+
token Keyword::Reserved
|
134
|
+
elsif self.class.keyword_type.include?(caseInsensitiveChunk)
|
135
|
+
token Keyword::Type
|
136
|
+
elsif self.class.name_builtin.include?(caseInsensitiveChunk)
|
137
|
+
token Name::Builtin
|
138
|
+
elsif self.class.operator_word.include?(caseInsensitiveChunk)
|
139
|
+
token Operator::Word
|
140
|
+
else
|
141
|
+
token Name
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
data/lib/rouge/lexers/cmake.rb
CHANGED
@@ -22,6 +22,7 @@ module Rouge
|
|
22
22
|
}
|
23
23
|
|
24
24
|
BUILTIN_COMMANDS = Set.new %w[
|
25
|
+
add_compile_definitions
|
25
26
|
add_compile_options
|
26
27
|
add_custom_command
|
27
28
|
add_custom_target
|
@@ -29,6 +30,7 @@ module Rouge
|
|
29
30
|
add_dependencies
|
30
31
|
add_executable
|
31
32
|
add_library
|
33
|
+
add_link_options
|
32
34
|
add_subdirectory
|
33
35
|
add_test
|
34
36
|
aux_source_directory
|
@@ -36,7 +38,9 @@ module Rouge
|
|
36
38
|
build_command
|
37
39
|
build_name
|
38
40
|
cmake_host_system_information
|
41
|
+
cmake_language
|
39
42
|
cmake_minimum_required
|
43
|
+
cmake_parse_arguments
|
40
44
|
cmake_policy
|
41
45
|
configure_file
|
42
46
|
create_test_sourcelist
|
@@ -74,6 +78,7 @@ module Rouge
|
|
74
78
|
include
|
75
79
|
include_directories
|
76
80
|
include_external_msproject
|
81
|
+
include_guard
|
77
82
|
include_regular_expression
|
78
83
|
install
|
79
84
|
install_files
|
@@ -110,9 +115,14 @@ module Rouge
|
|
110
115
|
subdir_depends
|
111
116
|
subdirs
|
112
117
|
target_compile_definitions
|
118
|
+
target_compile_features
|
113
119
|
target_compile_options
|
114
120
|
target_include_directories
|
121
|
+
target_link_directories
|
115
122
|
target_link_libraries
|
123
|
+
target_link_options
|
124
|
+
target_precompile_headers
|
125
|
+
target_sources
|
116
126
|
try_compile
|
117
127
|
try_run
|
118
128
|
unset
|
data/lib/rouge/lexers/cpp.rb
CHANGED
@@ -63,26 +63,33 @@ module Rouge
|
|
63
63
|
rule %r((#{dq}[.]#{dq}?|[.]#{dq})(e[+-]?#{dq}[lu]*)?)i, Num::Float
|
64
64
|
rule %r(#{dq}e[+-]?#{dq}[lu]*)i, Num::Float
|
65
65
|
rule %r/0x\h('?\h)*[lu]*/i, Num::Hex
|
66
|
-
rule %r/0b[01]+(
|
66
|
+
rule %r/0b[01]+('[01]+)*/, Num::Bin
|
67
67
|
rule %r/0[0-7]('?[0-7])*[lu]*/i, Num::Oct
|
68
68
|
rule %r/#{dq}[lu]*/i, Num::Integer
|
69
69
|
rule %r/\bnullptr\b/, Name::Builtin
|
70
70
|
rule %r/(?:u8|u|U|L)?R"([a-zA-Z0-9_{}\[\]#<>%:;.?*\+\-\/\^&|~!=,"']{,16})\(.*?\)\1"/m, Str
|
71
|
+
rule %r/::/, Operator
|
71
72
|
end
|
72
73
|
|
73
74
|
state :classname do
|
74
75
|
rule id, Name::Class, :pop!
|
75
76
|
|
76
77
|
# template specification
|
77
|
-
rule %r/\s*(?=>)/m, Text, :pop!
|
78
|
-
rule %r/[.]{3}/, Operator
|
79
78
|
mixin :whitespace
|
79
|
+
rule %r/[.]{3}/, Operator
|
80
|
+
rule %r/,/, Punctuation, :pop!
|
81
|
+
rule(//) { pop! }
|
80
82
|
end
|
81
83
|
|
82
84
|
state :template do
|
83
|
-
rule %r
|
85
|
+
rule %r/[>;]/, Punctuation, :pop!
|
84
86
|
rule %r/typename\b/, Keyword, :classname
|
85
|
-
mixin :
|
87
|
+
mixin :statements
|
88
|
+
end
|
89
|
+
|
90
|
+
state :case do
|
91
|
+
rule %r/:(?!:)/, Punctuation, :pop!
|
92
|
+
mixin :statements
|
86
93
|
end
|
87
94
|
end
|
88
95
|
end
|