rouge 3.8.0 → 3.10.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: 4041f8ac950b427b35d8d3147b6d9aed3743655daaaf09f57d303932b11259a6
4
- data.tar.gz: cddd94af18b0f7ba578fa4c57f75415233d5518095b29202a7c12afd2662b804
3
+ metadata.gz: 3fb254c48c7225eb55006a7e1fb0cd713afa34faf35d4f4c92bec44c663a7a49
4
+ data.tar.gz: 0d5193efc0336f18a8012f09135deb4eb988051367b78928c5b7bc61f3f0b49c
5
5
  SHA512:
6
- metadata.gz: 68b649f1f965e5cd21fd722263bdff8720ba04119b8fff2245bb9c4178648d255362c3a18129c6724dd56893f777a518d1ff74ade223697530f5a6595d20f2aa
7
- data.tar.gz: 182df2ef3e868eb95132022309db218e34f2cd19e9e874a7d119f6250db0971e7ba6fd28ddea2ebfa8fdb759504dfe8a8401e085e95386748c7a00de347fc5d9
6
+ metadata.gz: 41128ed9650fe8aa804d9c93c44ebaf8f93131ee156ed1b57acfd1b790f435cf9f7f2233fd7ca3701b206b7131d979a2517abbf87da6c01ca931ec8d7ac4c04b
7
+ data.tar.gz: 255518b66c766562b22005ade1eebc7bf092e3b29b1f5fe298b0497801a86de2e350e726b57ac52380d58e9aa28bfb84cff2f917759053548704bd2bb4bf4b8c
@@ -0,0 +1,6 @@
1
+ delete :: !a !.(Set a) -> Set a | < a
2
+ delete x Tip = Tip
3
+ delete x (Bin _ y l r)
4
+ | x < y = balanceR y (delete x l) r
5
+ | x > y = balanceL y l (delete x r)
6
+ | otherwise = glue l r
@@ -0,0 +1 @@
1
+ <title><%= @title %></title>
@@ -0,0 +1,5 @@
1
+ // hello world!
2
+ public static function hello(arg : String) {
3
+ return 'Hello $arg';
4
+ }
5
+
@@ -0,0 +1,5 @@
1
+ SELECT e.first_name, e.last_name, d.department_name
2
+ FROM employees e
3
+ JOIN departments d ON e.department_id = d.department_id;
4
+
5
+ update `table` set name='abc', date=${date}, test_interpolation="${var1}.${var2}" where xyz is null;
@@ -0,0 +1,3 @@
1
+ // Create Distribution of Big Class
2
+ dt = open( "$sample_data\big class.jmp" );
3
+ dt << Distribution( Column( :age ), Histograms Only( 1 ) );
@@ -0,0 +1,6 @@
1
+ node count(init: int; reset, event: bool) returns (c: int);
2
+ let
3
+ c = init -> if reset then init
4
+ else if event then pre(c)+1
5
+ else pre(c);
6
+ tel;
@@ -0,0 +1,18 @@
1
+ node gen_x_v1() returns (x:real) = loop 0.0<x and x<42.0
2
+
3
+ node gen_x_v2() returns (x:real) =
4
+ loop { 0.0<x and x<42.0 fby loop [20] x = pre x }
5
+
6
+ node gen_x_v3() returns (target:real; x:real=0.0) =
7
+ run target := gen_x_v2() in
8
+ loop { x = (pre x + target) / 2.0 }
9
+
10
+ let inertia=0.6
11
+
12
+ node gen_x_v4() returns (target:real; x:real=0.0) =
13
+ run target := gen_x_v2() in
14
+ exist px,ppx : real = 0.0 in
15
+ loop {
16
+ px = pre x and ppx = pre px and
17
+ x = (px+target) / 2.0+inertia*(px-ppx)
18
+ }
@@ -0,0 +1,6 @@
1
+ SELECT ?item ?itemLabel
2
+ WHERE
3
+ {
4
+ ?item wdt:P31 wd:Q146.
5
+ SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
6
+ }
@@ -1,10 +1,3 @@
1
- # From: https://github.com/terraform-providers/terraform-provider-aws/blob/master/examples/count/main.tf
2
-
3
- # Specify the provider and access details
4
- provider "aws" {
5
- region = "${var.aws_region}"
6
- }
7
-
8
1
  resource "aws_elb" "web" {
9
2
  name = "terraform-example-elb"
10
3
 
@@ -21,11 +14,3 @@ resource "aws_elb" "web" {
21
14
  # The instances are registered automatically
22
15
  instances = ["${aws_instance.web.*.id}"]
23
16
  }
24
-
25
- resource "aws_instance" "web" {
26
- instance_type = "m1.small"
27
- ami = "${lookup(var.aws_amis, var.aws_region)}"
28
-
29
- # This will create 4 instances
30
- count = 4
31
- }
@@ -0,0 +1,156 @@
1
+ # -*- coding: utf-8 -*- #
2
+ # frozen_string_literal: true
3
+
4
+ module Rouge
5
+ module Lexers
6
+ class Clean < RegexLexer
7
+ title "Clean"
8
+ desc "The Clean programming language (clean.cs.ru.nl)"
9
+
10
+ tag 'clean'
11
+ filenames '*.dcl', '*.icl'
12
+
13
+ def self.keywords
14
+ @keywords ||= Set.new %w(
15
+ if otherwise
16
+ let in
17
+ with where
18
+ case of
19
+ infix infixl infixr
20
+ class instance
21
+ generic derive
22
+ special
23
+ implementation definition system module
24
+ from import qualified as
25
+ dynamic
26
+ code inline foreign export ccall stdcall
27
+ )
28
+ end
29
+
30
+ # These are literal patterns common to the ABC intermediate language and
31
+ # Clean. Clean has more extensive literal patterns (see :basic below).
32
+ state :common_literals do
33
+ rule %r/'(?:[^'\\]|\\(?:x[0-9a-fA-F]+|\d+|.))'/, Str::Char
34
+
35
+ rule %r/[+~-]?\d+\.\d+(?:E[+-]?\d+)?\b/, Num::Float
36
+ rule %r/[+~-]?\d+E[+-]?\d+\b/, Num::Float
37
+ rule %r/[+~-]?\d+/, Num::Integer
38
+
39
+ rule %r/"/, Str::Double, :string
40
+ end
41
+
42
+ state :basic do
43
+ rule %r/\s+/m, Text::Whitespace
44
+
45
+ rule %r/\/\/\*.*/, Comment::Doc
46
+ rule %r/\/\/.*/, Comment::Single
47
+ rule %r/\/\*\*/, Comment::Doc, :comment_doc
48
+ rule %r/\/\*/, Comment::Multiline, :comment
49
+
50
+ rule %r/[+~-]?0[0-7]+/, Num::Oct
51
+ rule %r/[+~-]?0x[0-9a-fA-F]+/, Num::Hex
52
+ mixin :common_literals
53
+ rule %r/(\[)(\s*)(')(?=.*?'\])/ do
54
+ groups Punctuation, Text::Whitespace, Str::Single, Punctuation
55
+ push :charlist
56
+ end
57
+ end
58
+
59
+ # nested commenting
60
+ state :comment_doc do
61
+ rule %r/\*\//, Comment::Doc, :pop!
62
+ rule %r/\/\/.*/, Comment::Doc # Singleline comments in multiline comments are skipped
63
+ rule %r/\/\*/, Comment::Doc, :comment
64
+ rule %r/[^*\/]+/, Comment::Doc
65
+ rule %r/[*\/]/, Comment::Doc
66
+ end
67
+
68
+ # This is the same as the above, but with Multiline instead of Doc
69
+ state :comment do
70
+ rule %r/\*\//, Comment::Multiline, :pop!
71
+ rule %r/\/\/.*/, Comment::Multiline # Singleline comments in multiline comments are skipped
72
+ rule %r/\/\*/, Comment::Multiline, :comment
73
+ rule %r/[^*\/]+/, Comment::Multiline
74
+ rule %r/[*\/]/, Comment::Multiline
75
+ end
76
+
77
+ state :root do
78
+ mixin :basic
79
+
80
+ rule %r/code(\s+inline)?\s*{/, Comment::Preproc, :abc
81
+
82
+ rule %r/_*[a-z][\w_`]*/ do |m|
83
+ if self.class.keywords.include?(m[0])
84
+ token Keyword
85
+ else
86
+ token Name
87
+ end
88
+ end
89
+
90
+ rule %r/_*[A-Z][\w_`]*/ do |m|
91
+ if m[0]=='True' || m[0]=='False'
92
+ token Keyword::Constant
93
+ else
94
+ token Keyword::Type
95
+ end
96
+ end
97
+
98
+ rule %r/[^\w_\s`]/, Punctuation
99
+ rule %r/_\b/, Punctuation
100
+ end
101
+
102
+ state :escapes do
103
+ rule %r/\\x[0-9a-fA-F]{1,2}/i, Str::Escape
104
+ rule %r/\\d\d{0,3}/i, Str::Escape
105
+ rule %r/\\0[0-7]{0,3}/, Str::Escape
106
+ rule %r/\\[0-7]{1,3}/, Str::Escape
107
+ rule %r/\\[nrfbtv\\"']/, Str::Escape
108
+ end
109
+
110
+ state :string do
111
+ rule %r/"/, Str::Double, :pop!
112
+ mixin :escapes
113
+ rule %r/[^\\"]+/, Str::Double
114
+ end
115
+
116
+ state :charlist do
117
+ rule %r/(')(\])/ do
118
+ groups Str::Single, Punctuation
119
+ pop!
120
+ end
121
+ mixin :escapes
122
+ rule %r/[^\\']/, Str::Single
123
+ end
124
+
125
+ state :abc_basic do
126
+ rule %r/\s+/, Text::Whitespace
127
+ rule %r/\|.*/, Comment::Single
128
+ mixin :common_literals
129
+ end
130
+
131
+ # The ABC intermediate language can be included, similar to C's inline
132
+ # assembly. For some information about ABC, see:
133
+ # https://en.wikipedia.org/wiki/Clean_(programming_language)#The_ABC-Machine
134
+ state :abc do
135
+ mixin :abc_basic
136
+
137
+ rule %r/}/, Comment::Preproc, :pop!
138
+ rule %r/\.\w*/, Keyword, :abc_rest_of_line
139
+ rule %r/[\w_]+/, Name::Builtin, :abc_rest_of_line
140
+ end
141
+
142
+ state :abc_rest_of_line do
143
+ rule %r/\n/, Text::Whitespace, :pop!
144
+ rule %r/}/ do
145
+ token Comment::Preproc
146
+ pop!
147
+ pop!
148
+ end
149
+
150
+ mixin :abc_basic
151
+
152
+ rule %r/\S+/, Name
153
+ end
154
+ end
155
+ end
156
+ end
@@ -7,7 +7,7 @@ module Rouge
7
7
  title "Common Lisp"
8
8
  desc "The Common Lisp variant of Lisp (common-lisp.net)"
9
9
  tag 'common_lisp'
10
- aliases 'cl', 'common-lisp', 'elisp', 'emacs-lisp'
10
+ aliases 'cl', 'common-lisp', 'elisp', 'emacs-lisp', 'lisp'
11
11
 
12
12
  filenames '*.cl', '*.lisp', '*.asd', '*.el' # used for Elisp too
13
13
  mimetypes 'text/x-common-lisp'
@@ -0,0 +1,51 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class EEX < TemplateLexer
6
+ title "EEX"
7
+ desc "Embedded Elixir"
8
+
9
+ tag 'eex'
10
+
11
+ filenames '*.eex'
12
+
13
+ def initialize(opts={})
14
+ @elixir_lexer = Elixir.new(opts)
15
+
16
+ super(opts)
17
+ end
18
+
19
+ start do
20
+ parent.reset!
21
+ @elixir_lexer.reset!
22
+ end
23
+
24
+ open = /<%%|<%=|<%#|<%/
25
+ close = /%%>|%>/
26
+
27
+ state :root do
28
+ rule %r/<%#/, Comment, :comment
29
+
30
+ rule open, Comment::Preproc, :elixir
31
+
32
+ rule %r/.+?(?=#{open})|.+/mo do
33
+ delegate parent
34
+ end
35
+ end
36
+
37
+ state :comment do
38
+ rule close, Comment, :pop!
39
+ rule %r/.+?(?=#{close})|.+/mo, Comment
40
+ end
41
+
42
+ state :elixir do
43
+ rule close, Comment::Preproc, :pop!
44
+
45
+ rule %r/.+?(?=#{close})|.+/mo do
46
+ delegate @elixir_lexer
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -51,15 +51,25 @@ module Rouge
51
51
  state :strings do
52
52
  rule %r/(%[A-Ba-z])?"""(?:.|\n)*?"""/, Str::Doc
53
53
  rule %r/'''(?:.|\n)*?'''/, Str::Doc
54
- rule %r/"/, Str::Doc, :dqs
55
- rule %r/'.*?'/, Str::Single
54
+ rule %r/"/, Str::Double, :dqs
55
+ rule %r/'/, Str::Single, :sqs
56
56
  rule %r{(?<!\w)\?(\\(x\d{1,2}|\h{1,2}(?!\h)\b|0[0-7]{0,2}(?![0-7])\b[^x0MC])|(\\[MC]-)+\w|[^\s\\])}, Str::Other
57
-
58
57
  end
59
58
 
60
59
  state :dqs do
60
+ mixin :escapes
61
+ mixin :interpoling
62
+ rule %r/[^#"\\]+/, Str::Double
61
63
  rule %r/"/, Str::Double, :pop!
62
- mixin :enddoublestr
64
+ rule %r/[#\\]/, Str::Double
65
+ end
66
+
67
+ state :sqs do
68
+ mixin :escapes
69
+ mixin :interpoling
70
+ rule %r/[^#'\\]+/, Str::Single
71
+ rule %r/'/, Str::Single, :pop!
72
+ rule %r/[#\\]/, Str::Single
63
73
  end
64
74
 
65
75
  state :interpoling do
@@ -71,17 +81,18 @@ module Rouge
71
81
  mixin :root
72
82
  end
73
83
 
84
+ state :escapes do
85
+ rule %r/\\x\h{2}/, Str::Escape
86
+ rule %r/\\u\{?\d+\}?/, Str::Escape
87
+ rule %r/\\[\\abdefnrstv0"']/, Str::Escape
88
+ end
89
+
74
90
  state :interpoling_symbol do
75
91
  rule %r/"/, Str::Symbol, :pop!
76
92
  mixin :interpoling
77
93
  rule %r/[^#"]+/, Str::Symbol
78
94
  end
79
95
 
80
- state :enddoublestr do
81
- mixin :interpoling
82
- rule %r/[^#"]+/, Str::Double
83
- end
84
-
85
96
  state :sigil_strings do
86
97
  # ~-sigiled strings
87
98
  # ~(abc), ~[abc], ~<abc>, ~|abc|, ~r/abc/, etc
@@ -0,0 +1,246 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class Haxe < RegexLexer
6
+ title "Haxe"
7
+ desc "Haxe Cross-platform Toolkit (http://haxe.org)"
8
+
9
+ tag 'haxe'
10
+ aliases 'hx', 'haxe'
11
+ filenames '*.hx'
12
+ mimetypes 'text/haxe', 'text/x-haxe', 'text/x-hx'
13
+
14
+ def self.detect?(text)
15
+ return true if text.shebang? "haxe"
16
+ end
17
+
18
+ def self.keywords
19
+ @keywords ||= Set.new %w(
20
+ break case cast catch class continue default do else enum false for
21
+ function if import interface macro new null override package private
22
+ public return switch this throw true try untyped while
23
+ )
24
+ end
25
+
26
+ def self.imports
27
+ @imports ||= Set.new %w(
28
+ import using
29
+ )
30
+ end
31
+
32
+ def self.declarations
33
+ @declarations ||= Set.new %w(
34
+ abstract dynamic extern extends from implements inline static to
35
+ typedef var
36
+ )
37
+ end
38
+
39
+ def self.reserved
40
+ @reserved ||= Set.new %w(
41
+ super trace inline build autoBuild enum
42
+ )
43
+ end
44
+
45
+ def self.constants
46
+ @constants ||= Set.new %w(true false null)
47
+ end
48
+
49
+ def self.builtins
50
+ @builtins ||= %w(
51
+ Void Dynamic Math Class Any Float Int UInt String StringTools Sys
52
+ EReg isNaN parseFloat parseInt this Array Map Date DateTools Bool
53
+ Lambda Reflect Std File FileSystem
54
+ )
55
+ end
56
+
57
+ id = /[$a-zA-Z_][a-zA-Z0-9_]*/
58
+
59
+ state :comments_and_whitespace do
60
+ rule %r/\s+/, Text
61
+ rule %r(//.*?$), Comment::Single
62
+ rule %r(/\*.*?\*/)m, Comment::Multiline
63
+ end
64
+
65
+ state :expr_start do
66
+ mixin :comments_and_whitespace
67
+
68
+ rule %r/#(?:if|elseif|else|end).*/, Comment::Preproc
69
+
70
+ rule %r(~) do
71
+ token Str::Regex
72
+ goto :regex
73
+ end
74
+
75
+ rule %r/[{]/, Punctuation, :object
76
+
77
+ rule %r//, Text, :pop!
78
+ end
79
+
80
+ state :regex do
81
+ rule %r(/) do
82
+ token Str::Regex
83
+ goto :regex_end
84
+ end
85
+
86
+ rule %r([^/]\n), Error, :pop!
87
+
88
+ rule %r/\n/, Error, :pop!
89
+ rule %r/\[\^/, Str::Escape, :regex_group
90
+ rule %r/\[/, Str::Escape, :regex_group
91
+ rule %r/\\./, Str::Escape
92
+ rule %r{[(][?][:=<!]}, Str::Escape
93
+ rule %r/[{][\d,]+[}]/, Str::Escape
94
+ rule %r/[()?]/, Str::Escape
95
+ rule %r/./, Str::Regex
96
+ end
97
+
98
+ state :regex_end do
99
+ rule %r/[gim]+/, Str::Regex, :pop!
100
+ rule(//) { pop! }
101
+ end
102
+
103
+ state :regex_group do
104
+ # specially highlight / in a group to indicate that it doesn't
105
+ # close the regex
106
+ rule %r/\//, Str::Escape
107
+
108
+ rule %r([^/]\n) do
109
+ token Error
110
+ pop! 2
111
+ end
112
+
113
+ rule %r/\]/, Str::Escape, :pop!
114
+ rule %r/\\./, Str::Escape
115
+ rule %r/./, Str::Regex
116
+ end
117
+
118
+ state :bad_regex do
119
+ rule %r/[^\n]+/, Error, :pop!
120
+ end
121
+
122
+ state :root do
123
+ rule %r/\n/, Text, :statement
124
+ rule %r(\{), Punctuation, :expr_start
125
+
126
+ mixin :comments_and_whitespace
127
+
128
+ rule %r/@/, Name::Decorator, :metadata
129
+ rule %r(\+\+ | -- | ~ | && | \|\| | \\(?=\n) | << | >> | ==
130
+ | != )x,
131
+ Operator, :expr_start
132
+ rule %r([-:<>+*%&|\^/!=]=?), Operator, :expr_start
133
+ rule %r/[(\[,]/, Punctuation, :expr_start
134
+ rule %r/;/, Punctuation, :statement
135
+ rule %r/[)\]}.]/, Punctuation
136
+
137
+ rule %r/[?]/ do
138
+ token Punctuation
139
+ push :ternary
140
+ push :expr_start
141
+ end
142
+
143
+ rule id do |m|
144
+ if self.class.keywords.include? m[0]
145
+ token Keyword
146
+ push :expr_start
147
+ elsif self.class.imports.include? m[0]
148
+ token Keyword
149
+ push :namespace
150
+ elsif self.class.declarations.include? m[0]
151
+ token Keyword::Declaration
152
+ push :expr_start
153
+ elsif self.class.reserved.include? m[0]
154
+ token Keyword::Reserved
155
+ elsif self.class.constants.include? m[0]
156
+ token Keyword::Constant
157
+ elsif self.class.builtins.include? m[0]
158
+ token Name::Builtin
159
+ else
160
+ token Name::Other
161
+ end
162
+ end
163
+
164
+ rule %r/\-?\d+\.\d+(?:[eE]\d+)?[fd]?/, Num::Float
165
+ rule %r/0x\h+/, Num::Hex
166
+ rule %r/\-?[0-9]+/, Num::Integer
167
+ rule %r/"/, Str::Double, :str_double
168
+ rule %r/'/, Str::Single, :str_single
169
+ end
170
+
171
+ # braced parts that aren't object literals
172
+ state :statement do
173
+ rule %r/(#{id})(\s*)(:)/ do
174
+ groups Name::Label, Text, Punctuation
175
+ end
176
+
177
+ mixin :expr_start
178
+ end
179
+
180
+ # object literals
181
+ state :object do
182
+ mixin :comments_and_whitespace
183
+ rule %r/[}]/ do
184
+ token Punctuation
185
+ goto :statement
186
+ end
187
+
188
+ rule %r/(#{id})(\s*)(:)/ do
189
+ groups Name::Attribute, Text, Punctuation
190
+ push :expr_start
191
+ end
192
+
193
+ rule %r/:/, Punctuation
194
+ mixin :root
195
+ end
196
+
197
+ state :metadata do
198
+ rule %r/(#{id})(\()?/ do |m|
199
+ groups Name::Decorator, Punctuation
200
+ pop! unless m[2]
201
+ end
202
+ rule %r/:#{id}(?:\.#{id})*/, Name::Decorator, :pop!
203
+ rule %r/\)/, Name::Decorator, :pop!
204
+ mixin :root
205
+ end
206
+
207
+ # ternary expressions, where <id>: is not a label!
208
+ state :ternary do
209
+ rule %r/:/ do
210
+ token Punctuation
211
+ goto :expr_start
212
+ end
213
+
214
+ mixin :root
215
+ end
216
+
217
+ state :str_double do
218
+ mixin :str_escape
219
+ rule %r/"/, Str::Double, :pop!
220
+ rule %r/[^\\"]+/, Str::Double
221
+ end
222
+
223
+ state :str_single do
224
+ mixin :str_escape
225
+ rule %r/'/, Str::Single, :pop!
226
+ rule %r/\$\$/, Str::Single
227
+ rule %r/\$#{id}/, Str::Interpol
228
+ rule %r/\$\{/, Str::Interpol, :str_interpol
229
+ rule %r/[^\\$']+/, Str::Single
230
+ end
231
+
232
+ state :str_escape do
233
+ rule %r/\\[\\tnr'"]/, Str::Escape
234
+ rule %r/\\[0-7]{3}/, Str::Escape
235
+ rule %r/\\x\h{2}/, Str::Escape
236
+ rule %r/\\u\h{4}/, Str::Escape
237
+ rule %r/\\u\{\h{1,6}\}/, Str::Escape
238
+ end
239
+
240
+ state :str_interpol do
241
+ rule %r/\}/, Str::Interpol, :pop!
242
+ mixin :root
243
+ end
244
+ end
245
+ end
246
+ end