rouge 3.27.0 → 3.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -1
  3. data/lib/rouge/demos/brainfuck +1 -1
  4. data/lib/rouge/demos/brightscript +1 -1
  5. data/lib/rouge/demos/bsl +1 -1
  6. data/lib/rouge/demos/cfscript +1 -1
  7. data/lib/rouge/demos/coq +1 -1
  8. data/lib/rouge/demos/csvs +1 -1
  9. data/lib/rouge/demos/datastudio +0 -1
  10. data/lib/rouge/demos/ecl +0 -1
  11. data/lib/rouge/demos/erlang +1 -1
  12. data/lib/rouge/demos/fluent +13 -0
  13. data/lib/rouge/demos/fsharp +1 -1
  14. data/lib/rouge/demos/glsl +1 -1
  15. data/lib/rouge/demos/haxe +0 -1
  16. data/lib/rouge/demos/idris +13 -0
  17. data/lib/rouge/demos/lean +8 -0
  18. data/lib/rouge/demos/nesasm +1 -1
  19. data/lib/rouge/demos/opentype_feature_file +0 -1
  20. data/lib/rouge/demos/plsql +2 -0
  21. data/lib/rouge/demos/smarty +0 -1
  22. data/lib/rouge/demos/stan +13 -0
  23. data/lib/rouge/demos/stata +14 -0
  24. data/lib/rouge/demos/syzlang +15 -0
  25. data/lib/rouge/demos/syzprog +8 -0
  26. data/lib/rouge/formatters/html_inline.rb +0 -1
  27. data/lib/rouge/lexer.rb +2 -2
  28. data/lib/rouge/lexers/apache/keywords.rb +1 -1
  29. data/lib/rouge/lexers/c.rb +12 -2
  30. data/lib/rouge/lexers/console.rb +1 -1
  31. data/lib/rouge/lexers/cpp.rb +6 -4
  32. data/lib/rouge/lexers/cypher.rb +8 -0
  33. data/lib/rouge/lexers/dart.rb +8 -8
  34. data/lib/rouge/lexers/docker.rb +4 -0
  35. data/lib/rouge/lexers/eiffel.rb +0 -1
  36. data/lib/rouge/lexers/fluent.rb +74 -0
  37. data/lib/rouge/lexers/gherkin/keywords.rb +1 -1
  38. data/lib/rouge/lexers/handlebars.rb +1 -1
  39. data/lib/rouge/lexers/hcl.rb +1 -0
  40. data/lib/rouge/lexers/hylang.rb +0 -1
  41. data/lib/rouge/lexers/idris.rb +210 -0
  42. data/lib/rouge/lexers/jsx.rb +1 -2
  43. data/lib/rouge/lexers/kotlin.rb +3 -1
  44. data/lib/rouge/lexers/lasso/keywords.rb +1 -1
  45. data/lib/rouge/lexers/lean.rb +164 -0
  46. data/lib/rouge/lexers/llvm/keywords.rb +1 -1
  47. data/lib/rouge/lexers/lua/keywords.rb +1 -1
  48. data/lib/rouge/lexers/mathematica/keywords.rb +1 -1
  49. data/lib/rouge/lexers/matlab/keywords.rb +1 -1
  50. data/lib/rouge/lexers/matlab.rb +3 -2
  51. data/lib/rouge/lexers/ocl.rb +0 -1
  52. data/lib/rouge/lexers/php/keywords.rb +1 -1
  53. data/lib/rouge/lexers/plsql.rb +578 -0
  54. data/lib/rouge/lexers/prometheus.rb +0 -1
  55. data/lib/rouge/lexers/python.rb +3 -1
  56. data/lib/rouge/lexers/q.rb +0 -1
  57. data/lib/rouge/lexers/rust.rb +9 -5
  58. data/lib/rouge/lexers/sparql.rb +5 -4
  59. data/lib/rouge/lexers/sqf/keywords.rb +1 -1
  60. data/lib/rouge/lexers/stan.rb +451 -0
  61. data/lib/rouge/lexers/stata.rb +165 -0
  62. data/lib/rouge/lexers/supercollider.rb +0 -1
  63. data/lib/rouge/lexers/syzlang.rb +317 -0
  64. data/lib/rouge/lexers/syzprog.rb +122 -0
  65. data/lib/rouge/lexers/tap.rb +0 -1
  66. data/lib/rouge/lexers/toml.rb +8 -6
  67. data/lib/rouge/lexers/tsx.rb +0 -1
  68. data/lib/rouge/lexers/tulip.rb +0 -1
  69. data/lib/rouge/lexers/viml/keywords.rb +1 -1
  70. data/lib/rouge/version.rb +1 -1
  71. metadata +19 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 396c335066b8bb01574b5d81b25d43a98b58dd1bad1d3d9588b7a35c573e2209
