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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 627bdb5578c0590a77e598473fcbe69330f21066cb87bd3463c2acabf31ac950
4
- data.tar.gz: d28c6ae9d3a94d4cd81e1e7cd4ba883aa6a41d011569cd3051f140288bed70d8
3
+ metadata.gz: a05162378ada50863a8c1a08984934c22af14e5288510b83fef150bae1f6be77
4
+ data.tar.gz: c3785466ac705a0acac1af6d60f73c0a697fa4b7504874b8d58db6a2efcaf21d
5
5
  SHA512:
6
- metadata.gz: 27fc73f1c40e471cb1120f6dab17700fb8155b1a4518c783374088725d35afe896a382e2ec2dd8690505bbe8eaf519396a4e5b4b6154816455b5865be7275244
7
- data.tar.gz: 46e1d31f4df9486d498b8bc91b9fee28bfac7681b4acd276bbd084baf5a186ee2324c3fe16626f59df054e43e332b4fbb865115e7fb440b3acb4b3a6a0c0465e
6
+ metadata.gz: cffd7cde0caf543698b605bbdf64394a529c4fb11c025bd6ffa00d04d336f8a5cff8663d3d5a7e3f57a0f061d152d01914e2c3fbeaead37d6daf37ea491169bc
7
+ data.tar.gz: faefcadccccee11a7e896fc408dcbfddf858c73f44697b5961777285e4f7d878fcd7ee0eefd3d42a9cd5442946dfc9ded90d6875b5d12771a6bd1eb631b57c43
@@ -1,2 +1,8 @@
1
1
  / comment
2
2
  x: til 10
3
+
4
+ tab:([]a:1 2 3;b:`a `b `c);
5
+
6
+ function:{[table]
7
+ select from table where b=`c
8
+ };
@@ -0,0 +1,6 @@
1
+ module DNSTester {
2
+ type integer Identification( 0..65535 ); // 16-bit integer
3
+ type enumerated MessageKind {e_Question, e_Answer};
4
+ type charstring Question;
5
+ type charstring Answer;
6
+ }
@@ -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+)(r\d+)(\s*)([s!=<>]+)(\s*)(0x\h+|[-]?\d+)(\s*)(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do
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+)(r\d+)(\s*)([s!=<>]+)(\s*)(r\d+)(\s*)(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do
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/([+-]?)(r\d+)/i do
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/(\()(r\d+)(\s*)([+-])(\s*)(\d+)(\))/i do
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+)(\[)(r\d+)(\])/i do
100
+ rule %r/(\w+)(\[)([rw]\d+)(\])/i do
87
101
  groups Name, Punctuation, Name, Punctuation
88
102
  pop!
89
103
  end
@@ -110,7 +110,8 @@ module Rouge
110
110
  end
111
111
 
112
112
  state :string do
113
- rule(/"/, Str, :pop!)
113
+ rule %r/\\"/, Str
114
+ rule %r/"/, Str, :pop!
114
115
  rule %r/\\([\\nr]|[01][0-7]{2})/, Str::Escape
115
116
  rule %r/[^\\"\n]+/, Str
116
117
  rule %r/\\/, Str # stray backslash
@@ -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
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Rouge
5
5
  def self.version
6
- "3.12.0"
6
+ "3.13.0"
7
7
  end
8
8
  end
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.12.0
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-10-15 00:00:00.000000000 Z
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