rouge 3.12.0 → 3.13.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.
- checksums.yaml +4 -4
- data/lib/rouge/demos/q +6 -0
- data/lib/rouge/demos/ttcn3 +6 -0
- data/lib/rouge/lexers/bpf.rb +20 -6
- data/lib/rouge/lexers/q.rb +2 -1
- data/lib/rouge/lexers/ttcn3.rb +119 -0
- data/lib/rouge/version.rb +1 -1
- 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: a05162378ada50863a8c1a08984934c22af14e5288510b83fef150bae1f6be77
|
4
|
+
data.tar.gz: c3785466ac705a0acac1af6d60f73c0a697fa4b7504874b8d58db6a2efcaf21d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cffd7cde0caf543698b605bbdf64394a529c4fb11c025bd6ffa00d04d336f8a5cff8663d3d5a7e3f57a0f061d152d01914e2c3fbeaead37d6daf37ea491169bc
|
7
|
+
data.tar.gz: faefcadccccee11a7e896fc408dcbfddf858c73f44697b5961777285e4f7d878fcd7ee0eefd3d42a9cd5442946dfc9ded90d6875b5d12771a6bd1eb631b57c43
|
data/lib/rouge/demos/q
CHANGED
data/lib/rouge/lexers/bpf.rb
CHANGED
@@ -13,14 +13,28 @@ module Rouge
|
|
13
13
|
).join('|')
|
14
14
|
|
15
15
|
MISC_KEYWORDS = %w(
|
16
|
-
be16 be32 be64 exit lock
|
16
|
+
be16 be32 be64 exit lock map
|
17
17
|
).join('|')
|
18
18
|
|
19
19
|
state :root do
|
20
|
+
# Line numbers and hexadecimal output from bpftool/objdump
|
21
|
+
rule %r/(\d+)(:)(\s+)(\(\h{2}\))/i do
|
22
|
+
groups Generic::Lineno, Punctuation, Text::Whitespace, Generic
|
23
|
+
end
|
24
|
+
rule %r/(\d+)(:)(\s+)((?:\h{2} ){8})/i do
|
25
|
+
groups Generic::Lineno, Punctuation, Text::Whitespace, Generic
|
26
|
+
end
|
27
|
+
rule %r/(\d+)(:)(\s+)/i do
|
28
|
+
groups Generic::Lineno, Punctuation, Text::Whitespace
|
29
|
+
end
|
30
|
+
|
20
31
|
# Calls to helpers
|
21
32
|
rule %r/(call)(\s+)(\d+)/i do
|
22
33
|
groups Keyword, Text::Whitespace, Literal::Number::Integer
|
23
34
|
end
|
35
|
+
rule %r/(call)(\s+)(\w+)(#)(\d+)/i do
|
36
|
+
groups Keyword, Text::Whitespace, Name::Builtin, Punctuation, Literal::Number::Integer
|
37
|
+
end
|
24
38
|
|
25
39
|
# Unconditional jumps
|
26
40
|
rule %r/(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do
|
@@ -28,10 +42,10 @@ module Rouge
|
|
28
42
|
end
|
29
43
|
|
30
44
|
# Conditional jumps
|
31
|
-
rule %r/(if)(\s+)(
|
45
|
+
rule %r/(if)(\s+)([rw]\d+)(\s*)([s!=<>]+)(\s*)(0x\h+|[-]?\d+)(\s*)(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do
|
32
46
|
groups Keyword, Text::Whitespace, Name, Text::Whitespace, Operator, Text::Whitespace, Literal::Number, Text::Whitespace, Keyword, Text::Whitespace, Literal::Number::Integer, Text::Whitespace, Name::Label
|
33
47
|
end
|
34
|
-
rule %r/(if)(\s+)(
|
48
|
+
rule %r/(if)(\s+)([rw]\d+)(\s*)([s!=<>]+)(\s*)([rw]\d+)(\s*)(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do
|
35
49
|
groups Keyword, Text::Whitespace, Name, Text::Whitespace, Operator, Text::Whitespace, Name, Text::Whitespace, Keyword, Text::Whitespace, Literal::Number::Integer, Text::Whitespace, Name::Label
|
36
50
|
end
|
37
51
|
|
@@ -45,7 +59,7 @@ module Rouge
|
|
45
59
|
rule %r/[+-\/\*&|><^s]{0,3}=/i, Operator
|
46
60
|
|
47
61
|
# Registers
|
48
|
-
rule %r/([+-]?)(
|
62
|
+
rule %r/([+-]?)([rw]\d+)/i do
|
49
63
|
groups Punctuation, Name
|
50
64
|
end
|
51
65
|
|
@@ -73,7 +87,7 @@ module Rouge
|
|
73
87
|
|
74
88
|
state :address do
|
75
89
|
# Address is offset from register
|
76
|
-
rule %r/(\()(
|
90
|
+
rule %r/(\()([rw]\d+)(\s*)([+-])(\s*)(\d+)(\))/i do
|
77
91
|
groups Punctuation, Name, Text::Whitespace, Operator, Text::Whitespace, Literal::Number::Integer, Punctuation
|
78
92
|
pop!
|
79
93
|
end
|
@@ -83,7 +97,7 @@ module Rouge
|
|
83
97
|
groups Name, Punctuation, Literal::Number::Integer, Punctuation
|
84
98
|
pop!
|
85
99
|
end
|
86
|
-
rule %r/(\w+)(\[)(
|
100
|
+
rule %r/(\w+)(\[)([rw]\d+)(\])/i do
|
87
101
|
groups Name, Punctuation, Name, Punctuation
|
88
102
|
pop!
|
89
103
|
end
|
data/lib/rouge/lexers/q.rb
CHANGED
@@ -0,0 +1,119 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class TTCN3 < RegexLexer
|
7
|
+
title "TTCN3"
|
8
|
+
desc "The TTCN3 programming language (ttcn-3.org)"
|
9
|
+
|
10
|
+
tag 'ttcn3'
|
11
|
+
filenames '*.ttcn', '*.ttcn3'
|
12
|
+
mimetypes 'text/x-ttcn3', 'text/x-ttcn'
|
13
|
+
|
14
|
+
def self.keywords
|
15
|
+
@keywords ||= %w(
|
16
|
+
module import group type port component signature external
|
17
|
+
execute const template function altstep testcase var timer if
|
18
|
+
else select case for while do label goto start stop return
|
19
|
+
break int2char int2unichar int2bit int2enum int2hex int2oct
|
20
|
+
int2str int2float float2int char2int char2oct unichar2int
|
21
|
+
unichar2oct bit2int bit2hex bit2oct bit2str hex2int hex2bit
|
22
|
+
hex2oct hex2str oct2int oct2bit oct2hex oct2str oct2char
|
23
|
+
oct2unichar str2int str2hex str2oct str2float enum2int
|
24
|
+
any2unistr lengthof sizeof ispresent ischosen isvalue isbound
|
25
|
+
istemplatekind regexp substr replace encvalue decvalue
|
26
|
+
encvalue_unichar decvalue_unichar encvalue_o decvalue_o
|
27
|
+
get_stringencoding remove_bom rnd hostid send receive
|
28
|
+
setverdict
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.reserved
|
33
|
+
@reserved ||= %w(
|
34
|
+
all alt apply assert at configuration conjunct const control
|
35
|
+
delta deterministic disjunct duration fail finished fuzzy from
|
36
|
+
history implies inconc inv lazy mod mode notinv now omit
|
37
|
+
onentry onexit par pass prev realtime seq setstate static
|
38
|
+
stepsize stream timestamp until values wait
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.types
|
43
|
+
@types ||= %w(
|
44
|
+
anytype address boolean bitstring charstring hexstring octetstring
|
45
|
+
component enumerated float integer port record set of union universal
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
# optional comment or whitespace
|
50
|
+
ws = %r((?:\s|//.*?\n|/[*].*?[*]/)+)
|
51
|
+
id = /[a-zA-Z_]\w*/
|
52
|
+
digit = /\d_+\d|\d/
|
53
|
+
bin_digit = /[01]_+[01]|[01]/
|
54
|
+
oct_digit = /[0-7]_+[0-7]|[0-7]/
|
55
|
+
hex_digit = /\h_+\h|\h/
|
56
|
+
|
57
|
+
state :statements do
|
58
|
+
rule %r/\n+/m, Text
|
59
|
+
rule %r/[ \t\r]+/, Text
|
60
|
+
rule %r/\\\n/, Text # line continuation
|
61
|
+
|
62
|
+
rule %r(//(\\.|.)*?$), Comment::Single
|
63
|
+
rule %r(/(\\\n)?[*].*?[*](\\\n)?/)m, Comment::Multiline
|
64
|
+
|
65
|
+
rule %r/"/, Str, :string
|
66
|
+
rule %r/'(?:\\.|[^\\]|\\u[0-9a-f]{4})'/, Str::Char
|
67
|
+
|
68
|
+
rule %r/#{digit}+\.#{digit}+([eE]#{digit}+)?[fd]?/i, Num::Float
|
69
|
+
rule %r/'#{bin_digit}+'B/i, Num::Bin
|
70
|
+
rule %r/'#{hex_digit}+'H/i, Num::Hex
|
71
|
+
rule %r/'#{oct_digit}+'O/i, Num::Oct
|
72
|
+
rule %r/#{digit}+/i, Num::Integer
|
73
|
+
|
74
|
+
rule %r([~!%^&*+:=\|?<>/-]), Operator
|
75
|
+
rule %r/[()\[\]{},.;:]/, Punctuation
|
76
|
+
|
77
|
+
rule %r/(?:true|false|null)\b/, Name::Builtin
|
78
|
+
|
79
|
+
rule id do |m|
|
80
|
+
name = m[0]
|
81
|
+
if self.class.keywords.include? name
|
82
|
+
token Keyword
|
83
|
+
elsif self.class.types.include? name
|
84
|
+
token Keyword::Type
|
85
|
+
elsif self.class.reserved.include? name
|
86
|
+
token Keyword::Reserved
|
87
|
+
else
|
88
|
+
token Name
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
state :root do
|
94
|
+
rule %r/module\b/, Keyword::Declaration, :module
|
95
|
+
rule %r/import\b/, Keyword::Namespace, :import
|
96
|
+
|
97
|
+
mixin :statements
|
98
|
+
end
|
99
|
+
|
100
|
+
state :string do
|
101
|
+
rule %r/"/, Str, :pop!
|
102
|
+
rule %r/\\([\\abfnrtv"']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})/, Str::Escape
|
103
|
+
rule %r/[^\\"\n]+/, Str
|
104
|
+
rule %r/\\\n/, Str
|
105
|
+
rule %r/\\/, Str # stray backslash
|
106
|
+
end
|
107
|
+
|
108
|
+
state :module do
|
109
|
+
rule %r/\s+/m, Text
|
110
|
+
rule id, Name::Class, :pop!
|
111
|
+
end
|
112
|
+
|
113
|
+
state :import do
|
114
|
+
rule %r/\s+/m, Text
|
115
|
+
rule %r/[\w.]+\*?/, Name::Namespace, :pop!
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
data/lib/rouge/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rouge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeanine Adkisson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Rouge aims to a be a simple, easy-to-extend drop-in replacement for pygments.
|
14
14
|
email:
|
@@ -182,6 +182,7 @@ files:
|
|
182
182
|
- lib/rouge/demos/tex
|
183
183
|
- lib/rouge/demos/toml
|
184
184
|
- lib/rouge/demos/tsx
|
185
|
+
- lib/rouge/demos/ttcn3
|
185
186
|
- lib/rouge/demos/tulip
|
186
187
|
- lib/rouge/demos/turtle
|
187
188
|
- lib/rouge/demos/twig
|
@@ -386,6 +387,7 @@ files:
|
|
386
387
|
- lib/rouge/lexers/tex.rb
|
387
388
|
- lib/rouge/lexers/toml.rb
|
388
389
|
- lib/rouge/lexers/tsx.rb
|
390
|
+
- lib/rouge/lexers/ttcn3.rb
|
389
391
|
- lib/rouge/lexers/tulip.rb
|
390
392
|
- lib/rouge/lexers/turtle.rb
|
391
393
|
- lib/rouge/lexers/twig.rb
|