4
- data.tar.gz: d899fb3968d38a1a93415c21c62e332f1a8ba230952c0a33adda5c4755c4c8f3
3
+ metadata.gz: 15e78361e4f2dde8ae802ffcd36cc0b1e8e9124c2bbe0d3182a767244047a9e0
4
+ data.tar.gz: 661838ffd5b8c6ff8ac894312293aa6c46b36abed76ccc8f0932358e6478c8b1
5
5
  SHA512:
6
- metadata.gz: c1fed00ea4906f18e1939675dff9c02508cddef4b1878622422d66b3cbee6d07111ab434cb83314d5d3077f3b86375424d4af05f2fce46cb105a9ecef698aec9
7
- data.tar.gz: 7764c52128ef376d3af7e2c5d1a958a62bddffadc4b2d8c868161fd786a9af63827d143a8b85d6d5251d65f8adefc6a405e2fef5d29e6c7d73bc00f041d8c024
6
+ metadata.gz: 21f210c421a0a0137d57f2c7fd3b3d931a1b481a276e6fe6eb296a5e1572ccb7ffd3912a8455e98c362b863ab52773b27c7d9135e2cddaa7b75b5fa324f4036e
7
+ data.tar.gz: 9bb3d495c856a8e790cc38736afb4e187b5b34fa8d1f0c1b99ff60af63cec60a9312ee4a69a642e31938dd4586647e224f311afdde6d343bcafa35b64110f2a3
data/Gemfile CHANGED
@@ -11,7 +11,8 @@ gem 'minitest-power_assert'
11
11
  gem 'power_assert', '~> 1.2'
12
12
 
13
13
  gem 'parallel', '~> 1.13.0' if RUBY_VERSION < '2.2.0'
14
- gem 'rubocop', '~> 0.49.1'
14
+ gem 'rubocop', '~> 1.0', '<= 1.11'
15
+ gem 'rubocop-performance'
15
16
 
16
17
  # don't try to install redcarpet under jruby
17
18
  gem 'redcarpet', :platforms => :ruby
@@ -37,5 +38,8 @@ group :development do
37
38
  else
38
39
  gem 'sinatra'
39
40
  end
41
+
42
+ # Ruby 3 no longer ships with a web server
43
+ gem 'puma' if RUBY_VERSION >= '3'
40
44
  gem 'shotgun'
41
45
  end
@@ -2,4 +2,4 @@
2
2
  This is a sample
3
3
  comment.
4
4
  ]
5
- .[>+<-]>,
5
+ .[>+<-]>,
@@ -3,4 +3,4 @@ function main(args as dynamic) as void
3
3
  'Create a scene and load /components/helloworld.xml'
4
4
  scene = screen.CreateScene("HelloWorld")
5
5
  screen.show()
6
- end function
6
+ end function
data/lib/rouge/demos/bsl CHANGED
@@ -4,4 +4,4 @@
4
4
  Сообщить("Привет мир");
5
5
  КонецПроцедуры
6
6
 
7
- #КонецОбласти
7
+ #КонецОбласти
@@ -15,4 +15,4 @@ component accessors="true" {
15
15
 
16
16
  return foo;
17
17
  }
