rouge 3.2.0 → 3.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +17 -3
- data/bin/rougify +1 -0
- data/lib/rouge.rb +67 -43
- data/lib/rouge/cli.rb +84 -17
- data/lib/rouge/demos/ada +26 -0
- data/lib/rouge/demos/apex +9 -0
- data/lib/rouge/demos/armasm +12 -0
- data/lib/rouge/demos/batchfile +3 -0
- data/lib/rouge/demos/bbcbasic +6 -0
- data/lib/rouge/demos/bpf +7 -0
- data/lib/rouge/demos/brainfuck +5 -0
- data/lib/rouge/demos/clean +6 -0
- data/lib/rouge/demos/cmhg +8 -0
- data/lib/rouge/demos/csvs +8 -0
- data/lib/rouge/demos/cuda +11 -0
- data/lib/rouge/demos/cypher +5 -0
- data/lib/rouge/demos/cython +6 -0
- data/lib/rouge/demos/datastudio +21 -0
- data/lib/rouge/demos/ecl +18 -0
- data/lib/rouge/demos/eex +1 -0
- data/lib/rouge/demos/epp +4 -0
- data/lib/rouge/demos/escape +3 -0
- data/lib/rouge/demos/freefem +16 -0
- data/lib/rouge/demos/gdscript +18 -0
- data/lib/rouge/demos/ghc-cmm +23 -0
- data/lib/rouge/demos/ghc-core +26 -0
- data/lib/rouge/demos/haxe +5 -0
- data/lib/rouge/demos/hocon +8 -0
- data/lib/rouge/demos/hql +5 -0
- data/lib/rouge/demos/isbl +4 -0
- data/lib/rouge/demos/jsl +3 -0
- data/lib/rouge/demos/jsp +29 -0
- data/lib/rouge/demos/liquid +0 -1
- data/lib/rouge/demos/lustre +6 -0
- data/lib/rouge/demos/lutin +18 -0
- data/lib/rouge/demos/m68k +16 -0
- data/lib/rouge/demos/magik +6 -0
- data/lib/rouge/demos/mason +22 -0
- data/lib/rouge/demos/mathematica +8 -0
- data/lib/rouge/demos/minizinc +23 -0
- data/lib/rouge/demos/msgtrans +4 -0
- data/lib/rouge/demos/nasm +6 -6
- data/lib/rouge/demos/nesasm +11 -0
- data/lib/rouge/demos/objective_cpp +17 -0
- data/lib/rouge/demos/openedge +4 -0
- data/lib/rouge/demos/opentype_feature_file +6 -0
- data/lib/rouge/demos/plist +1 -132
- data/lib/rouge/demos/powershell +12 -48
- data/lib/rouge/demos/q +6 -0
- data/lib/rouge/demos/reasonml +12 -0
- data/lib/rouge/demos/rego +8 -0
- data/lib/rouge/demos/robot_framework +27 -0
- data/lib/rouge/demos/sas +13 -0
- data/lib/rouge/demos/slice +10 -0
- data/lib/rouge/demos/solidity +13 -0
- data/lib/rouge/demos/sparql +6 -0
- data/lib/rouge/demos/sqf +14 -0
- data/lib/rouge/demos/supercollider +11 -0
- data/lib/rouge/demos/terraform +0 -15
- data/lib/rouge/demos/ttcn3 +6 -0
- data/lib/rouge/demos/vcl +12 -0
- data/lib/rouge/demos/xojo +14 -0
- data/lib/rouge/demos/xpath +2 -0
- data/lib/rouge/demos/xquery +22 -0
- data/lib/rouge/demos/yang +17 -0
- data/lib/rouge/formatter.rb +39 -2
- data/lib/rouge/formatters/html.rb +21 -2
- data/lib/rouge/formatters/html_inline.rb +1 -0
- data/lib/rouge/formatters/html_legacy.rb +1 -0
- data/lib/rouge/formatters/html_line_table.rb +53 -0
- data/lib/rouge/formatters/html_linewise.rb +7 -11
- data/lib/rouge/formatters/html_pygments.rb +2 -0
- data/lib/rouge/formatters/html_table.rb +21 -31
- data/lib/rouge/formatters/null.rb +1 -0
- data/lib/rouge/formatters/terminal256.rb +23 -5
- data/lib/rouge/formatters/terminal_truecolor.rb +37 -0
- data/lib/rouge/formatters/tex.rb +92 -0
- data/lib/rouge/guesser.rb +2 -0
- data/lib/rouge/guessers/disambiguation.rb +35 -0
- data/lib/rouge/guessers/filename.rb +2 -0
- data/lib/rouge/guessers/glob_mapping.rb +3 -1
- data/lib/rouge/guessers/mimetype.rb +2 -0
- data/lib/rouge/guessers/modeline.rb +3 -1
- data/lib/rouge/guessers/source.rb +3 -1
- data/lib/rouge/guessers/util.rb +2 -0
- data/lib/rouge/lexer.rb +71 -15
- data/lib/rouge/lexers/abap.rb +13 -11
- data/lib/rouge/lexers/actionscript.rb +35 -34
- data/lib/rouge/lexers/ada.rb +162 -0
- data/lib/rouge/lexers/apache.rb +13 -15
- data/lib/rouge/lexers/apache/keywords.rb +15 -0
- data/lib/rouge/lexers/apex.rb +126 -0
- data/lib/rouge/lexers/apiblueprint.rb +2 -0
- data/lib/rouge/lexers/apple_script.rb +17 -14
- data/lib/rouge/lexers/armasm.rb +145 -0
- data/lib/rouge/lexers/awk.rb +26 -25
- data/lib/rouge/lexers/batchfile.rb +164 -0
- data/lib/rouge/lexers/bbcbasic.rb +112 -0
- data/lib/rouge/lexers/biml.rb +6 -4
- data/lib/rouge/lexers/bpf.rb +118 -0
- data/lib/rouge/lexers/brainfuck.rb +53 -0
- data/lib/rouge/lexers/bsl.rb +13 -12
- data/lib/rouge/lexers/c.rb +35 -57
- data/lib/rouge/lexers/ceylon.rb +7 -34
- data/lib/rouge/lexers/cfscript.rb +27 -26
- data/lib/rouge/lexers/clean.rb +156 -0
- data/lib/rouge/lexers/clojure.rb +15 -14
- data/lib/rouge/lexers/cmake.rb +16 -14
- data/lib/rouge/lexers/cmhg.rb +34 -0
- data/lib/rouge/lexers/coffeescript.rb +90 -49
- data/lib/rouge/lexers/common_lisp.rb +39 -38
- data/lib/rouge/lexers/conf.rb +7 -6
- data/lib/rouge/lexers/console.rb +92 -38
- data/lib/rouge/lexers/coq.rb +27 -23
- data/lib/rouge/lexers/cpp.rb +24 -13
- data/lib/rouge/lexers/crystal.rb +71 -70
- data/lib/rouge/lexers/csharp.rb +29 -29
- data/lib/rouge/lexers/css.rb +24 -23
- data/lib/rouge/lexers/csvs.rb +44 -0
- data/lib/rouge/lexers/cuda.rb +35 -0
- data/lib/rouge/lexers/cypher.rb +108 -0
- data/lib/rouge/lexers/cython.rb +151 -0
- data/lib/rouge/lexers/d.rb +64 -63
- data/lib/rouge/lexers/dart.rb +34 -33
- data/lib/rouge/lexers/datastudio.rb +138 -0
- data/lib/rouge/lexers/diff.rb +10 -4
- data/lib/rouge/lexers/digdag.rb +3 -1
- data/lib/rouge/lexers/docker.rb +12 -11
- data/lib/rouge/lexers/dot.rb +19 -18
- data/lib/rouge/lexers/ecl.rb +175 -0
- data/lib/rouge/lexers/eex.rb +52 -0
- data/lib/rouge/lexers/eiffel.rb +21 -20
- data/lib/rouge/lexers/elixir.rb +52 -36
- data/lib/rouge/lexers/elm.rb +30 -29
- data/lib/rouge/lexers/epp.rb +51 -0
- data/lib/rouge/lexers/erb.rb +5 -4
- data/lib/rouge/lexers/erlang.rb +1 -0
- data/lib/rouge/lexers/escape.rb +58 -0
- data/lib/rouge/lexers/factor.rb +41 -40
- data/lib/rouge/lexers/fortran.rb +34 -32
- data/lib/rouge/lexers/freefem.rb +240 -0
- data/lib/rouge/lexers/fsharp.rb +33 -31
- data/lib/rouge/lexers/gdscript.rb +171 -0
- data/lib/rouge/lexers/ghc_cmm.rb +340 -0
- data/lib/rouge/lexers/ghc_core.rb +151 -0
- data/lib/rouge/lexers/gherkin.rb +17 -14
- data/lib/rouge/lexers/gherkin/keywords.rb +2 -0
- data/lib/rouge/lexers/glsl.rb +2 -5
- data/lib/rouge/lexers/go.rb +3 -2
- data/lib/rouge/lexers/gradle.rb +1 -0
- data/lib/rouge/lexers/graphql.rb +78 -60
- data/lib/rouge/lexers/groovy.rb +24 -25
- data/lib/rouge/lexers/hack.rb +2 -1
- data/lib/rouge/lexers/haml.rb +26 -29
- data/lib/rouge/lexers/handlebars.rb +32 -20
- data/lib/rouge/lexers/haskell.rb +67 -65
- data/lib/rouge/lexers/haxe.rb +246 -0
- data/lib/rouge/lexers/hcl.rb +26 -25
- data/lib/rouge/lexers/hocon.rb +86 -0
- data/lib/rouge/lexers/hql.rb +139 -0
- data/lib/rouge/lexers/html.rb +33 -31
- data/lib/rouge/lexers/http.rb +10 -9
- data/lib/rouge/lexers/hylang.rb +15 -14
- data/lib/rouge/lexers/idlang.rb +34 -32
- data/lib/rouge/lexers/igorpro.rb +32 -31
- data/lib/rouge/lexers/ini.rb +13 -12
- data/lib/rouge/lexers/io.rb +10 -9
- data/lib/rouge/lexers/irb.rb +6 -5
- data/lib/rouge/lexers/isbl.rb +97 -0
- data/lib/rouge/lexers/isbl/builtins.rb +17 -0
- data/lib/rouge/lexers/java.rb +29 -25
- data/lib/rouge/lexers/javascript.rb +58 -61
- data/lib/rouge/lexers/jinja.rb +39 -22
- data/lib/rouge/lexers/jsl.rb +55 -0
- data/lib/rouge/lexers/json.rb +54 -11
- data/lib/rouge/lexers/json_doc.rb +8 -5
- data/lib/rouge/lexers/jsonnet.rb +19 -18
- data/lib/rouge/lexers/jsp.rb +120 -0
- data/lib/rouge/lexers/jsx.rb +18 -16
- data/lib/rouge/lexers/julia.rb +182 -58
- data/lib/rouge/lexers/kotlin.rb +78 -26
- data/lib/rouge/lexers/lasso.rb +54 -58
- data/lib/rouge/lexers/lasso/keywords.rb +14 -0
- data/lib/rouge/lexers/liquid.rb +116 -118
- data/lib/rouge/lexers/literate_coffeescript.rb +3 -2
- data/lib/rouge/lexers/literate_haskell.rb +6 -5
- data/lib/rouge/lexers/llvm.rb +66 -49
- data/lib/rouge/lexers/lua.rb +43 -4
- data/lib/rouge/lexers/lua/builtins.rb +2 -0
- data/lib/rouge/lexers/lustre.rb +79 -0
- data/lib/rouge/lexers/lutin.rb +33 -0
- data/lib/rouge/lexers/m68k.rb +143 -0
- data/lib/rouge/lexers/magik.rb +127 -0
- data/lib/rouge/lexers/make.rb +57 -34
- data/lib/rouge/lexers/markdown.rb +67 -39
- data/lib/rouge/lexers/mason.rb +110 -0
- data/lib/rouge/lexers/mathematica.rb +96 -0
- data/lib/rouge/lexers/mathematica/builtins.rb +13 -0
- data/lib/rouge/lexers/matlab.rb +26 -17
- data/lib/rouge/lexers/matlab/builtins.rb +4 -4
- data/lib/rouge/lexers/minizinc.rb +87 -0
- data/lib/rouge/lexers/moonscript.rb +4 -3
- data/lib/rouge/lexers/mosel.rb +64 -63
- data/lib/rouge/lexers/msgtrans.rb +26 -0
- data/lib/rouge/lexers/mxml.rb +19 -18
- data/lib/rouge/lexers/nasm.rb +43 -169
- data/lib/rouge/lexers/nesasm.rb +78 -0
- data/lib/rouge/lexers/nginx.rb +15 -14
- data/lib/rouge/lexers/nim.rb +4 -2
- data/lib/rouge/lexers/nix.rb +44 -43
- data/lib/rouge/lexers/objective_c.rb +5 -178
- data/lib/rouge/lexers/objective_c/common.rb +184 -0
- data/lib/rouge/lexers/objective_cpp.rb +31 -0
- data/lib/rouge/lexers/ocaml.rb +29 -64
- data/lib/rouge/lexers/ocaml/common.rb +53 -0
- data/lib/rouge/lexers/openedge.rb +429 -0
- data/lib/rouge/lexers/opentype_feature_file.rb +113 -0
- data/lib/rouge/lexers/pascal.rb +6 -5
- data/lib/rouge/lexers/perl.rb +102 -67
- data/lib/rouge/lexers/php.rb +91 -53
- data/lib/rouge/lexers/php/builtins.rb +183 -174
- data/lib/rouge/lexers/plain_text.rb +2 -1
- data/lib/rouge/lexers/plist.rb +16 -14
- data/lib/rouge/lexers/pony.rb +21 -20
- data/lib/rouge/lexers/powershell.rb +190 -638
- data/lib/rouge/lexers/praat.rb +76 -75
- data/lib/rouge/lexers/prolog.rb +27 -19
- data/lib/rouge/lexers/prometheus.rb +32 -30
- data/lib/rouge/lexers/properties.rb +13 -12
- data/lib/rouge/lexers/protobuf.rb +23 -22
- data/lib/rouge/lexers/puppet.rb +33 -32
- data/lib/rouge/lexers/python.rb +124 -99
- data/lib/rouge/lexers/q.rb +17 -14
- data/lib/rouge/lexers/qml.rb +13 -12
- data/lib/rouge/lexers/r.rb +13 -13
- data/lib/rouge/lexers/racket.rb +47 -22
- data/lib/rouge/lexers/reasonml.rb +65 -0
- data/lib/rouge/lexers/rego.rb +45 -0
- data/lib/rouge/lexers/robot_framework.rb +249 -0
- data/lib/rouge/lexers/ruby.rb +88 -71
- data/lib/rouge/lexers/rust.rb +45 -44
- data/lib/rouge/lexers/sas.rb +563 -0
- data/lib/rouge/lexers/sass.rb +9 -8
- data/lib/rouge/lexers/sass/common.rb +41 -40
- data/lib/rouge/lexers/scala.rb +67 -40
- data/lib/rouge/lexers/scheme.rb +19 -18
- data/lib/rouge/lexers/scss.rb +4 -3
- data/lib/rouge/lexers/sed.rb +31 -30
- data/lib/rouge/lexers/shell.rb +67 -55
- data/lib/rouge/lexers/sieve.rb +10 -9
- data/lib/rouge/lexers/slice.rb +32 -0
- data/lib/rouge/lexers/slim.rb +27 -26
- data/lib/rouge/lexers/smalltalk.rb +34 -33
- data/lib/rouge/lexers/smarty.rb +20 -19
- data/lib/rouge/lexers/sml.rb +68 -67
- data/lib/rouge/lexers/solidity.rb +185 -0
- data/lib/rouge/lexers/sparql.rb +129 -0
- data/lib/rouge/lexers/sqf.rb +109 -0
- data/lib/rouge/lexers/sqf/commands.rb +15 -0
- data/lib/rouge/lexers/sql.rb +47 -26
- data/lib/rouge/lexers/supercollider.rb +116 -0
- data/lib/rouge/lexers/swift.rb +49 -44
- data/lib/rouge/lexers/tap.rb +22 -20
- data/lib/rouge/lexers/tcl.rb +28 -27
- data/lib/rouge/lexers/terraform.rb +37 -13
- data/lib/rouge/lexers/tex.rb +20 -19
- data/lib/rouge/lexers/toml.rb +59 -20
- data/lib/rouge/lexers/tsx.rb +1 -0
- data/lib/rouge/lexers/ttcn3.rb +119 -0
- data/lib/rouge/lexers/tulip.rb +38 -36
- data/lib/rouge/lexers/turtle.rb +36 -38
- data/lib/rouge/lexers/twig.rb +1 -0
- data/lib/rouge/lexers/typescript.rb +12 -0
- data/lib/rouge/lexers/typescript/common.rb +1 -0
- data/lib/rouge/lexers/vala.rb +19 -18
- data/lib/rouge/lexers/varnish.rb +168 -0
- data/lib/rouge/lexers/vb.rb +28 -27
- data/lib/rouge/lexers/verilog.rb +27 -28
- data/lib/rouge/lexers/vhdl.rb +12 -11
- data/lib/rouge/lexers/viml.rb +15 -14
- data/lib/rouge/lexers/viml/keywords.rb +2 -0
- data/lib/rouge/lexers/vue.rb +15 -10
- data/lib/rouge/lexers/wollok.rb +27 -26
- data/lib/rouge/lexers/xml.rb +18 -21
- data/lib/rouge/lexers/xojo.rb +61 -0
- data/lib/rouge/lexers/xpath.rb +332 -0
- data/lib/rouge/lexers/xquery.rb +145 -0
- data/lib/rouge/lexers/yaml.rb +64 -61
- data/lib/rouge/lexers/yang.rb +147 -0
- data/lib/rouge/plugins/redcarpet.rb +9 -2
- data/lib/rouge/regex_lexer.rb +27 -25
- data/lib/rouge/template_lexer.rb +1 -0
- data/lib/rouge/tex_theme_renderer.rb +132 -0
- data/lib/rouge/text_analyzer.rb +1 -0
- data/lib/rouge/theme.rb +5 -0
- data/lib/rouge/themes/base16.rb +1 -0
- data/lib/rouge/themes/bw.rb +41 -0
- data/lib/rouge/themes/colorful.rb +1 -0
- data/lib/rouge/themes/github.rb +1 -0
- data/lib/rouge/themes/gruvbox.rb +1 -0
- data/lib/rouge/themes/igor_pro.rb +1 -0
- data/lib/rouge/themes/magritte.rb +78 -0
- data/lib/rouge/themes/molokai.rb +1 -0
- data/lib/rouge/themes/monokai.rb +1 -0
- data/lib/rouge/themes/monokai_sublime.rb +4 -1
- data/lib/rouge/themes/pastie.rb +2 -1
- data/lib/rouge/themes/thankful_eyes.rb +2 -1
- data/lib/rouge/themes/tulip.rb +2 -1
- data/lib/rouge/token.rb +31 -22
- data/lib/rouge/util.rb +3 -2
- data/lib/rouge/version.rb +2 -1
- data/rouge.gemspec +6 -3
- metadata +130 -8
- data/lib/rouge/lexers/apache/keywords.yml +0 -764
- data/lib/rouge/lexers/lasso/keywords.yml +0 -446
data/lib/rouge/lexers/slim.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Rouge
|
4
5
|
module Lexers
|
@@ -44,22 +45,22 @@ module Rouge
|
|
44
45
|
start { ruby.reset!; html.reset! }
|
45
46
|
|
46
47
|
state :root do
|
47
|
-
rule /\s*\n/, Text
|
48
|
+
rule %r/\s*\n/, Text
|
48
49
|
rule(/\s*/) { |m| token Text; indentation(m[0]) }
|
49
50
|
end
|
50
51
|
|
51
52
|
state :content do
|
52
53
|
mixin :css
|
53
54
|
|
54
|
-
rule /\/#{dot}*/, Comment, :indented_block
|
55
|
+
rule %r/\/#{dot}*/, Comment, :indented_block
|
55
56
|
|
56
|
-
rule /(doctype)(\s+)(.*)/ do
|
57
|
+
rule %r/(doctype)(\s+)(.*)/ do
|
57
58
|
groups Name::Namespace, Text::Whitespace, Text
|
58
59
|
pop!
|
59
60
|
end
|
60
61
|
|
61
62
|
# filters, shamelessly ripped from HAML
|
62
|
-
rule /(\w*):\s*\n/ do |m|
|
63
|
+
rule %r/(\w*):\s*\n/ do |m|
|
63
64
|
token Name::Decorator
|
64
65
|
pop!
|
65
66
|
starts_block :filter_block
|
@@ -80,29 +81,29 @@ module Rouge
|
|
80
81
|
goto :plain_block
|
81
82
|
end
|
82
83
|
|
83
|
-
rule /-|==|=/, Punctuation, :ruby_line
|
84
|
+
rule %r/-|==|=/, Punctuation, :ruby_line
|
84
85
|
|
85
86
|
# Dynamic tags
|
86
|
-
rule /(\*)(#{ruby_chars}+\(.*?\))/ do |m|
|
87
|
+
rule %r/(\*)(#{ruby_chars}+\(.*?\))/ do |m|
|
87
88
|
token Punctuation, m[1]
|
88
89
|
delegate ruby, m[2]
|
89
90
|
push :tag
|
90
91
|
end
|
91
92
|
|
92
|
-
rule /(\*)(#{ruby_chars}+)/ do |m|
|
93
|
+
rule %r/(\*)(#{ruby_chars}+)/ do |m|
|
93
94
|
token Punctuation, m[1]
|
94
95
|
delegate ruby, m[2]
|
95
96
|
push :tag
|
96
97
|
end
|
97
98
|
|
98
|
-
#rule /<\w+(?=.*>)/, Keyword::Constant, :tag # Maybe do this, look ahead and stuff
|
99
|
+
#rule %r/<\w+(?=.*>)/, Keyword::Constant, :tag # Maybe do this, look ahead and stuff
|
99
100
|
rule %r((</?[\w\s\=\'\"]+?/?>)) do |m| # Dirty html
|
100
101
|
delegate html, m[1]
|
101
102
|
pop!
|
102
103
|
end
|
103
104
|
|
104
105
|
# Ordinary slim tags
|
105
|
-
rule /\w+/, Name::Tag, :tag
|
106
|
+
rule %r/\w+/, Name::Tag, :tag
|
106
107
|
|
107
108
|
end
|
108
109
|
|
@@ -112,24 +113,24 @@ module Rouge
|
|
112
113
|
mixin :interpolation
|
113
114
|
|
114
115
|
# Whitespace control
|
115
|
-
rule /[<>]/, Punctuation
|
116
|
+
rule %r/[<>]/, Punctuation
|
116
117
|
|
117
118
|
# Trim whitespace
|
118
|
-
rule /\s+?/, Text::Whitespace
|
119
|
+
rule %r/\s+?/, Text::Whitespace
|
119
120
|
|
120
121
|
# Splats, these two might be mergable?
|
121
|
-
rule /(\*)(#{ruby_chars}+)/ do |m|
|
122
|
+
rule %r/(\*)(#{ruby_chars}+)/ do |m|
|
122
123
|
token Punctuation, m[1]
|
123
124
|
delegate ruby, m[2]
|
124
125
|
end
|
125
126
|
|
126
|
-
rule /(\*)(\{#{dot}+?\})/ do |m|
|
127
|
+
rule %r/(\*)(\{#{dot}+?\})/ do |m|
|
127
128
|
token Punctuation, m[1]
|
128
129
|
delegate ruby, m[2]
|
129
130
|
end
|
130
131
|
|
131
132
|
# Attributes
|
132
|
-
rule /([\w\-]+)(\s*)(\=)/ do |m|
|
133
|
+
rule %r/([\w\-]+)(\s*)(\=)/ do |m|
|
133
134
|
token Name::Attribute, m[1]
|
134
135
|
token Text::Whitespace, m[2]
|
135
136
|
token Punctuation, m[3]
|
@@ -137,7 +138,7 @@ module Rouge
|
|
137
138
|
end
|
138
139
|
|
139
140
|
# Ruby value
|
140
|
-
rule /(\=)(#{dot}+)/ do |m|
|
141
|
+
rule %r/(\=)(#{dot}+)/ do |m|
|
141
142
|
token Punctuation, m[1]
|
142
143
|
#token Keyword::Constant, m[2]
|
143
144
|
delegate ruby, m[2]
|
@@ -146,9 +147,9 @@ module Rouge
|
|
146
147
|
# HTML Entities
|
147
148
|
rule(/&\S*?;/, Name::Entity)
|
148
149
|
|
149
|
-
rule /#{dot}+?/, Text
|
150
|
+
rule %r/#{dot}+?/, Text
|
150
151
|
|
151
|
-
rule /\s*\n/, Text::Whitespace, :pop!
|
152
|
+
rule %r/\s*\n/, Text::Whitespace, :pop!
|
152
153
|
end
|
153
154
|
|
154
155
|
state :css do
|
@@ -164,20 +165,20 @@ module Rouge
|
|
164
165
|
rule(/(#{ruby_chars}+\(.*?\))/) { |m| delegate ruby, m[1]; pop! }
|
165
166
|
rule(/(#{ruby_chars}+)/) { |m| delegate ruby, m[1]; pop! }
|
166
167
|
|
167
|
-
rule /\s+/, Text::Whitespace
|
168
|
+
rule %r/\s+/, Text::Whitespace
|
168
169
|
end
|
169
170
|
|
170
171
|
state :ruby_line do
|
171
172
|
# Need at top
|
172
173
|
mixin :indented_block
|
173
174
|
|
174
|
-
rule(
|
175
|
-
rule /[ ]\|[ \t]*\n/, Str::Escape
|
176
|
-
rule(/.*?(?=(
|
175
|
+
rule(/[,\\]\s*\n/) { delegate ruby }
|
176
|
+
rule %r/[ ]\|[ \t]*\n/, Str::Escape
|
177
|
+
rule(/.*?(?=([,\\]$| \|)?[ \t]*$)/) { delegate ruby }
|
177
178
|
end
|
178
179
|
|
179
180
|
state :filter_block do
|
180
|
-
rule /([^#\n]|#[^{\n]|(\\\\)*\\#\{)+/ do
|
181
|
+
rule %r/([^#\n]|#[^{\n]|(\\\\)*\\#\{)+/ do
|
181
182
|
if @filter_lexer
|
182
183
|
delegate @filter_lexer
|
183
184
|
else
|
@@ -199,18 +200,18 @@ module Rouge
|
|
199
200
|
# HTML Entities
|
200
201
|
rule(/&\S*?;/, Name::Entity)
|
201
202
|
|
202
|
-
#rule /([^#\n]|#[^{\n]|(\\\\)*\\#\{)+/ do
|
203
|
-
rule /#{dot}+?/, Text
|
203
|
+
#rule %r/([^#\n]|#[^{\n]|(\\\\)*\\#\{)+/ do
|
204
|
+
rule %r/#{dot}+?/, Text
|
204
205
|
|
205
206
|
mixin :indented_block
|
206
207
|
end
|
207
208
|
|
208
209
|
state :interpolation do
|
209
|
-
rule /#[{]/, Str::Interpol, :ruby_interp
|
210
|
+
rule %r/#[{]/, Str::Interpol, :ruby_interp
|
210
211
|
end
|
211
212
|
|
212
213
|
state :ruby_interp do
|
213
|
-
rule /[}]/, Str::Interpol, :pop!
|
214
|
+
rule %r/[}]/, Str::Interpol, :pop!
|
214
215
|
mixin :ruby_interp_inner
|
215
216
|
end
|
216
217
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Rouge
|
4
5
|
module Lexers
|
@@ -14,29 +15,29 @@ module Rouge
|
|
14
15
|
ops = %r([-+*/\\~<>=|&!?,@%])
|
15
16
|
|
16
17
|
state :root do
|
17
|
-
rule /(<)(\w+:)(.*?)(>)/ do
|
18
|
+
rule %r/(<)(\w+:)(.*?)(>)/ do
|
18
19
|
groups Punctuation, Keyword, Text, Punctuation
|
19
20
|
end
|
20
21
|
|
21
22
|
# mixin :squeak_fileout
|
22
23
|
mixin :whitespaces
|
23
24
|
mixin :method_definition
|
24
|
-
rule /([|])([\w\s]*)([|])/ do
|
25
|
+
rule %r/([|])([\w\s]*)([|])/ do
|
25
26
|
groups Punctuation, Name::Variable, Punctuation
|
26
27
|
end
|
27
28
|
mixin :objects
|
28
|
-
rule /\^|:=|_/, Operator
|
29
|
+
rule %r/\^|:=|_/, Operator
|
29
30
|
|
30
|
-
rule /[)}\]]/, Punctuation, :after_object
|
31
|
-
rule /[({\[!]/, Punctuation
|
31
|
+
rule %r/[)}\]]/, Punctuation, :after_object
|
32
|
+
rule %r/[({\[!]/, Punctuation
|
32
33
|
end
|
33
34
|
|
34
35
|
state :method_definition do
|
35
|
-
rule /([a-z]\w*:)(\s*)(\w+)/i do
|
36
|
+
rule %r/([a-z]\w*:)(\s*)(\w+)/i do
|
36
37
|
groups Name::Function, Text, Name::Variable
|
37
38
|
end
|
38
39
|
|
39
|
-
rule /^(\s*)(\b[a-z]\w*\b)(\s*)$/i do
|
40
|
+
rule %r/^(\s*)(\b[a-z]\w*\b)(\s*)$/i do
|
40
41
|
groups Text, Name::Function, Text
|
41
42
|
end
|
42
43
|
|
@@ -47,27 +48,27 @@ module Rouge
|
|
47
48
|
|
48
49
|
state :block_variables do
|
49
50
|
mixin :whitespaces
|
50
|
-
rule /(:)(\s*)(\w+)/ do
|
51
|
+
rule %r/(:)(\s*)(\w+)/ do
|
51
52
|
groups Operator, Text, Name::Variable
|
52
53
|
end
|
53
54
|
|
54
|
-
rule /[|]/, Punctuation, :pop!
|
55
|
+
rule %r/[|]/, Punctuation, :pop!
|
55
56
|
|
56
57
|
rule(//) { pop! }
|
57
58
|
end
|
58
59
|
|
59
60
|
state :literals do
|
60
|
-
rule /'(''|.)*?'/m, Str, :after_object
|
61
|
-
rule /[$]./, Str::Char, :after_object
|
62
|
-
rule /#[(]/, Str::Symbol, :parenth
|
63
|
-
rule /(\d+r)?-?\d+(\.\d+)?(e-?\d+)?/,
|
61
|
+
rule %r/'(''|.)*?'/m, Str, :after_object
|
62
|
+
rule %r/[$]./, Str::Char, :after_object
|
63
|
+
rule %r/#[(]/, Str::Symbol, :parenth
|
64
|
+
rule %r/(\d+r)?-?\d+(\.\d+)?(e-?\d+)?/,
|
64
65
|
Num, :after_object
|
65
|
-
rule /#("[^"]*"|#{ops}+|[\w:]+)/,
|
66
|
+
rule %r/#("[^"]*"|#{ops}+|[\w:]+)/,
|
66
67
|
Str::Symbol, :after_object
|
67
68
|
end
|
68
69
|
|
69
70
|
state :parenth do
|
70
|
-
rule /[)]/ do
|
71
|
+
rule %r/[)]/ do
|
71
72
|
token Str::Symbol
|
72
73
|
goto :after_object
|
73
74
|
end
|
@@ -76,39 +77,39 @@ module Rouge
|
|
76
77
|
end
|
77
78
|
|
78
79
|
state :inner_parenth do
|
79
|
-
rule /#[(]/, Str::Symbol, :inner_parenth
|
80
|
-
rule /[)]/, Str::Symbol, :pop!
|
80
|
+
rule %r/#[(]/, Str::Symbol, :inner_parenth
|
81
|
+
rule %r/[)]/, Str::Symbol, :pop!
|
81
82
|
mixin :whitespaces
|
82
83
|
mixin :literals
|
83
|
-
rule /(#{ops}|[\w:])+/, Str::Symbol
|
84
|
+
rule %r/(#{ops}|[\w:])+/, Str::Symbol
|
84
85
|
end
|
85
86
|
|
86
87
|
state :whitespaces do
|
87
|
-
rule /! !$/, Keyword # squeak chunk delimiter
|
88
|
-
rule /\s+/m, Text
|
89
|
-
rule /".*?"/m, Comment
|
88
|
+
rule %r/! !$/, Keyword # squeak chunk delimiter
|
89
|
+
rule %r/\s+/m, Text
|
90
|
+
rule %r/".*?"/m, Comment
|
90
91
|
end
|
91
92
|
|
92
93
|
state :objects do
|
93
|
-
rule /\[/, Punctuation, :block_variables
|
94
|
-
rule /(self|super|true|false|nil|thisContext)\b/,
|
94
|
+
rule %r/\[/, Punctuation, :block_variables
|
95
|
+
rule %r/(self|super|true|false|nil|thisContext)\b/,
|
95
96
|
Name::Builtin::Pseudo, :after_object
|
96
|
-
rule /[A-Z]\w*(?!:)\b/, Name::Class, :after_object
|
97
|
-
rule /[a-z]\w*(?!:)\b/, Name::Variable, :after_object
|
97
|
+
rule %r/[A-Z]\w*(?!:)\b/, Name::Class, :after_object
|
98
|
+
rule %r/[a-z]\w*(?!:)\b/, Name::Variable, :after_object
|
98
99
|
mixin :literals
|
99
100
|
end
|
100
101
|
|
101
102
|
state :after_object do
|
102
103
|
mixin :whitespaces
|
103
|
-
rule /(ifTrue|ifFalse|whileTrue|whileFalse|timesRepeat):/,
|
104
|
+
rule %r/(ifTrue|ifFalse|whileTrue|whileFalse|timesRepeat):/,
|
104
105
|
Name::Builtin, :pop!
|
105
|
-
rule /new(?!:)\b/, Name::Builtin
|
106
|
-
rule /:=|_/, Operator, :pop!
|
107
|
-
rule /[a-z]+\w*:/i, Name::Function, :pop!
|
108
|
-
rule /[a-z]+\w*/i, Name::Function
|
109
|
-
rule /#{ops}+/, Name::Function, :pop!
|
110
|
-
rule /[.]/, Punctuation, :pop!
|
111
|
-
rule /;/, Punctuation
|
106
|
+
rule %r/new(?!:)\b/, Name::Builtin
|
107
|
+
rule %r/:=|_/, Operator, :pop!
|
108
|
+
rule %r/[a-z]+\w*:/i, Name::Function, :pop!
|
109
|
+
rule %r/[a-z]+\w*/i, Name::Function
|
110
|
+
rule %r/#{ops}+/, Name::Function, :pop!
|
111
|
+
rule %r/[.]/, Punctuation, :pop!
|
112
|
+
rule %r/;/, Punctuation
|
112
113
|
rule(//) { pop! }
|
113
114
|
end
|
114
115
|
end
|
data/lib/rouge/lexers/smarty.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Rouge
|
4
5
|
module Lexers
|
@@ -32,9 +33,9 @@ module Rouge
|
|
32
33
|
rule(/\{\s+/) { delegate parent }
|
33
34
|
|
34
35
|
# block comments
|
35
|
-
rule /\{\*.*?\*\}/m, Comment
|
36
|
+
rule %r/\{\*.*?\*\}/m, Comment
|
36
37
|
|
37
|
-
rule /\{\/?(?![\s*])/ do
|
38
|
+
rule %r/\{\/?(?![\s*])/ do
|
38
39
|
token Keyword
|
39
40
|
push :smarty
|
40
41
|
end
|
@@ -52,29 +53,29 @@ module Rouge
|
|
52
53
|
|
53
54
|
state :smarty do
|
54
55
|
# allow nested tags
|
55
|
-
rule /\{\/?(?![\s*])/ do
|
56
|
+
rule %r/\{\/?(?![\s*])/ do
|
56
57
|
token Keyword
|
57
58
|
push :smarty
|
58
59
|
end
|
59
60
|
|
60
|
-
rule /}/, Keyword, :pop!
|
61
|
-
rule /\s+/m, Text
|
61
|
+
rule %r/}/, Keyword, :pop!
|
62
|
+
rule %r/\s+/m, Text
|
62
63
|
rule %r([~!%^&*()+=|\[\]:;,.<>/@?-]), Operator
|
63
|
-
rule /#[a-zA-Z_]\w*#/, Name::Variable
|
64
|
-
rule /\$[a-zA-Z_]\w*(\.\w+)*/, Name::Variable
|
65
|
-
rule /(true|false|null)\b/, Keyword::Constant
|
66
|
-
|
67
|
-
|
68
|
-
rule /'(\\.|.)*?'/, Str::Single
|
69
|
-
rule /([a-zA-Z_]\w*)/ do |m|
|
70
|
-
if self.class.builtins.include? m[0]
|
71
|
-
token Name::Builtin
|
72
|
-
else
|
73
|
-
token Name::Attribute
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
64
|
+
rule %r/#[a-zA-Z_]\w*#/, Name::Variable
|
65
|
+
rule %r/\$[a-zA-Z_]\w*(\.\w+)*/, Name::Variable
|
66
|
+
rule %r/(true|false|null)\b/, Keyword::Constant
|
67
|
+
rule %r/[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?/, Num
|
68
|
+
rule %r/"(\\.|.)*?"/, Str::Double
|
69
|
+
rule %r/'(\\.|.)*?'/, Str::Single
|
77
70
|
|
71
|
+
rule %r/([a-zA-Z_]\w*)/ do |m|
|
72
|
+
if self.class.builtins.include? m[0]
|
73
|
+
token Name::Builtin
|
74
|
+
else
|
75
|
+
token Name::Attribute
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
78
79
|
end
|
79
80
|
end
|
80
81
|
end
|
data/lib/rouge/lexers/sml.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Rouge
|
4
5
|
module Lexers
|
@@ -29,25 +30,25 @@ module Rouge
|
|
29
30
|
symbol = %r([!%&$#/:<=>?@\\~`^|*+-]+)
|
30
31
|
|
31
32
|
state :whitespace do
|
32
|
-
rule /\s+/m, Text
|
33
|
-
rule /[(][*]/, Comment, :comment
|
33
|
+
rule %r/\s+/m, Text
|
34
|
+
rule %r/[(][*]/, Comment, :comment
|
34
35
|
end
|
35
36
|
|
36
37
|
state :delimiters do
|
37
|
-
rule /[(\[{]/, Punctuation, :main
|
38
|
-
rule /[)\]}]/, Punctuation, :pop!
|
38
|
+
rule %r/[(\[{]/, Punctuation, :main
|
39
|
+
rule %r/[)\]}]/, Punctuation, :pop!
|
39
40
|
|
40
|
-
rule /\b(let|if|local)\b(?!')/ do
|
41
|
+
rule %r/\b(let|if|local)\b(?!')/ do
|
41
42
|
token Keyword::Reserved
|
42
43
|
push; push
|
43
44
|
end
|
44
45
|
|
45
|
-
rule /\b(struct|sig|while)\b(?!')/ do
|
46
|
+
rule %r/\b(struct|sig|while)\b(?!')/ do
|
46
47
|
token Keyword::Reserved
|
47
48
|
push
|
48
49
|
end
|
49
50
|
|
50
|
-
rule /\b(do|else|end|in|then)\b(?!')/, Keyword::Reserved, :pop!
|
51
|
+
rule %r/\b(do|else|end|in|then)\b(?!')/, Keyword::Reserved, :pop!
|
51
52
|
end
|
52
53
|
|
53
54
|
def token_for_id_with_dot(id)
|
@@ -77,28 +78,28 @@ module Rouge
|
|
77
78
|
end
|
78
79
|
|
79
80
|
state :core do
|
80
|
-
rule /[()\[\]{},;_]|[.][.][.]/, Punctuation
|
81
|
-
rule /#"/, Str::Char, :char
|
82
|
-
rule /"/, Str::Double, :string
|
83
|
-
rule /~?0x[0-9a-fA-F]+/, Num::Hex
|
84
|
-
rule /0wx[0-9a-fA-F]+/, Num::Hex
|
85
|
-
rule /0w\d+/, Num::Integer
|
86
|
-
rule /~?\d+([.]\d+)?[eE]~?\d+/, Num::Float
|
87
|
-
rule /~?\d+[.]\d+/, Num::Float
|
88
|
-
rule /~?\d+/, Num::Integer
|
89
|
-
|
90
|
-
rule /#\s*[1-9][0-9]*/, Name::Label
|
91
|
-
rule /#\s*#{id}/, Name::Label
|
92
|
-
rule /#\s+#{symbol}/, Name::Label
|
93
|
-
|
94
|
-
rule /\b(datatype|abstype)\b(?!')/, Keyword::Reserved, :dname
|
81
|
+
rule %r/[()\[\]{},;_]|[.][.][.]/, Punctuation
|
82
|
+
rule %r/#"/, Str::Char, :char
|
83
|
+
rule %r/"/, Str::Double, :string
|
84
|
+
rule %r/~?0x[0-9a-fA-F]+/, Num::Hex
|
85
|
+
rule %r/0wx[0-9a-fA-F]+/, Num::Hex
|
86
|
+
rule %r/0w\d+/, Num::Integer
|
87
|
+
rule %r/~?\d+([.]\d+)?[eE]~?\d+/, Num::Float
|
88
|
+
rule %r/~?\d+[.]\d+/, Num::Float
|
89
|
+
rule %r/~?\d+/, Num::Integer
|
90
|
+
|
91
|
+
rule %r/#\s*[1-9][0-9]*/, Name::Label
|
92
|
+
rule %r/#\s*#{id}/, Name::Label
|
93
|
+
rule %r/#\s+#{symbol}/, Name::Label
|
94
|
+
|
95
|
+
rule %r/\b(datatype|abstype)\b(?!')/, Keyword::Reserved, :dname
|
95
96
|
rule(/(?=\bexception\b(?!'))/) { push :ename }
|
96
|
-
rule /\b(functor|include|open|signature|structure)\b(?!')/,
|
97
|
+
rule %r/\b(functor|include|open|signature|structure)\b(?!')/,
|
97
98
|
Keyword::Reserved, :sname
|
98
|
-
rule /\b(type|eqtype)\b(?!')/, Keyword::Reserved, :tname
|
99
|
+
rule %r/\b(type|eqtype)\b(?!')/, Keyword::Reserved, :tname
|
99
100
|
|
100
|
-
rule /'#{id}/, Name::Decorator
|
101
|
-
rule /(#{id})([.])/ do |m|
|
101
|
+
rule %r/'#{id}/, Name::Decorator
|
102
|
+
rule %r/(#{id})([.])/ do |m|
|
102
103
|
groups(token_for_id_with_dot(m[1]), Punctuation)
|
103
104
|
push :dotted
|
104
105
|
end
|
@@ -113,7 +114,7 @@ module Rouge
|
|
113
114
|
end
|
114
115
|
|
115
116
|
state :dotted do
|
116
|
-
rule /(#{id})([.])/ do |m|
|
117
|
+
rule %r/(#{id})([.])/ do |m|
|
117
118
|
groups(token_for_id_with_dot(m[1]), Punctuation)
|
118
119
|
end
|
119
120
|
|
@@ -129,15 +130,15 @@ module Rouge
|
|
129
130
|
end
|
130
131
|
|
131
132
|
state :root do
|
132
|
-
rule /#!.*?\n/, Comment::Preproc
|
133
|
+
rule %r/#!.*?\n/, Comment::Preproc
|
133
134
|
rule(//) { push :main }
|
134
135
|
end
|
135
136
|
|
136
137
|
state :main do
|
137
138
|
mixin :whitespace
|
138
139
|
|
139
|
-
rule /\b(val|and)\b(?!')/, Keyword::Reserved, :vname
|
140
|
-
rule /\b(fun)\b(?!')/ do
|
140
|
+
rule %r/\b(val|and)\b(?!')/, Keyword::Reserved, :vname
|
141
|
+
rule %r/\b(fun)\b(?!')/ do
|
141
142
|
token Keyword::Reserved
|
142
143
|
goto :main_fun
|
143
144
|
push :fname
|
@@ -149,15 +150,15 @@ module Rouge
|
|
149
150
|
|
150
151
|
state :main_fun do
|
151
152
|
mixin :whitespace
|
152
|
-
rule /\b(fun|and)\b(?!')/, Keyword::Reserved, :fname
|
153
|
-
rule /\bval\b(?!')/ do
|
153
|
+
rule %r/\b(fun|and)\b(?!')/, Keyword::Reserved, :fname
|
154
|
+
rule %r/\bval\b(?!')/ do
|
154
155
|
token Keyword::Reserved
|
155
156
|
goto :main
|
156
157
|
push :vname
|
157
158
|
end
|
158
159
|
|
159
|
-
rule /[|]/, Punctuation, :fname
|
160
|
-
rule /\b(case|handle)\b(?!')/ do
|
160
|
+
rule %r/[|]/, Punctuation, :fname
|
161
|
+
rule %r/\b(case|handle)\b(?!')/ do
|
161
162
|
token Keyword::Reserved
|
162
163
|
goto :main
|
163
164
|
end
|
@@ -167,27 +168,27 @@ module Rouge
|
|
167
168
|
end
|
168
169
|
|
169
170
|
state :has_escapes do
|
170
|
-
rule /\\[\\"abtnvfr]/, Str::Escape
|
171
|
-
rule /\\\^[\x40-\x5e]/, Str::Escape
|
172
|
-
rule /\\[0-9]{3}/, Str::Escape
|
173
|
-
rule /\\u\h{4}/, Str::Escape
|
174
|
-
rule /\\\s+\\/, Str::Interpol
|
171
|
+
rule %r/\\[\\"abtnvfr]/, Str::Escape
|
172
|
+
rule %r/\\\^[\x40-\x5e]/, Str::Escape
|
173
|
+
rule %r/\\[0-9]{3}/, Str::Escape
|
174
|
+
rule %r/\\u\h{4}/, Str::Escape
|
175
|
+
rule %r/\\\s+\\/, Str::Interpol
|
175
176
|
end
|
176
177
|
|
177
178
|
state :string do
|
178
|
-
rule /[^"\\]+/, Str::Double
|
179
|
-
rule /"/, Str::Double, :pop!
|
179
|
+
rule %r/[^"\\]+/, Str::Double
|
180
|
+
rule %r/"/, Str::Double, :pop!
|
180
181
|
mixin :has_escapes
|
181
182
|
end
|
182
183
|
|
183
184
|
state :char do
|
184
|
-
rule /[^"\\]+/, Str::Char
|
185
|
-
rule /"/, Str::Char, :pop!
|
185
|
+
rule %r/[^"\\]+/, Str::Char
|
186
|
+
rule %r/"/, Str::Char, :pop!
|
186
187
|
mixin :has_escapes
|
187
188
|
end
|
188
189
|
|
189
190
|
state :breakout do
|
190
|
-
rule /(?=\b(#{SML.keywords.to_a.join('|')})\b(?!'))/ do
|
191
|
+
rule %r/(?=\b(#{SML.keywords.to_a.join('|')})\b(?!'))/ do
|
191
192
|
pop!
|
192
193
|
end
|
193
194
|
end
|
@@ -200,8 +201,8 @@ module Rouge
|
|
200
201
|
end
|
201
202
|
|
202
203
|
state :has_annotations do
|
203
|
-
rule /'[\w']*/, Name::Decorator
|
204
|
-
rule /[(]/, Punctuation, :tyvarseq
|
204
|
+
rule %r/'[\w']*/, Name::Decorator
|
205
|
+
rule %r/[(]/, Punctuation, :tyvarseq
|
205
206
|
end
|
206
207
|
|
207
208
|
state :fname do
|
@@ -216,12 +217,12 @@ module Rouge
|
|
216
217
|
mixin :whitespace
|
217
218
|
mixin :has_annotations
|
218
219
|
|
219
|
-
rule /(#{id})(\s*)(=(?!#{symbol}))/m do
|
220
|
+
rule %r/(#{id})(\s*)(=(?!#{symbol}))/m do
|
220
221
|
groups Name::Variable, Text, Punctuation
|
221
222
|
pop!
|
222
223
|
end
|
223
224
|
|
224
|
-
rule /(#{symbol})(\s*)(=(?!#{symbol}))/m do
|
225
|
+
rule %r/(#{symbol})(\s*)(=(?!#{symbol}))/m do
|
225
226
|
groups Name::Variable, Text, Punctuation
|
226
227
|
end
|
227
228
|
|
@@ -236,8 +237,8 @@ module Rouge
|
|
236
237
|
mixin :breakout
|
237
238
|
mixin :has_annotations
|
238
239
|
|
239
|
-
rule /'[\w']*/, Name::Decorator
|
240
|
-
rule /[(]/, Punctuation, :tyvarseq
|
240
|
+
rule %r/'[\w']*/, Name::Decorator
|
241
|
+
rule %r/[(]/, Punctuation, :tyvarseq
|
241
242
|
|
242
243
|
rule %r(=(?!#{symbol})) do
|
243
244
|
token Punctuation
|
@@ -251,7 +252,7 @@ module Rouge
|
|
251
252
|
state :typbind do
|
252
253
|
mixin :whitespace
|
253
254
|
|
254
|
-
rule /\b(and)\b(?!')/ do
|
255
|
+
rule %r/\b(and)\b(?!')/ do
|
255
256
|
token Keyword::Reserved
|
256
257
|
goto :tname
|
257
258
|
end
|
@@ -265,7 +266,7 @@ module Rouge
|
|
265
266
|
mixin :breakout
|
266
267
|
mixin :has_annotations
|
267
268
|
|
268
|
-
rule /(=)(\s*)(datatype)\b/ do
|
269
|
+
rule %r/(=)(\s*)(datatype)\b/ do
|
269
270
|
groups Punctuation, Text, Keyword::Reserved
|
270
271
|
pop!
|
271
272
|
end
|
@@ -282,18 +283,18 @@ module Rouge
|
|
282
283
|
|
283
284
|
state :datbind do
|
284
285
|
mixin :whitespace
|
285
|
-
rule /\b(and)\b(?!')/ do
|
286
|
+
rule %r/\b(and)\b(?!')/ do
|
286
287
|
token Keyword::Reserved; goto :dname
|
287
288
|
end
|
288
|
-
rule /\b(withtype)\b(?!')/ do
|
289
|
+
rule %r/\b(withtype)\b(?!')/ do
|
289
290
|
token Keyword::Reserved; goto :tname
|
290
291
|
end
|
291
|
-
rule /\bof\b(?!')/, Keyword::Reserved
|
292
|
-
rule /([|])(\s*)(#{id})/ do
|
292
|
+
rule %r/\bof\b(?!')/, Keyword::Reserved
|
293
|
+
rule %r/([|])(\s*)(#{id})/ do
|
293
294
|
groups(Punctuation, Text, Name::Class)
|
294
295
|
end
|
295
296
|
|
296
|
-
rule /([|])(\s+)(#{symbol})/ do
|
297
|
+
rule %r/([|])(\s+)(#{symbol})/ do
|
297
298
|
groups(Punctuation, Text, Name::Class)
|
298
299
|
end
|
299
300
|
|
@@ -303,15 +304,15 @@ module Rouge
|
|
303
304
|
|
304
305
|
state :ename do
|
305
306
|
mixin :whitespace
|
306
|
-
rule /(exception|and)(\s+)(#{id})/ do
|
307
|
+
rule %r/(exception|and)(\s+)(#{id})/ do
|
307
308
|
groups Keyword::Reserved, Text, Name::Class
|
308
309
|
end
|
309
310
|
|
310
|
-
rule /(exception|and)(\s*)(#{symbol})/ do
|
311
|
+
rule %r/(exception|and)(\s*)(#{symbol})/ do
|
311
312
|
groups Keyword::Reserved, Text, Name::Class
|
312
313
|
end
|
313
314
|
|
314
|
-
rule /\b(of)\b(?!')/, Keyword::Reserved
|
315
|
+
rule %r/\b(of)\b(?!')/, Keyword::Reserved
|
315
316
|
mixin :breakout
|
316
317
|
mixin :core
|
317
318
|
end
|
@@ -324,20 +325,20 @@ module Rouge
|
|
324
325
|
|
325
326
|
state :tyvarseq do
|
326
327
|
mixin :whitespace
|
327
|
-
rule /'[\w']*/, Name::Decorator
|
328
|
+
rule %r/'[\w']*/, Name::Decorator
|
328
329
|
rule id, Name
|
329
|
-
rule /,/, Punctuation
|
330
|
-
rule /[)]/, Punctuation, :pop!
|
330
|
+
rule %r/,/, Punctuation
|
331
|
+
rule %r/[)]/, Punctuation, :pop!
|
331
332
|
rule symbol, Name
|
332
333
|
end
|
333
334
|
|
334
335
|
state :comment do
|
335
|
-
rule /[^(*)]+/, Comment::Multiline
|
336
|
-
rule /[(][*]/ do
|
336
|
+
rule %r/[^(*)]+/, Comment::Multiline
|
337
|
+
rule %r/[(][*]/ do
|
337
338
|
token Comment::Multiline; push
|
338
339
|
end
|
339
|
-
rule /[*][)]/, Comment::Multiline, :pop!
|
340
|
-
rule /[(*)]/, Comment::Multiline
|
340
|
+
rule %r/[*][)]/, Comment::Multiline, :pop!
|
341
|
+
rule %r/[(*)]/, Comment::Multiline
|
341
342
|
end
|
342
343
|
end
|
343
344
|
end
|