rouge 3.1.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 -42
- data/lib/rouge/cli.rb +87 -18
- 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/crystal +45 -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/hcl +7 -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 +16 -0
- 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 +430 -0
- 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 +36 -34
- 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 +78 -61
- data/lib/rouge/lexers/haxe.rb +246 -0
- data/lib/rouge/lexers/hcl.rb +163 -0
- data/lib/rouge/lexers/hocon.rb +86 -0
- data/lib/rouge/lexers/hql.rb +139 -0
- data/lib/rouge/lexers/html.rb +36 -33
- 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 +481 -225
- 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 +30 -26
- data/lib/rouge/lexers/javascript.rb +59 -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 +192 -74
- data/lib/rouge/lexers/kotlin.rb +79 -27
- 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 +48 -42
- 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 +103 -68
- 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 +50 -45
- data/lib/rouge/lexers/tap.rb +22 -20
- data/lib/rouge/lexers/tcl.rb +28 -27
- data/lib/rouge/lexers/terraform.rb +128 -0
- 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 +13 -12
- data/lib/rouge/lexers/viml.rb +15 -14
- data/lib/rouge/lexers/viml/keywords.rb +2 -0
- data/lib/rouge/lexers/vue.rb +19 -12
- 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 +136 -8
- data/lib/rouge/lexers/apache/keywords.yml +0 -764
- data/lib/rouge/lexers/lasso/keywords.yml +0 -446
data/lib/rouge/lexers/elixir.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
|
@@ -16,66 +17,80 @@ module Rouge
|
|
16
17
|
mimetypes 'text/x-elixir', 'application/x-elixir'
|
17
18
|
|
18
19
|
state :root do
|
19
|
-
rule /\s+/m, Text
|
20
|
-
rule /#.*$/, Comment::Single
|
20
|
+
rule %r/\s+/m, Text
|
21
|
+
rule %r/#.*$/, Comment::Single
|
21
22
|
rule %r{\b(case|cond|end|bc|lc|if|unless|try|loop|receive|fn|defmodule|
|
22
23
|
defp?|defprotocol|defimpl|defrecord|defmacrop?|defdelegate|
|
23
|
-
defexception|exit|raise|throw|after|rescue|catch|else)\b(?![?!])|
|
24
|
+
defexception|defguardp?|defstruct|exit|raise|throw|after|rescue|catch|else)\b(?![?!])|
|
24
25
|
(?<!\.)\b(do|\-\>)\b}x, Keyword
|
25
|
-
rule /\b(import|require|use|recur|quote|unquote|super|refer)\b(?![?!])/, Keyword::Namespace
|
26
|
-
rule /(?<!\.)\b(and|not|or|when|xor|in)\b/, Operator::Word
|
26
|
+
rule %r/\b(import|require|use|recur|quote|unquote|super|refer)\b(?![?!])/, Keyword::Namespace
|
27
|
+
rule %r/(?<!\.)\b(and|not|or|when|xor|in)\b/, Operator::Word
|
27
28
|
rule %r{%=|\*=|\*\*=|\+=|\-=|\^=|\|\|=|
|
28
|
-
<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?=[\s
|
29
|
-
(?<=[\s
|
29
|
+
<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?=[\s])\?|
|
30
|
+
(?<=[\s])!+|&(&&?|(?!\d))|\|\||\^|\*|\+|\-|/|
|
30
31
|
\||\+\+|\-\-|\*\*|\/\/|\<\-|\<\>|<<|>>|=|\.|~~~}x, Operator
|
31
32
|
rule %r{(?<!:)(:)([a-zA-Z_]\w*([?!]|=(?![>=]))?|\<\>|===?|>=?|<=?|
|
32
33
|
<=>|&&?|%\(\)|%\[\]|%\{\}|\+\+?|\-\-?|\|\|?|\!|//|[%&`/\|]|
|
33
34
|
\*\*?|=?~|<\-)|([a-zA-Z_]\w*([?!])?)(:)(?!:)}, Str::Symbol
|
34
|
-
rule /:"/, Str::Symbol, :interpoling_symbol
|
35
|
-
rule /\b(nil|true|false)\b(?![?!])|\b[A-Z]\w*\b/, Name::Constant
|
36
|
-
rule /\b(__(FILE|LINE|MODULE|MAIN|FUNCTION)__)\b(?![?!])/, Name::Builtin::Pseudo
|
37
|
-
rule /[a-zA-Z_!]
|
35
|
+
rule %r/:"/, Str::Symbol, :interpoling_symbol
|
36
|
+
rule %r/\b(nil|true|false)\b(?![?!])|\b[A-Z]\w*\b/, Name::Constant
|
37
|
+
rule %r/\b(__(FILE|LINE|MODULE|MAIN|FUNCTION)__)\b(?![?!])/, Name::Builtin::Pseudo
|
38
|
+
rule %r/[a-zA-Z_!]\w*[!\?]?/, Name
|
38
39
|
rule %r{::|[%(){};,/\|:\\\[\]]}, Punctuation
|
39
|
-
rule /@[a-zA-Z_]\w*|&\d/, Name::Variable
|
40
|
-
rule %r{\b
|
41
|
-
|
40
|
+
rule %r/@[a-zA-Z_]\w*|&\d/, Name::Variable
|
41
|
+
rule %r{\b\d(_?\d)*(\.(?![^\d\s])(_?\d)+)([eE][-+]?\d(_?\d)*)?\b}, Num::Float
|
42
|
+
rule %r{\b0x[0-9A-Fa-f](_?[0-9A-Fa-f])*\b}, Num::Hex
|
43
|
+
rule %r{\b0o[0-7](_?[0-7])*\b}, Num::Oct
|
44
|
+
rule %r{\b0b[01](_?[01])*\b}, Num::Bin
|
45
|
+
rule %r{\b\d(_?\d)*\b}, Num::Integer
|
42
46
|
|
43
47
|
mixin :strings
|
44
48
|
mixin :sigil_strings
|
45
49
|
end
|
46
50
|
|
47
51
|
state :strings do
|
48
|
-
rule /(%[A-Ba-z])?"""(?:.|\n)*?"""/, Str::Doc
|
49
|
-
rule /'''(?:.|\n)*?'''/, Str::Doc
|
50
|
-
rule /"/, Str::
|
51
|
-
rule /'
|
52
|
+
rule %r/(%[A-Ba-z])?"""(?:.|\n)*?"""/, Str::Doc
|
53
|
+
rule %r/'''(?:.|\n)*?'''/, Str::Doc
|
54
|
+
rule %r/"/, Str::Double, :dqs
|
55
|
+
rule %r/'/, Str::Single, :sqs
|
52
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
|
53
|
-
|
54
57
|
end
|
55
58
|
|
56
59
|
state :dqs do
|
57
|
-
|
58
|
-
mixin :
|
60
|
+
mixin :escapes
|
61
|
+
mixin :interpoling
|
62
|
+
rule %r/[^#"\\]+/, Str::Double
|
63
|
+
rule %r/"/, Str::Double, :pop!
|
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
|
59
73
|
end
|
60
74
|
|
61
75
|
state :interpoling do
|
62
|
-
rule /#\{/, Str::Interpol, :interpoling_string
|
76
|
+
rule %r/#\{/, Str::Interpol, :interpoling_string
|
63
77
|
end
|
64
78
|
|
65
79
|
state :interpoling_string do
|
66
|
-
rule /\}/, Str::Interpol, :pop!
|
80
|
+
rule %r/\}/, Str::Interpol, :pop!
|
67
81
|
mixin :root
|
68
82
|
end
|
69
83
|
|
70
|
-
state :
|
71
|
-
rule
|
72
|
-
|
73
|
-
rule
|
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
|
74
88
|
end
|
75
89
|
|
76
|
-
state :
|
90
|
+
state :interpoling_symbol do
|
91
|
+
rule %r/"/, Str::Symbol, :pop!
|
77
92
|
mixin :interpoling
|
78
|
-
rule /[^#"]+/, Str::
|
93
|
+
rule %r/[^#"]+/, Str::Symbol
|
79
94
|
end
|
80
95
|
|
81
96
|
state :sigil_strings do
|
@@ -85,7 +100,7 @@ module Rouge
|
|
85
100
|
delimiter_map = { '{' => '}', '[' => ']', '(' => ')', '<' => '>' }
|
86
101
|
# Match a-z for custom sigils too
|
87
102
|
sigil_opens = Regexp.union(delimiter_map.keys + %w(| / ' "))
|
88
|
-
rule /~([A-Za-z])?(#{sigil_opens})/ do |m|
|
103
|
+
rule %r/~([A-Za-z])?(#{sigil_opens})/ do |m|
|
89
104
|
open = Regexp.escape(m[2])
|
90
105
|
close = Regexp.escape(delimiter_map[m[2]] || m[2])
|
91
106
|
interp = /[SRCW]/ === m[1]
|
@@ -107,26 +122,27 @@ module Rouge
|
|
107
122
|
token toktype
|
108
123
|
|
109
124
|
push do
|
110
|
-
rule /#{close}/, toktype, :pop!
|
125
|
+
rule %r/#{close}/, toktype, :pop!
|
111
126
|
|
112
127
|
if interp
|
113
128
|
mixin :interpoling
|
114
|
-
rule /#/, toktype
|
129
|
+
rule %r/#/, toktype
|
115
130
|
else
|
116
|
-
rule /[\\#]/, toktype
|
131
|
+
rule %r/[\\#]/, toktype
|
117
132
|
end
|
118
133
|
|
119
|
-
|
134
|
+
uniq_chars = "#{open}#{close}".squeeze
|
135
|
+
rule %r/[^##{uniq_chars}\\]+/m, toktype
|
120
136
|
end
|
121
137
|
end
|
122
138
|
end
|
123
139
|
|
124
140
|
state :regex_flags do
|
125
|
-
rule /[fgimrsux]*/, Str::Regex, :pop!
|
141
|
+
rule %r/[fgimrsux]*/, Str::Regex, :pop!
|
126
142
|
end
|
127
143
|
|
128
144
|
state :list_flags do
|
129
|
-
rule /[csa]?/, Str::Other, :pop!
|
145
|
+
rule %r/[csa]?/, Str::Other, :pop!
|
130
146
|
end
|
131
147
|
end
|
132
148
|
end
|
data/lib/rouge/lexers/elm.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
|
@@ -22,66 +23,66 @@ module Rouge
|
|
22
23
|
|
23
24
|
state :root do
|
24
25
|
# Whitespaces
|
25
|
-
rule /\s+/m, Text
|
26
|
+
rule %r/\s+/m, Text
|
26
27
|
# Single line comments
|
27
|
-
rule /--.*/, Comment::Single
|
28
|
+
rule %r/--.*/, Comment::Single
|
28
29
|
# Multiline comments
|
29
|
-
rule /{-/, Comment::Multiline, :multiline_comment
|
30
|
+
rule %r/{-/, Comment::Multiline, :multiline_comment
|
30
31
|
|
31
32
|
# Keywords
|
32
|
-
rule /\b(#{keywords.join('|')})\b/, Keyword
|
33
|
+
rule %r/\b(#{keywords.join('|')})\b/, Keyword
|
33
34
|
|
34
35
|
# Variable or a function
|
35
|
-
rule /[a-z]
|
36
|
+
rule %r/[a-z]\w*/, Name
|
36
37
|
# Underscore is a name for a variable, when it won't be used later
|
37
|
-
rule /_/, Name
|
38
|
+
rule %r/_/, Name
|
38
39
|
# Type
|
39
|
-
rule /[A-Z]
|
40
|
+
rule %r/[A-Z]\w*/, Keyword::Type
|
40
41
|
|
41
42
|
# Two symbol operators: -> :: // .. && || ++ |> <| << >> == /= <= >=
|
42
|
-
rule /(->|::|\/\/|\.\.|&&|\|\||\+\+|\|>|<\||>>|<<|==|\/=|<=|>=)/, Operator
|
43
|
+
rule %r/(->|::|\/\/|\.\.|&&|\|\||\+\+|\|>|<\||>>|<<|==|\/=|<=|>=)/, Operator
|
43
44
|
# One symbol operators: + - / * % = < > ^ | !
|
44
|
-
rule /[+-\/*%=<>^\|!]/, Operator
|
45
|
+
rule %r/[+-\/*%=<>^\|!]/, Operator
|
45
46
|
# Lambda operator
|
46
|
-
rule /\\/, Operator
|
47
|
+
rule %r/\\/, Operator
|
47
48
|
# Not standard Elm operators, but these symbols can be used for custom inflix operators. We need to highlight them as operators as well.
|
48
|
-
rule /[@\#$&~?]/, Operator
|
49
|
+
rule %r/[@\#$&~?]/, Operator
|
49
50
|
|
50
51
|
# Single, double quotes, and triple double quotes
|
51
|
-
rule /"""/, Str, :multiline_string
|
52
|
-
rule /'(\\.|.)'/, Str::Char
|
53
|
-
rule /"/, Str, :double_quote
|
52
|
+
rule %r/"""/, Str, :multiline_string
|
53
|
+
rule %r/'(\\.|.)'/, Str::Char
|
54
|
+
rule %r/"/, Str, :double_quote
|
54
55
|
|
55
56
|
# Numbers
|
56
|
-
rule /0x[\da-f]+/i, Num::Hex
|
57
|
-
rule /\d+e[+-]?\d+/i, Num::Float
|
58
|
-
rule /\d+\.\d+(e[+-]?\d+)?/i, Num::Float
|
59
|
-
rule /\d+/, Num::Integer
|
57
|
+
rule %r/0x[\da-f]+/i, Num::Hex
|
58
|
+
rule %r/\d+e[+-]?\d+/i, Num::Float
|
59
|
+
rule %r/\d+\.\d+(e[+-]?\d+)?/i, Num::Float
|
60
|
+
rule %r/\d+/, Num::Integer
|
60
61
|
|
61
62
|
# Punctuation: [ ] ( ) , ; ` { } :
|
62
|
-
rule /[\[\](),;`{}:]/, Punctuation
|
63
|
+
rule %r/[\[\](),;`{}:]/, Punctuation
|
63
64
|
end
|
64
65
|
|
65
66
|
# Multiline and nested commenting
|
66
67
|
state :multiline_comment do
|
67
|
-
rule /-}/, Comment::Multiline, :pop!
|
68
|
-
rule /{-/, Comment::Multiline, :multiline_comment
|
69
|
-
rule /[^-{}]+/, Comment::Multiline
|
70
|
-
rule /[-{}]/, Comment::Multiline
|
68
|
+
rule %r/-}/, Comment::Multiline, :pop!
|
69
|
+
rule %r/{-/, Comment::Multiline, :multiline_comment
|
70
|
+
rule %r/[^-{}]+/, Comment::Multiline
|
71
|
+
rule %r/[-{}]/, Comment::Multiline
|
71
72
|
end
|
72
73
|
|
73
74
|
# Double quotes
|
74
75
|
state :double_quote do
|
75
|
-
rule /[^\\"]+/, Str::Double
|
76
|
-
rule /\\"/, Str::Escape
|
77
|
-
rule /"/, Str::Double, :pop!
|
76
|
+
rule %r/[^\\"]+/, Str::Double
|
77
|
+
rule %r/\\"/, Str::Escape
|
78
|
+
rule %r/"/, Str::Double, :pop!
|
78
79
|
end
|
79
80
|
|
80
81
|
# Multiple line string with tripple double quotes, e.g. """ multi """
|
81
82
|
state :multiline_string do
|
82
|
-
rule /\s*"""/, Str, :pop!
|
83
|
-
rule /.*/, Str
|
84
|
-
rule /\s*/, Str
|
83
|
+
rule %r/\s*"""/, Str, :pop!
|
84
|
+
rule %r/.*/, Str
|
85
|
+
rule %r/\s*/, Str
|
85
86
|
end
|
86
87
|
|
87
88
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
|
3
|
+
module Rouge
|
4
|
+
module Lexers
|
5
|
+
class EPP < TemplateLexer
|
6
|
+
title "EPP"
|
7
|
+
desc "Embedded Puppet template files"
|
8
|
+
|
9
|
+
tag 'epp'
|
10
|
+
|
11
|
+
filenames '*.epp'
|
12
|
+
|
13
|
+
def initialize(opts={})
|
14
|
+
super(opts)
|
15
|
+
@parent = lexer_option(:parent) { PlainText.new(opts) }
|
16
|
+
@puppet_lexer = Puppet.new(opts)
|
17
|
+
end
|
18
|
+
|
19
|
+
start do
|
20
|
+
parent.reset!
|
21
|
+
@puppet_lexer.reset!
|
22
|
+
end
|
23
|
+
|
24
|
+
open = /<%%|<%=|<%#|(<%-|<%)(\s*\|)?/
|
25
|
+
close = /%%>|(\|\s*)?(-%>|%>)/
|
26
|
+
|
27
|
+
state :root do
|
28
|
+
rule %r/<%#/, Comment, :comment
|
29
|
+
|
30
|
+
rule open, Comment::Preproc, :puppet
|
31
|
+
|
32
|
+
rule %r/.+?(?=#{open})|.+/m do
|
33
|
+
delegate parent
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
state :comment do
|
38
|
+
rule close, Comment, :pop!
|
39
|
+
rule %r/.+?(?=#{close})|.+/m, Comment
|
40
|
+
end
|
41
|
+
|
42
|
+
state :puppet do
|
43
|
+
rule close, Comment::Preproc, :pop!
|
44
|
+
|
45
|
+
rule %r/.+?(?=#{close})|.+/m do
|
46
|
+
delegate @puppet_lexer
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/lib/rouge/lexers/erb.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
|
@@ -26,24 +27,24 @@ module Rouge
|
|
26
27
|
close = /%%>|-%>|%>/
|
27
28
|
|
28
29
|
state :root do
|
29
|
-
rule /<%#/, Comment, :comment
|
30
|
+
rule %r/<%#/, Comment, :comment
|
30
31
|
|
31
32
|
rule open, Comment::Preproc, :ruby
|
32
33
|
|
33
|
-
rule /.+?(?=#{open})|.+/m do
|
34
|
+
rule %r/.+?(?=#{open})|.+/m do
|
34
35
|
delegate parent
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
38
39
|
state :comment do
|
39
40
|
rule close, Comment, :pop!
|
40
|
-
rule
|
41
|
+
rule %r/.+?(?=#{close})|.+/m, Comment
|
41
42
|
end
|
42
43
|
|
43
44
|
state :ruby do
|
44
45
|
rule close, Comment::Preproc, :pop!
|
45
46
|
|
46
|
-
rule /.+?(?=#{close})|.+/m do
|
47
|
+
rule %r/.+?(?=#{close})|.+/m do
|
47
48
|
delegate @ruby_lexer
|
48
49
|
end
|
49
50
|
end
|
data/lib/rouge/lexers/erlang.rb
CHANGED
@@ -0,0 +1,58 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class Escape < Lexer
|
7
|
+
tag 'escape'
|
8
|
+
aliases 'esc'
|
9
|
+
|
10
|
+
desc 'A generic lexer for including escaped content - see Formatter.enable_escape!'
|
11
|
+
|
12
|
+
option :start, 'the beginning of the escaped section, default "<!"'
|
13
|
+
option :end, 'the end of the escaped section, e.g. "!>"'
|
14
|
+
option :lang, 'the language to lex in unescaped sections'
|
15
|
+
|
16
|
+
attr_reader :start
|
17
|
+
attr_reader :end
|
18
|
+
attr_reader :lang
|
19
|
+
|
20
|
+
def initialize(*)
|
21
|
+
super
|
22
|
+
@start = string_option(:start) { '<!' }
|
23
|
+
@end = string_option(:end) { '!>' }
|
24
|
+
@lang = lexer_option(:lang) { PlainText.new }
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_start_regex
|
28
|
+
@to_start_regex ||= /(.*?)(#{Regexp.escape(@start)})/m
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_end_regex
|
32
|
+
@to_end_regex ||= /(.*?)(#{Regexp.escape(@end)})/m
|
33
|
+
end
|
34
|
+
|
35
|
+
def stream_tokens(str, &b)
|
36
|
+
stream = StringScanner.new(str)
|
37
|
+
|
38
|
+
loop do
|
39
|
+
if stream.scan(to_start_regex)
|
40
|
+
puts "pre-escape: #{stream[1].inspect}" if @debug
|
41
|
+
@lang.continue_lex(stream[1], &b)
|
42
|
+
else
|
43
|
+
# no more start delimiters, scan til the end
|
44
|
+
@lang.continue_lex(stream.rest, &b)
|
45
|
+
return
|
46
|
+
end
|
47
|
+
|
48
|
+
if stream.scan(to_end_regex)
|
49
|
+
yield Token::Tokens::Escape, stream[1]
|
50
|
+
else
|
51
|
+
yield Token::Tokens::Escape, stream.rest
|
52
|
+
return
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/rouge/lexers/factor.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
|
@@ -166,35 +167,35 @@ module Rouge
|
|
166
167
|
end
|
167
168
|
|
168
169
|
state :root do
|
169
|
-
rule /\s+/m, Text
|
170
|
+
rule %r/\s+/m, Text
|
170
171
|
|
171
|
-
rule /(:|::|MACRO:|MEMO:|GENERIC:|HELP:)(\s+)(\S+)/m do
|
172
|
+
rule %r/(:|::|MACRO:|MEMO:|GENERIC:|HELP:)(\s+)(\S+)/m do
|
172
173
|
groups Keyword, Text, Name::Function
|
173
174
|
end
|
174
175
|
|
175
|
-
rule /(M:|HOOK:|GENERIC#)(\s+)(\S+)(\s+)(\S+)/m do
|
176
|
+
rule %r/(M:|HOOK:|GENERIC#)(\s+)(\S+)(\s+)(\S+)/m do
|
176
177
|
groups Keyword, Text, Name::Class, Text, Name::Function
|
177
178
|
end
|
178
179
|
|
179
|
-
rule /\((?=\s)/, Name::Function, :stack_effect
|
180
|
-
rule /;(?=\s)/, Keyword
|
180
|
+
rule %r/\((?=\s)/, Name::Function, :stack_effect
|
181
|
+
rule %r/;(?=\s)/, Keyword
|
181
182
|
|
182
|
-
rule /(USING:)((?:\s|\\\s)+)/m do
|
183
|
+
rule %r/(USING:)((?:\s|\\\s)+)/m do
|
183
184
|
groups Keyword::Namespace, Text
|
184
185
|
push :import
|
185
186
|
end
|
186
187
|
|
187
|
-
rule /(IN:|USE:|UNUSE:|QUALIFIED:|QUALIFIED-WITH:)(\s+)(\S+)/m do
|
188
|
+
rule %r/(IN:|USE:|UNUSE:|QUALIFIED:|QUALIFIED-WITH:)(\s+)(\S+)/m do
|
188
189
|
groups Keyword::Namespace, Text, Name::Namespace
|
189
190
|
end
|
190
191
|
|
191
|
-
rule /(FROM:|EXCLUDE:)(\s+)(\S+)(\s+)(=>)/m do
|
192
|
+
rule %r/(FROM:|EXCLUDE:)(\s+)(\S+)(\s+)(=>)/m do
|
192
193
|
groups Keyword::Namespace, Text, Name::Namespace, Text, Punctuation
|
193
194
|
end
|
194
195
|
|
195
|
-
rule /(?:ALIAS|DEFER|FORGET|POSTPONE):/, Keyword::Namespace
|
196
|
+
rule %r/(?:ALIAS|DEFER|FORGET|POSTPONE):/, Keyword::Namespace
|
196
197
|
|
197
|
-
rule /(TUPLE:)(\s+)(\S+)(\s+)(<)(\s+)(\S+)/m do
|
198
|
+
rule %r/(TUPLE:)(\s+)(\S+)(\s+)(<)(\s+)(\S+)/m do
|
198
199
|
groups(
|
199
200
|
Keyword, Text,
|
200
201
|
Name::Class, Text,
|
@@ -204,16 +205,16 @@ module Rouge
|
|
204
205
|
push :slots
|
205
206
|
end
|
206
207
|
|
207
|
-
rule /(TUPLE:)(\s+)(\S+)/m do
|
208
|
+
rule %r/(TUPLE:)(\s+)(\S+)/m do
|
208
209
|
groups Keyword, Text, Name::Class
|
209
210
|
push :slots
|
210
211
|
end
|
211
212
|
|
212
|
-
rule /(UNION:|INTERSECTION:)(\s+)(\S+)/m do
|
213
|
+
rule %r/(UNION:|INTERSECTION:)(\s+)(\S+)/m do
|
213
214
|
groups Keyword, Text, Name::Class
|
214
215
|
end
|
215
216
|
|
216
|
-
rule /(PREDICATE:)(\s+)(\S+)(\s+)(<)(\s+)(\S+)/m do
|
217
|
+
rule %r/(PREDICATE:)(\s+)(\S+)(\s+)(<)(\s+)(\S+)/m do
|
217
218
|
groups(
|
218
219
|
Keyword, Text,
|
219
220
|
Name::Class, Text,
|
@@ -222,7 +223,7 @@ module Rouge
|
|
222
223
|
)
|
223
224
|
end
|
224
225
|
|
225
|
-
rule /(C:)(\s+)(\S+)(\s+)(\S+)/m do
|
226
|
+
rule %r/(C:)(\s+)(\S+)(\s+)(\S+)/m do
|
226
227
|
groups(
|
227
228
|
Keyword, Text,
|
228
229
|
Name::Function, Text,
|
@@ -235,38 +236,38 @@ module Rouge
|
|
235
236
|
|ALIEN|TYPEDEF|FUNCTION|STRUCT):
|
236
237
|
)x, Keyword
|
237
238
|
|
238
|
-
rule /(?:<PRIVATE|PRIVATE>)/, Keyword::Namespace
|
239
|
+
rule %r/(?:<PRIVATE|PRIVATE>)/, Keyword::Namespace
|
239
240
|
|
240
|
-
rule /(MAIN:)(\s+)(\S+)/ do
|
241
|
+
rule %r/(MAIN:)(\s+)(\S+)/ do
|
241
242
|
groups Keyword::Namespace, Text, Name::Function
|
242
243
|
end
|
243
244
|
|
244
245
|
# strings
|
245
|
-
rule /"""\s+.*?\s+"""/, Str
|
246
|
-
rule /"(\\.|[^\\])*?"/, Str
|
247
|
-
rule /(CHAR:)(\s+)(\\[\\abfnrstv]*|\S)(?=\s)/, Str::Char
|
246
|
+
rule %r/"""\s+.*?\s+"""/, Str
|
247
|
+
rule %r/"(\\.|[^\\])*?"/, Str
|
248
|
+
rule %r/(CHAR:)(\s+)(\\[\\abfnrstv]*|\S)(?=\s)/, Str::Char
|
248
249
|
|
249
250
|
# comments
|
250
|
-
rule /!\s+.*$/, Comment
|
251
|
-
rule /#!\s+.*$/, Comment
|
251
|
+
rule %r/!\s+.*$/, Comment
|
252
|
+
rule %r/#!\s+.*$/, Comment
|
252
253
|
|
253
254
|
# booleans
|
254
|
-
rule /[tf](?=\s)/, Name::Constant
|
255
|
+
rule %r/[tf](?=\s)/, Name::Constant
|
255
256
|
|
256
257
|
# numbers
|
257
|
-
rule /-?\d+\.\d+(?=\s)/, Num::Float
|
258
|
-
rule /-?\d+(?=\s)/, Num::Integer
|
258
|
+
rule %r/-?\d+\.\d+(?=\s)/, Num::Float
|
259
|
+
rule %r/-?\d+(?=\s)/, Num::Integer
|
259
260
|
|
260
|
-
rule /HEX:\s+[a-fA-F\d]+(?=\s)/m, Num::Hex
|
261
|
-
rule /BIN:\s+[01]+(?=\s)/, Num::Bin
|
262
|
-
rule /OCT:\s+[0-7]+(?=\s)/, Num::Oct
|
261
|
+
rule %r/HEX:\s+[a-fA-F\d]+(?=\s)/m, Num::Hex
|
262
|
+
rule %r/BIN:\s+[01]+(?=\s)/, Num::Bin
|
263
|
+
rule %r/OCT:\s+[0-7]+(?=\s)/, Num::Oct
|
263
264
|
|
264
265
|
rule %r([-+/*=<>^](?=\s)), Operator
|
265
266
|
|
266
|
-
rule /(?:deprecated|final|foldable|flushable|inline|recursive)(?=\s)/,
|
267
|
+
rule %r/(?:deprecated|final|foldable|flushable|inline|recursive)(?=\s)/,
|
267
268
|
Keyword
|
268
269
|
|
269
|
-
rule /\S+/ do |m|
|
270
|
+
rule %r/\S+/ do |m|
|
270
271
|
name = m[0]
|
271
272
|
|
272
273
|
if self.class.builtins.values.any? { |b| b.include? name }
|
@@ -278,24 +279,24 @@ module Rouge
|
|
278
279
|
end
|
279
280
|
|
280
281
|
state :stack_effect do
|
281
|
-
rule /\s+/, Text
|
282
|
-
rule /\(/, Name::Function, :stack_effect
|
283
|
-
rule /\)/, Name::Function, :pop!
|
282
|
+
rule %r/\s+/, Text
|
283
|
+
rule %r/\(/, Name::Function, :stack_effect
|
284
|
+
rule %r/\)/, Name::Function, :pop!
|
284
285
|
|
285
|
-
rule /--/, Name::Function
|
286
|
-
rule /\S+/, Name::Variable
|
286
|
+
rule %r/--/, Name::Function
|
287
|
+
rule %r/\S+/, Name::Variable
|
287
288
|
end
|
288
289
|
|
289
290
|
state :slots do
|
290
|
-
rule /\s+/, Text
|
291
|
-
rule /;(?=\s)/, Keyword, :pop!
|
292
|
-
rule /\S+/, Name::Variable
|
291
|
+
rule %r/\s+/, Text
|
292
|
+
rule %r/;(?=\s)/, Keyword, :pop!
|
293
|
+
rule %r/\S+/, Name::Variable
|
293
294
|
end
|
294
295
|
|
295
296
|
state :import do
|
296
|
-
rule /;(?=\s)/, Keyword, :pop!
|
297
|
-
rule /\s+/, Text
|
298
|
-
rule /\S+/, Name::Namespace
|
297
|
+
rule %r/;(?=\s)/, Keyword, :pop!
|
298
|
+
rule %r/\s+/, Text
|
299
|
+
rule %r/\S+/, Name::Namespace
|
299
300
|
end
|
300
301
|
end
|
301
302
|
end
|