18
- }
18
+ }
data/lib/rouge/demos/coq CHANGED
@@ -10,4 +10,4 @@ Section with_T.
10
10
  end.
11
11
  End with_T.
12
12
 
13
- Definition a_string := "hello \" world".
13
+ Definition a_string := "hello \" world".
data/lib/rouge/demos/csvs CHANGED
@@ -5,4 +5,4 @@ Transaction_Date: xDate
5
5
  Transaction_ID: notEmpty
6
6
  Originator_Name: notEmpty
7
7
  Originator_Address: any("yes","no")
8
- Originator_Country: notEmpty
8
+ Originator_Country: notEmpty
@@ -18,4 +18,3 @@ select * from TABLE1 where COL1 like %VAR1%; //utiliser la variable VAR1 dans un
18
18
 
19
19
  select * from TEST_TABLE; //exécution d'une requête Select pour ramener des valeurs
20
20
  Affect_LastColumns("TEST1"); //création du paramètre TEST1
21
-
data/lib/rouge/demos/ecl CHANGED
@@ -15,4 +15,3 @@ somePeople := allPeople(LastName = 'Smith');
15
15
 
16
16
  // Outputs ---
17
17
  somePeople;
18
-
@@ -4,4 +4,4 @@
4
4
 
5
5
  %% Compute rectangle and circle area.
6
6
  area({rectangle, Width, Ht}) -> Width * Ht;
7
- area({circle, R}) -> 3.14159 * R * R.
7
+ area({circle, R}) -> 3.14159 * R * R.
@@ -0,0 +1,13 @@
1
+ # Simple things are simple.
2
+ hello-user = Hello, {$userName}!
3
+
4
+ # Complex things are possible.
5
+ shared-photos =
6
+ {$userName} {$photoCount ->
7
+ [one] added a new photo
8
+ *[other] added {$photoCount} new photos
9
+ } to {$userGender ->
10
+ [male] his stream
11
+ [female] her stream
12
+ *[other] their stream
13
+ }.
@@ -9,4 +9,4 @@ let rec existsLeaf test tree =
9
9
  || existsLeaf test right
10
10
 
11
11
  let hasEvenLeaf tree =
12
- existsLeaf (fun n -> n % 2 = 0) tree
12
+ existsLeaf (fun n -> n % 2 = 0) tree
data/lib/rouge/demos/glsl CHANGED
@@ -11,4 +11,4 @@ void main()
11
11
  {
12
12
  vertexColor = color;
13
13
  gl_Position = vec4(position, 0.0, 1.0);
14
- }
14
+ }
data/lib/rouge/demos/haxe CHANGED
@@ -2,4 +2,3 @@
2
2
  public static function hello(arg : String) {
3
3
  return 'Hello $arg';
4
4
  }
5
-
@@ -0,0 +1,13 @@
1
+ import Data.Vect
2
+
3
+ insert : Ord elem =>
4
+ (x : elem) -> (xsSorted : Vect len elem) -> Vect (S len) elem
5
+ insert x [] = [x]
6
+ insert x (y :: xs) = case x < y of
7
+ True => x :: y :: xs
8
+ False => y :: insert x xs
9
+
10
+ insSort : Ord elem => Vect n elem -> Vect n elem
11
+ insSort [] = []
12
+ insSort (x :: xs) = let xsSorted = insSort xs in
13
+ insert x xsSorted
@@ -0,0 +1,8 @@
1
+ open nat
2
+
3
+ def add : nat → nat → nat
4
+ | m zero := m
5
+ | m (succ n) := succ (add m n)
6
+
7
+ -- encode definition as an axiom
8
+ axiom add_zero (n : nat) : n + 0 = n
@@ -8,4 +8,4 @@ Reset:
8
8
  lda #$3f ; $3F -> A register
9
9
  ldy #$00 ; $00 -> Y register
10
10
  sta PPU_ADDR ; write #HIGH byte first
11
- sty PPU_ADDR ; $3F00 -> PPU address
11
+ sty PPU_ADDR ; $3F00 -> PPU address
@@ -3,4 +3,3 @@ languagesystem DFLT dflt;
3
3
  feature liga {
4
4
  sub f i by f_i;
5
5
  } liga;
6
-
@@ -0,0 +1,2 @@
1
+ SELECT q'{a quoted string}' AS s, TO_CHAR(SYSDATE,'MM/DD/YYYY') AS "Current Date" FROM DUAL
2
+ WHERE 1=1;
@@ -9,4 +9,3 @@
9
9
  </ul>
10
10
 
11
11
  <div class="{if $foo}class1{else}class2{/if}">{$foo.bar.baz}</div>
12
-
@@ -0,0 +1,13 @@
1
+ data {
2
+ int<lower=0> N;
3
+ vector[N] x;
4
+ vector[N] y;
5
+ }
6
+ parameters {
7
+ real alpha;
8
+ real beta;
9
+ real<lower=0> sigma;
10
+ }
11
+ model {
12
+ y ~ normal(alpha + beta * x, sigma);
13
+ }
@@ -0,0 +1,14 @@
1
+ * Run a series of linear regressions
2
+ sysuse auto, clear
3
+ foreach v of varlist mpg weight-turn {
4
+ regress price `v', robust
5
+ }
6
+
7
+ regress price i.foreign
8
+ local num_obs = e(N)
9
+ global myglobal = 4
10
+
11
+ * Generate and manipulate variables
12
+ generate newvar1 = "string"
13
+ generate newvar2 = 34 - `num_obs'
14
+ replace newvar2 = $myglobal
@@ -0,0 +1,15 @@
1
+ include <linux/test.h>
2
+
3
+ resource fd_test[fd]
4
+
5
+ openat$test(fd const[AT_FDCWD], file ptr[in, string["/dev/test"]], flags flags[open_flags], mode const[0]) fd_test
6
+
7
+ ioctl$TEST(fd fd_test, cmd const[TEST], arg ptr[in, test])
8
+
9
+ test {
10
+ number int32
11
+ size len[data, int32]
12
+ data array[int8]
13
+ }
14
+
15
+ _ = TEST
@@ -0,0 +1,8 @@
1
+ # Source: https://github.com/google/syzkaller/blob/master/sys/linux/test/vusb_hid
2
+
3
+ r0 = syz_usb_connect$hid(0x0, 0x36, &(0x7f0000000040)=ANY=[@ANYBLOB="12010000000018105e04da07000000000001090224000100000000090400000903000000092100000001222200090581030800000000"], 0x0)
4
+ syz_usb_control_io$hid(r0, 0x0, 0x0)
5
+ syz_usb_control_io$hid(r0, &(0x7f00000001c0)={0x24, 0x0, 0x0, &(0x7f0000000000)={0x0, 0x22, 0x22, {[@global=@item_012={0x2, 0x1, 0x9, "2313"}, @global=@item_012={0x2, 0x1, 0x0, "e53f"}, @global=@item_4={0x3, 0x1, 0x0, '\f\x00'}, @local=@item_012={0x2, 0x2, 0x2, "9000"}, @global=@item_4={0x3, 0x1, 0x0, "0900be00"}, @main=@item_4={0x3, 0x0, 0x8, '\x00'}, @local=@item_4={0x3, 0x2, 0x0, "09007a15"}, @local=@item_4={0x3, 0x2, 0x0, "5d8c3dda"}]}}, 0x0}, 0x0)
6
+ syz_usb_ep_write(r0, 0x81, 0x7, &(0x7f0000000000)='BBBBBBB')
7
+ syz_usb_ep_write(r0, 0x81, 0x7, &(0x7f0000000000)='BBBBBBB')
8
+ syz_usb_ep_write(r0, 0x81, 0x7, &(0x7f0000000000)='BBBBBBB')
@@ -28,4 +28,3 @@ module Rouge
28
28
  end
29
29
  end
30
30
  end
31
-
data/lib/rouge/lexer.rb CHANGED
@@ -293,8 +293,8 @@ module Rouge
293
293
 
294
294
  # @private
295
295
  def assert_utf8!(str)
296
- encoding = str.encoding.name
297
- return if encoding == 'US-ASCII' || encoding == 'UTF-8' || encoding == 'ASCII-8BIT'
296
+ encoding = str.encoding
297
+ return if encoding == Encoding::US_ASCII || encoding == Encoding::UTF_8 || encoding == Encoding::BINARY
298
298
 
299
299
  raise EncodingError.new(
300
300
  "Bad encoding: #{str.encoding.names.join(',')}. " +
@@ -21,4 +21,4 @@ module Rouge
21
21
  end
22
22
  end
23
23
  end
24
- end
24
+ end
@@ -170,12 +170,22 @@ module Rouge
170
170
  end
171
171
 
172
172
  state :macro do
173
- # NB: pop! goes back to :bol
174
- rule %r/\n/, Comment::Preproc, :pop!
173
+ mixin :include
175
174
  rule %r([^/\n\\]+), Comment::Preproc
176
175
  rule %r/\\./m, Comment::Preproc
177
176
  mixin :inline_whitespace
178
177
  rule %r(/), Comment::Preproc
178
+ # NB: pop! goes back to :bol
179
+ rule %r/\n/, Comment::Preproc, :pop!
180
+ end
181
+
182
+ state :include do
183
+ rule %r/(include)(\s*)(<[^>]+>)([^\n]*)/ do
184
+ groups Comment::Preproc, Text, Comment::PreprocFile, Comment::Single
185
+ end
186
+ rule %r/(include)(\s*)("[^"]+")([^\n]*)/ do
187
+ groups Comment::Preproc, Text, Comment::PreprocFile, Comment::Single
188
+ end
179
189
  end
180
190
 
181
191
  state :if_0 do
@@ -103,7 +103,7 @@ module Rouge
103
103
  end
104
104
 
105
105
  def line_regex
106
- /(\\.|[^\\])*?(\n|$)/m
106
+ /(.*?)(\n|$)/
107
107
  end
108
108
 
109
109
  def output_lexer
@@ -22,12 +22,14 @@ module Rouge
22
22
 
23
23
  def self.keywords
24
24
  @keywords ||= super + Set.new(%w(
25
- asm auto catch const_cast delete dynamic_cast explicit export friend
25
+ asm auto catch char8_t concept
26
+ consteval constexpr constinit const_cast co_await co_return co_yield
27
+ delete dynamic_cast explicit export friend
26
28
  mutable namespace new operator private protected public
27
- reinterpret_cast restrict size_of static_cast this throw throws
29
+ reinterpret_cast requires restrict size_of static_cast this throw throws
28
30
  typeid typename using virtual final override
29
31
 
30
- alignas alignof constexpr decltype noexcept static_assert
32
+ alignas alignof decltype noexcept static_assert
31
33
  thread_local try
32
34
  ))
33
35
  end
@@ -68,7 +70,7 @@ module Rouge
68
70
  rule %r/#{dq}[lu]*/i, Num::Integer
69
71
  rule %r/\bnullptr\b/, Name::Builtin
70
72
  rule %r/(?:u8|u|U|L)?R"([a-zA-Z0-9_{}\[\]#<>%:;.?*\+\-\/\^&|~!=,"']{,16})\(.*?\)\1"/m, Str
71
- rule %r/::/, Operator
73
+ rule %r/(::|<=>)/, Operator
72
74
  end
73
75
 
74
76
  state :classname do
@@ -45,6 +45,7 @@ module Rouge
45
45
  state :root do
46
46
  rule %r/[\s]+/, Text
47
47
  rule %r(//.*?$), Comment::Single
48
+ rule %r(/\*), Comment::Multiline, :multiline_comments
48
49
 
49
50
  rule %r([*+\-<>=&|~%^]), Operator
50
51
  rule %r/[{}),;\[\]]/, Str::Symbol
@@ -103,6 +104,13 @@ module Rouge
103
104
  rule %r/'(\\\\|\\'|[^'])*'/, Str::Single
104
105
  rule %r/`(\\\\|\\`|[^`])*`/, Str::Backtick
105
106
  end
107
+
108
+ state :multiline_comments do
109
+ rule %r(/[*]), Comment::Multiline, :multiline_comments
110
+ rule %r([*]/), Comment::Multiline, :pop!
111
+ rule %r([^/*]+), Comment::Multiline
112
+ rule %r([/*]), Comment::Multiline
113
+ end
106
114
  end
107
115
  end
108
116
  end
@@ -5,25 +5,25 @@ module Rouge
5
5
  module Lexers
6
6
  class Dart < RegexLexer
7
7
  title "Dart"
8
- desc "The Dart programming language (dartlang.com)"
8
+ desc "The Dart programming language (dart.dev)"
9
9
 
10
10
  tag 'dart'
11
11
  filenames '*.dart'
12
12
  mimetypes 'text/x-dart'
13
13
 
14
14
  keywords = %w(
15
- as assert break case catch continue default do else finally for
16
- if in is new rethrow return super switch this throw try while with
15
+ as assert await break case catch continue default do else finally for
16
+ if in is new rethrow return super switch this throw try while with yield
17
17
  )
18
18
 
19
19
  declarations = %w(
20
- abstract dynamic const external extends factory final get implements
21
- native operator set static typedef var
20
+ abstract async dynamic const covariant external extends factory final get
21
+ implements late native on operator required set static sync typedef var
22
22
  )
23
23
 
24
- types = %w(bool double Dynamic enum int num Object Set String void)
24
+ types = %w(bool Comparable double Dynamic enum Function int List Map Never Null num Object Pattern Set String Symbol Type Uri void)
25
25
 
26
- imports = %w(import export library part\s*of part source)
26
+ imports = %w(import deferred export library part\s*of part source)
27
27
 
28
28
  id = /[a-zA-Z_]\w*/
29
29
 
@@ -53,7 +53,7 @@ module Rouge
53
53
  rule %r/(?:#{declarations.join('|')})\b/, Keyword::Declaration
54
54
  rule %r/(?:#{types.join('|')})\b/, Keyword::Type
55
55
  rule %r/(?:true|false|null)\b/, Keyword::Constant
56
- rule %r/(?:class|interface)\b/, Keyword::Declaration, :class
56
+ rule %r/(?:class|interface|mixin)\b/, Keyword::Declaration, :class
57
57
  rule %r/(?:#{imports.join('|')})\b/, Keyword::Namespace, :import
58
58
  rule %r/(\.)(#{id})/ do
59
59
  groups Operator, Name::Attribute
@@ -20,6 +20,10 @@ module Rouge
20
20
  state :root do
21
21
  rule %r/\s+/, Text
22
22
 
23
+ rule %r/^(FROM)(\s+)(.*)(\s+)(AS)(\s+)(.*)/io do
24
+ groups Keyword, Text::Whitespace, Str, Text::Whitespace, Keyword, Text::Whitespace, Str
25
+ end
26
+
23
27
  rule %r/^(ONBUILD)(\s+)(#{KEYWORDS})(.*)/io do
24
28
  groups Keyword, Text::Whitespace, Keyword, Str
25
29
  end
@@ -63,4 +63,3 @@ module Rouge
63
63
  end
64
64
  end
65
65
  end
66
-
@@ -0,0 +1,74 @@
1
+ # -*- coding: utf-8 -*- #
2
+ # frozen_string_literal: true
3
+
4
+ module Rouge
5
+ module Lexers
6
+ class Fluent < RegexLexer
7
+ title 'Fluent'
8
+ desc 'Fluent localization files'
9
+ tag 'fluent'
10
+ aliases 'ftl'
11
+ filenames '*.ftl'
12
+
13
+ state :root do
14
+ rule %r{( *)(\=)( *)} do
15
+ groups Text::Whitespace, Punctuation, Text::Whitespace
16
+ push :template
17
+ end
18
+
19
+ rule %r{(?:\s*\n)+}m, Text::Whitespace
20
+ rule %r{\#{1,3}(?: .*)?$}, Comment::Single
21
+ rule %r{[a-zA-Z][a-zA-Z0-9_-]*}, Name::Constant
22
+ rule %r{\-[a-zA-Z][a-zA-Z0-9_-]*}, Name::Entity
23
+ rule %r{\s*\.[a-zA-Z][a-zA-Z0-9_-]*}, Name::Attribute
24
+ rule %r{\s+(?=[^\s\.])}, Text::Whitespace, :template
25
+ end
26
+
27
+ state :template do
28
+ rule %r{\n}m, Text::Whitespace, :pop!
29
+ rule %r{[^\{\n\}\*]+}, Text
30
+ rule %r{\{}, Punctuation, :placeable
31
+ rule %r{(?=\})}, Punctuation, :pop!
32
+ end
33
+
34
+ state :placeable do
35
+ rule %r{\s+}m, Text::Whitespace
36
+ rule %r{\{}, Punctuation, :placeable
37
+ rule %r{\}}, Punctuation, :pop!
38
+ rule %r{\$[a-zA-Z][a-zA-Z0-9_-]*}, Name::Variable
39
+ rule %r{\-[a-zA-Z][a-zA-Z0-9_-]*}, Name::Entity
40
+ rule %r{\.[a-zA-Z][a-zA-Z0-9_-]*}, Name::Attribute
41
+ rule %r{[A-Z]+}, Name::Builtin
42
+ rule %r{[a-zA-Z][a-zA-Z0-9_-]*}, Name::Constant
43
+ rule %r{[\(\),\:]}, Punctuation
44
+ rule %r{->}, Punctuation
45
+ rule %r{\*}, Punctuation::Indicator
46
+ rule %r{\-?\d+\.\d+?}, Literal::Number::Float
47
+ rule %r{\-?\d+}, Literal::Number::Integer
48
+ rule %r{"}, Str::Double, :string
49
+
50
+ rule %r{(\[)(\-?\d+\.\d+)(\])} do
51
+ groups Punctuation, Literal::Number::Float, Punctuation
52
+ push :template
53
+ end
54
+
55
+ rule %r{(\[)(\-?\d+)(\])} do
56
+ groups Punctuation, Literal::Number::Integer, Punctuation
57
+ push :template
58
+ end
59
+
60
+ rule %r{(\[)([a-zA-Z][a-zA-Z0-9_-]+)(\])} do
61
+ groups Punctuation, Str::Symbol, Punctuation
62
+ push :template
63
+ end
64
+ end
65
+
66
+ state :string do
67
+ rule %r{\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{6}}, Str::Escape
68
+ rule %r{\\.}, Str::Escape
69
+ rule %r{[^\"\\]}, Str::Double
70
+ rule %r{"}, Str::Double, :pop!
71
+ end
72
+ end
73
+ end
74
+ end
@@ -16,4 +16,4 @@ module Rouge
16
16
  end
17
17
  end
18
18
  end
19
- end
19
+ end
@@ -88,4 +88,4 @@ module Rouge
88
88
  end
89
89
  end
90
90
  end
91
- end
91
+ end
@@ -5,6 +5,7 @@ module Rouge
5
5
  module Lexers
6
6
  class Hcl < RegexLexer
7
7
  tag 'hcl'
8
+ filenames '*.hcl', '*.nomad'
8
9
 
9
10
  title 'Hashicorp Configuration Language'
10
11
  desc 'Hashicorp Configuration Language, used by Terraform and other Hashicorp tools'
@@ -91,4 +91,3 @@ module Rouge
91
91
  end
92
92
  end
93
93
  end
94
-