rouge 3.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +40 -0
- data/LICENSE +186 -0
- data/bin/rougify +18 -0
- data/lib/rouge.rb +107 -0
- data/lib/rouge/cli.rb +498 -0
- data/lib/rouge/demos/abap +6 -0
- data/lib/rouge/demos/actionscript +4 -0
- data/lib/rouge/demos/ada +26 -0
- data/lib/rouge/demos/apache +21 -0
- data/lib/rouge/demos/apex +9 -0
- data/lib/rouge/demos/apiblueprint +33 -0
- data/lib/rouge/demos/applescript +2 -0
- data/lib/rouge/demos/armasm +12 -0
- data/lib/rouge/demos/awk +4 -0
- data/lib/rouge/demos/batchfile +3 -0
- data/lib/rouge/demos/bbcbasic +6 -0
- data/lib/rouge/demos/biml +38 -0
- data/lib/rouge/demos/bpf +7 -0
- data/lib/rouge/demos/brainfuck +5 -0
- data/lib/rouge/demos/bsl +7 -0
- data/lib/rouge/demos/c +8 -0
- data/lib/rouge/demos/ceylon +7 -0
- data/lib/rouge/demos/cfscript +18 -0
- data/lib/rouge/demos/clean +6 -0
- data/lib/rouge/demos/clojure +5 -0
- data/lib/rouge/demos/cmake +7 -0
- data/lib/rouge/demos/cmhg +8 -0
- data/lib/rouge/demos/coffeescript +5 -0
- data/lib/rouge/demos/common_lisp +1 -0
- data/lib/rouge/demos/conf +4 -0
- data/lib/rouge/demos/console +6 -0
- data/lib/rouge/demos/coq +13 -0
- data/lib/rouge/demos/cpp +8 -0
- data/lib/rouge/demos/crystal +45 -0
- data/lib/rouge/demos/csharp +5 -0
- data/lib/rouge/demos/css +4 -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/d +16 -0
- data/lib/rouge/demos/dart +6 -0
- data/lib/rouge/demos/datastudio +21 -0
- data/lib/rouge/demos/diff +7 -0
- data/lib/rouge/demos/digdag +19 -0
- data/lib/rouge/demos/docker +9 -0
- data/lib/rouge/demos/dot +5 -0
- data/lib/rouge/demos/ecl +18 -0
- data/lib/rouge/demos/eex +1 -0
- data/lib/rouge/demos/eiffel +30 -0
- data/lib/rouge/demos/elixir +1 -0
- data/lib/rouge/demos/elm +4 -0
- data/lib/rouge/demos/epp +4 -0
- data/lib/rouge/demos/erb +1 -0
- data/lib/rouge/demos/erlang +7 -0
- data/lib/rouge/demos/escape +3 -0
- data/lib/rouge/demos/factor +5 -0
- data/lib/rouge/demos/fortran +22 -0
- data/lib/rouge/demos/freefem +16 -0
- data/lib/rouge/demos/fsharp +12 -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/gherkin +17 -0
- data/lib/rouge/demos/glsl +14 -0
- data/lib/rouge/demos/go +7 -0
- data/lib/rouge/demos/gradle +10 -0
- data/lib/rouge/demos/graphql +17 -0
- data/lib/rouge/demos/groovy +9 -0
- data/lib/rouge/demos/hack +5 -0
- data/lib/rouge/demos/haml +5 -0
- data/lib/rouge/demos/handlebars +7 -0
- data/lib/rouge/demos/haskell +6 -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/html +8 -0
- data/lib/rouge/demos/http +14 -0
- data/lib/rouge/demos/hylang +10 -0
- data/lib/rouge/demos/idlang +8 -0
- data/lib/rouge/demos/igorpro +9 -0
- data/lib/rouge/demos/ini +4 -0
- data/lib/rouge/demos/io +11 -0
- data/lib/rouge/demos/irb +4 -0
- data/lib/rouge/demos/irb_output +2 -0
- data/lib/rouge/demos/isbl +4 -0
- data/lib/rouge/demos/java +5 -0
- data/lib/rouge/demos/javascript +1 -0
- data/lib/rouge/demos/jinja +9 -0
- data/lib/rouge/demos/jsl +3 -0
- data/lib/rouge/demos/json +1 -0
- data/lib/rouge/demos/json-doc +1 -0
- data/lib/rouge/demos/jsonnet +28 -0
- data/lib/rouge/demos/jsp +29 -0
- data/lib/rouge/demos/jsx +17 -0
- data/lib/rouge/demos/julia +11 -0
- data/lib/rouge/demos/kotlin +3 -0
- data/lib/rouge/demos/lasso +12 -0
- data/lib/rouge/demos/liquid +10 -0
- data/lib/rouge/demos/literate_coffeescript +3 -0
- data/lib/rouge/demos/literate_haskell +7 -0
- data/lib/rouge/demos/llvm +20 -0
- data/lib/rouge/demos/lua +12 -0
- 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/make +6 -0
- data/lib/rouge/demos/markdown +4 -0
- data/lib/rouge/demos/mason +22 -0
- data/lib/rouge/demos/mathematica +8 -0
- data/lib/rouge/demos/matlab +6 -0
- data/lib/rouge/demos/minizinc +23 -0
- data/lib/rouge/demos/moonscript +16 -0
- data/lib/rouge/demos/mosel +10 -0
- data/lib/rouge/demos/msgtrans +4 -0
- data/lib/rouge/demos/mxml +22 -0
- data/lib/rouge/demos/nasm +26 -0
- data/lib/rouge/demos/nesasm +11 -0
- data/lib/rouge/demos/nginx +5 -0
- data/lib/rouge/demos/nim +27 -0
- data/lib/rouge/demos/nix +19 -0
- data/lib/rouge/demos/objective_c +18 -0
- data/lib/rouge/demos/objective_cpp +17 -0
- data/lib/rouge/demos/ocaml +12 -0
- data/lib/rouge/demos/openedge +4 -0
- data/lib/rouge/demos/opentype_feature_file +6 -0
- data/lib/rouge/demos/pascal +14 -0
- data/lib/rouge/demos/perl +5 -0
- data/lib/rouge/demos/php +3 -0
- data/lib/rouge/demos/plaintext +1 -0
- data/lib/rouge/demos/plist +11 -0
- data/lib/rouge/demos/pony +17 -0
- data/lib/rouge/demos/powershell +13 -0
- data/lib/rouge/demos/praat +26 -0
- data/lib/rouge/demos/prolog +9 -0
- data/lib/rouge/demos/prometheus +9 -0
- data/lib/rouge/demos/properties +7 -0
- data/lib/rouge/demos/protobuf +5 -0
- data/lib/rouge/demos/puppet +6 -0
- data/lib/rouge/demos/python +6 -0
- data/lib/rouge/demos/q +8 -0
- data/lib/rouge/demos/qml +9 -0
- data/lib/rouge/demos/r +8 -0
- data/lib/rouge/demos/racket +24 -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/ruby +9 -0
- data/lib/rouge/demos/rust +12 -0
- data/lib/rouge/demos/sas +13 -0
- data/lib/rouge/demos/sass +3 -0
- data/lib/rouge/demos/scala +3 -0
- data/lib/rouge/demos/scheme +4 -0
- data/lib/rouge/demos/scss +5 -0
- data/lib/rouge/demos/sed +4 -0
- data/lib/rouge/demos/shell +2 -0
- data/lib/rouge/demos/sieve +10 -0
- data/lib/rouge/demos/slice +10 -0
- data/lib/rouge/demos/slim +17 -0
- data/lib/rouge/demos/smalltalk +6 -0
- data/lib/rouge/demos/smarty +12 -0
- data/lib/rouge/demos/sml +4 -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/sql +1 -0
- data/lib/rouge/demos/supercollider +11 -0
- data/lib/rouge/demos/swift +5 -0
- data/lib/rouge/demos/tap +5 -0
- data/lib/rouge/demos/tcl +1 -0
- data/lib/rouge/demos/terraform +16 -0
- data/lib/rouge/demos/tex +1 -0
- data/lib/rouge/demos/toml +9 -0
- data/lib/rouge/demos/tsx +17 -0
- data/lib/rouge/demos/ttcn3 +6 -0
- data/lib/rouge/demos/tulip +13 -0
- data/lib/rouge/demos/turtle +26 -0
- data/lib/rouge/demos/twig +9 -0
- data/lib/rouge/demos/typescript +1 -0
- data/lib/rouge/demos/vala +8 -0
- data/lib/rouge/demos/vb +4 -0
- data/lib/rouge/demos/vcl +12 -0
- data/lib/rouge/demos/verilog +27 -0
- data/lib/rouge/demos/vhdl +23 -0
- data/lib/rouge/demos/viml +14 -0
- data/lib/rouge/demos/vue +11 -0
- data/lib/rouge/demos/wollok +11 -0
- data/lib/rouge/demos/xml +2 -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/yaml +4 -0
- data/lib/rouge/demos/yang +17 -0
- data/lib/rouge/formatter.rb +112 -0
- data/lib/rouge/formatters/html.rb +56 -0
- data/lib/rouge/formatters/html_inline.rb +31 -0
- data/lib/rouge/formatters/html_legacy.rb +45 -0
- data/lib/rouge/formatters/html_line_table.rb +53 -0
- data/lib/rouge/formatters/html_linewise.rb +23 -0
- data/lib/rouge/formatters/html_pygments.rb +18 -0
- data/lib/rouge/formatters/html_table.rb +51 -0
- data/lib/rouge/formatters/null.rb +20 -0
- data/lib/rouge/formatters/terminal256.rb +198 -0
- data/lib/rouge/formatters/terminal_truecolor.rb +37 -0
- data/lib/rouge/formatters/tex.rb +92 -0
- data/lib/rouge/guesser.rb +57 -0
- data/lib/rouge/guessers/disambiguation.rb +136 -0
- data/lib/rouge/guessers/filename.rb +27 -0
- data/lib/rouge/guessers/glob_mapping.rb +45 -0
- data/lib/rouge/guessers/mimetype.rb +16 -0
- data/lib/rouge/guessers/modeline.rb +46 -0
- data/lib/rouge/guessers/source.rb +31 -0
- data/lib/rouge/guessers/util.rb +34 -0
- data/lib/rouge/lexer.rb +517 -0
- data/lib/rouge/lexers/abap.rb +240 -0
- data/lib/rouge/lexers/actionscript.rb +196 -0
- data/lib/rouge/lexers/ada.rb +162 -0
- data/lib/rouge/lexers/apache.rb +69 -0
- data/lib/rouge/lexers/apache/keywords.rb +15 -0
- data/lib/rouge/lexers/apex.rb +126 -0
- data/lib/rouge/lexers/apiblueprint.rb +49 -0
- data/lib/rouge/lexers/apple_script.rb +370 -0
- data/lib/rouge/lexers/armasm.rb +145 -0
- data/lib/rouge/lexers/awk.rb +162 -0
- data/lib/rouge/lexers/batchfile.rb +164 -0
- data/lib/rouge/lexers/bbcbasic.rb +112 -0
- data/lib/rouge/lexers/biml.rb +43 -0
- data/lib/rouge/lexers/bpf.rb +118 -0
- data/lib/rouge/lexers/brainfuck.rb +53 -0
- data/lib/rouge/lexers/bsl.rb +82 -0
- data/lib/rouge/lexers/c.rb +190 -0
- data/lib/rouge/lexers/ceylon.rb +96 -0
- data/lib/rouge/lexers/cfscript.rb +154 -0
- data/lib/rouge/lexers/clean.rb +156 -0
- data/lib/rouge/lexers/clojure.rb +113 -0
- data/lib/rouge/lexers/cmake.rb +208 -0
- data/lib/rouge/lexers/cmhg.rb +34 -0
- data/lib/rouge/lexers/coffeescript.rb +215 -0
- data/lib/rouge/lexers/common_lisp.rb +346 -0
- data/lib/rouge/lexers/conf.rb +25 -0
- data/lib/rouge/lexers/console.rb +190 -0
- data/lib/rouge/lexers/coq.rb +191 -0
- data/lib/rouge/lexers/cpp.rb +89 -0
- data/lib/rouge/lexers/crystal.rb +430 -0
- data/lib/rouge/lexers/csharp.rb +114 -0
- data/lib/rouge/lexers/css.rb +274 -0
- 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 +177 -0
- data/lib/rouge/lexers/dart.rb +105 -0
- data/lib/rouge/lexers/datastudio.rb +138 -0
- data/lib/rouge/lexers/diff.rb +37 -0
- data/lib/rouge/lexers/digdag.rb +70 -0
- data/lib/rouge/lexers/docker.rb +51 -0
- data/lib/rouge/lexers/dot.rb +69 -0
- data/lib/rouge/lexers/ecl.rb +175 -0
- data/lib/rouge/lexers/eex.rb +52 -0
- data/lib/rouge/lexers/eiffel.rb +66 -0
- data/lib/rouge/lexers/elixir.rb +149 -0
- data/lib/rouge/lexers/elm.rb +90 -0
- data/lib/rouge/lexers/epp.rb +51 -0
- data/lib/rouge/lexers/erb.rb +53 -0
- data/lib/rouge/lexers/erlang.rb +115 -0
- data/lib/rouge/lexers/escape.rb +58 -0
- data/lib/rouge/lexers/factor.rb +303 -0
- data/lib/rouge/lexers/fortran.rb +178 -0
- data/lib/rouge/lexers/freefem.rb +240 -0
- data/lib/rouge/lexers/fsharp.rb +120 -0
- 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 +140 -0
- data/lib/rouge/lexers/gherkin/keywords.rb +16 -0
- data/lib/rouge/lexers/glsl.rb +132 -0
- data/lib/rouge/lexers/go.rb +175 -0
- data/lib/rouge/lexers/gradle.rb +38 -0
- data/lib/rouge/lexers/graphql.rb +261 -0
- data/lib/rouge/lexers/groovy.rb +111 -0
- data/lib/rouge/lexers/hack.rb +49 -0
- data/lib/rouge/lexers/haml.rb +226 -0
- data/lib/rouge/lexers/handlebars.rb +91 -0
- data/lib/rouge/lexers/haskell.rb +199 -0
- 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 +141 -0
- data/lib/rouge/lexers/http.rb +81 -0
- data/lib/rouge/lexers/hylang.rb +94 -0
- data/lib/rouge/lexers/idlang.rb +312 -0
- data/lib/rouge/lexers/igorpro.rb +664 -0
- data/lib/rouge/lexers/ini.rb +54 -0
- data/lib/rouge/lexers/io.rb +69 -0
- data/lib/rouge/lexers/irb.rb +67 -0
- data/lib/rouge/lexers/isbl.rb +97 -0
- data/lib/rouge/lexers/isbl/builtins.rb +17 -0
- data/lib/rouge/lexers/java.rb +91 -0
- data/lib/rouge/lexers/javascript.rb +279 -0
- data/lib/rouge/lexers/jinja.rb +154 -0
- data/lib/rouge/lexers/jsl.rb +55 -0
- data/lib/rouge/lexers/json.rb +72 -0
- data/lib/rouge/lexers/json_doc.rb +26 -0
- data/lib/rouge/lexers/jsonnet.rb +152 -0
- data/lib/rouge/lexers/jsp.rb +120 -0
- data/lib/rouge/lexers/jsx.rb +104 -0
- data/lib/rouge/lexers/julia.rb +290 -0
- data/lib/rouge/lexers/kotlin.rb +131 -0
- data/lib/rouge/lexers/lasso.rb +210 -0
- data/lib/rouge/lexers/lasso/keywords.rb +14 -0
- data/lib/rouge/lexers/liquid.rb +285 -0
- data/lib/rouge/lexers/literate_coffeescript.rb +34 -0
- data/lib/rouge/lexers/literate_haskell.rb +37 -0
- data/lib/rouge/lexers/llvm.rb +97 -0
- data/lib/rouge/lexers/lua.rb +164 -0
- data/lib/rouge/lexers/lua/builtins.rb +24 -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 +135 -0
- data/lib/rouge/lexers/markdown.rb +182 -0
- 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 +80 -0
- data/lib/rouge/lexers/matlab/builtins.rb +11 -0
- data/lib/rouge/lexers/minizinc.rb +87 -0
- data/lib/rouge/lexers/moonscript.rb +115 -0
- data/lib/rouge/lexers/mosel.rb +232 -0
- data/lib/rouge/lexers/msgtrans.rb +26 -0
- data/lib/rouge/lexers/mxml.rb +69 -0
- data/lib/rouge/lexers/nasm.rb +72 -0
- data/lib/rouge/lexers/nesasm.rb +78 -0
- data/lib/rouge/lexers/nginx.rb +72 -0
- data/lib/rouge/lexers/nim.rb +154 -0
- data/lib/rouge/lexers/nix.rb +211 -0
- data/lib/rouge/lexers/objective_c.rb +21 -0
- 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 +65 -0
- 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 +67 -0
- data/lib/rouge/lexers/perl.rb +231 -0
- data/lib/rouge/lexers/php.rb +231 -0
- data/lib/rouge/lexers/php/builtins.rb +203 -0
- data/lib/rouge/lexers/plain_text.rb +27 -0
- data/lib/rouge/lexers/plist.rb +47 -0
- data/lib/rouge/lexers/pony.rb +94 -0
- data/lib/rouge/lexers/powershell.rb +230 -0
- data/lib/rouge/lexers/praat.rb +351 -0
- data/lib/rouge/lexers/prolog.rb +67 -0
- data/lib/rouge/lexers/prometheus.rb +123 -0
- data/lib/rouge/lexers/properties.rb +52 -0
- data/lib/rouge/lexers/protobuf.rb +71 -0
- data/lib/rouge/lexers/puppet.rb +129 -0
- data/lib/rouge/lexers/python.rb +257 -0
- data/lib/rouge/lexers/q.rb +126 -0
- data/lib/rouge/lexers/qml.rb +74 -0
- data/lib/rouge/lexers/r.rb +89 -0
- data/lib/rouge/lexers/racket.rb +568 -0
- 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 +454 -0
- data/lib/rouge/lexers/rust.rb +193 -0
- data/lib/rouge/lexers/sas.rb +563 -0
- data/lib/rouge/lexers/sass.rb +75 -0
- data/lib/rouge/lexers/sass/common.rb +181 -0
- data/lib/rouge/lexers/scala.rb +169 -0
- data/lib/rouge/lexers/scheme.rb +113 -0
- data/lib/rouge/lexers/scss.rb +35 -0
- data/lib/rouge/lexers/sed.rb +173 -0
- data/lib/rouge/lexers/shell.rb +201 -0
- data/lib/rouge/lexers/sieve.rb +97 -0
- data/lib/rouge/lexers/slice.rb +32 -0
- data/lib/rouge/lexers/slim.rb +229 -0
- data/lib/rouge/lexers/smalltalk.rb +117 -0
- data/lib/rouge/lexers/smarty.rb +81 -0
- data/lib/rouge/lexers/sml.rb +345 -0
- 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 +161 -0
- data/lib/rouge/lexers/supercollider.rb +116 -0
- data/lib/rouge/lexers/swift.rb +186 -0
- data/lib/rouge/lexers/tap.rb +89 -0
- data/lib/rouge/lexers/tcl.rb +193 -0
- data/lib/rouge/lexers/terraform.rb +128 -0
- data/lib/rouge/lexers/tex.rb +70 -0
- data/lib/rouge/lexers/toml.rb +106 -0
- data/lib/rouge/lexers/tsx.rb +20 -0
- data/lib/rouge/lexers/ttcn3.rb +119 -0
- data/lib/rouge/lexers/tulip.rb +108 -0
- data/lib/rouge/lexers/turtle.rb +61 -0
- data/lib/rouge/lexers/twig.rb +40 -0
- data/lib/rouge/lexers/typescript.rb +34 -0
- data/lib/rouge/lexers/typescript/common.rb +34 -0
- data/lib/rouge/lexers/vala.rb +78 -0
- data/lib/rouge/lexers/varnish.rb +168 -0
- data/lib/rouge/lexers/vb.rb +165 -0
- data/lib/rouge/lexers/verilog.rb +163 -0
- data/lib/rouge/lexers/vhdl.rb +98 -0
- data/lib/rouge/lexers/viml.rb +102 -0
- data/lib/rouge/lexers/viml/keywords.rb +14 -0
- data/lib/rouge/lexers/vue.rb +127 -0
- data/lib/rouge/lexers/wollok.rb +104 -0
- data/lib/rouge/lexers/xml.rb +54 -0
- 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 +376 -0
- data/lib/rouge/lexers/yang.rb +147 -0
- data/lib/rouge/plugins/redcarpet.rb +37 -0
- data/lib/rouge/regex_lexer.rb +443 -0
- data/lib/rouge/template_lexer.rb +21 -0
- data/lib/rouge/tex_theme_renderer.rb +132 -0
- data/lib/rouge/text_analyzer.rb +50 -0
- data/lib/rouge/theme.rb +218 -0
- data/lib/rouge/themes/base16.rb +131 -0
- data/lib/rouge/themes/bw.rb +41 -0
- data/lib/rouge/themes/colorful.rb +68 -0
- data/lib/rouge/themes/github.rb +72 -0
- data/lib/rouge/themes/gruvbox.rb +168 -0
- data/lib/rouge/themes/igor_pro.rb +21 -0
- data/lib/rouge/themes/magritte.rb +78 -0
- data/lib/rouge/themes/molokai.rb +83 -0
- data/lib/rouge/themes/monokai.rb +93 -0
- data/lib/rouge/themes/monokai_sublime.rb +93 -0
- data/lib/rouge/themes/pastie.rb +70 -0
- data/lib/rouge/themes/thankful_eyes.rb +75 -0
- data/lib/rouge/themes/tulip.rb +70 -0
- data/lib/rouge/token.rb +191 -0
- data/lib/rouge/util.rb +102 -0
- data/lib/rouge/version.rb +8 -0
- data/rouge.gemspec +26 -0
- metadata +491 -0
@@ -0,0 +1,193 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class Rust < RegexLexer
|
7
|
+
title "Rust"
|
8
|
+
desc 'The Rust programming language (rust-lang.org)'
|
9
|
+
tag 'rust'
|
10
|
+
aliases 'rs',
|
11
|
+
# So that directives from https://github.com/budziq/rust-skeptic
|
12
|
+
# do not prevent highlighting.
|
13
|
+
'rust,no_run', 'rs,no_run',
|
14
|
+
'rust,ignore', 'rs,ignore',
|
15
|
+
'rust,should_panic', 'rs,should_panic'
|
16
|
+
filenames '*.rs'
|
17
|
+
mimetypes 'text/x-rust'
|
18
|
+
|
19
|
+
def self.detect?(text)
|
20
|
+
return true if text.shebang? 'rustc'
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.keywords
|
24
|
+
@keywords ||= %w(
|
25
|
+
as assert async await break const copy do drop else enum extern fail false
|
26
|
+
fn for if impl let log loop match mod move mut priv pub pure
|
27
|
+
ref return self static struct true trait type unsafe use where
|
28
|
+
while box
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.builtins
|
33
|
+
@builtins ||= Set.new %w(
|
34
|
+
Add BitAnd BitOr BitXor bool c_char c_double c_float char
|
35
|
+
c_int clock_t c_long c_longlong Cons Const Copy c_schar c_short
|
36
|
+
c_uchar c_uint c_ulong c_ulonglong c_ushort c_void dev_t DIR
|
37
|
+
dirent Div Either Eq Err f32 f64 Failure FILE float fpos_t
|
38
|
+
i16 i32 i64 i8 isize Index ino_t int intptr_t Left mode_t Modulo Mul
|
39
|
+
Neg Nil None Num off_t Ok Option Ord Owned pid_t Ptr ptrdiff_t
|
40
|
+
Right Send Shl Shr size_t Some ssize_t str Sub Success time_t
|
41
|
+
u16 u32 u64 u8 usize uint uintptr_t
|
42
|
+
Box Vec String Gc Rc Arc
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
def macro_closed?
|
47
|
+
@macro_delims.values.all?(&:zero?)
|
48
|
+
end
|
49
|
+
|
50
|
+
start {
|
51
|
+
@macro_delims = { ']' => 0, ')' => 0, '}' => 0 }
|
52
|
+
push :bol
|
53
|
+
}
|
54
|
+
|
55
|
+
delim_map = { '[' => ']', '(' => ')', '{' => '}' }
|
56
|
+
|
57
|
+
id = /[a-z_]\w*/i
|
58
|
+
hex = /[0-9a-f]/i
|
59
|
+
escapes = %r(
|
60
|
+
\\ ([nrt'"\\0] | x#{hex}{2} | u#{hex}{4} | U#{hex}{8})
|
61
|
+
)x
|
62
|
+
size = /8|16|32|64/
|
63
|
+
|
64
|
+
# Although not officially part of Rust, the rustdoc tool allows code in
|
65
|
+
# comments to begin with `#`. Code like this will be evaluated but not
|
66
|
+
# included in the HTML output produced by rustdoc. So that code intended
|
67
|
+
# for these comments can be higlighted with Rouge, the Rust lexer needs
|
68
|
+
# to check if the beginning of the line begins with a `# `.
|
69
|
+
state :bol do
|
70
|
+
mixin :whitespace
|
71
|
+
rule %r/#\s[^\n]*/, Comment::Special
|
72
|
+
rule(//) { pop! }
|
73
|
+
end
|
74
|
+
|
75
|
+
state :attribute do
|
76
|
+
mixin :whitespace
|
77
|
+
mixin :has_literals
|
78
|
+
rule %r/[(,)=:]/, Name::Decorator
|
79
|
+
rule %r/\]/, Name::Decorator, :pop!
|
80
|
+
rule id, Name::Decorator
|
81
|
+
end
|
82
|
+
|
83
|
+
state :whitespace do
|
84
|
+
rule %r/\s+/, Text
|
85
|
+
rule %r(//[^\n]*), Comment
|
86
|
+
rule %r(/[*].*?[*]/)m, Comment::Multiline
|
87
|
+
end
|
88
|
+
|
89
|
+
state :root do
|
90
|
+
rule %r/\n/, Text, :bol
|
91
|
+
mixin :whitespace
|
92
|
+
rule %r/#!?\[/, Name::Decorator, :attribute
|
93
|
+
rule %r/\b(?:#{Rust.keywords.join('|')})\b/, Keyword
|
94
|
+
mixin :has_literals
|
95
|
+
|
96
|
+
rule %r([=-]>), Keyword
|
97
|
+
rule %r(<->), Keyword
|
98
|
+
rule %r/[()\[\]{}|,:;]/, Punctuation
|
99
|
+
rule %r/[*\/!@~&+%^<>=\?-]|\.{2,3}/, Operator
|
100
|
+
|
101
|
+
rule %r/([.]\s*)?#{id}(?=\s*[(])/m, Name::Function
|
102
|
+
rule %r/[.]\s*#{id}/, Name::Property
|
103
|
+
rule %r/(#{id})(::)/m do
|
104
|
+
groups Name::Namespace, Punctuation
|
105
|
+
end
|
106
|
+
|
107
|
+
# macros
|
108
|
+
rule %r/\bmacro_rules!/, Name::Decorator, :macro_rules
|
109
|
+
rule %r/#{id}!/, Name::Decorator, :macro
|
110
|
+
|
111
|
+
rule %r/'#{id}/, Name::Variable
|
112
|
+
rule %r/#{id}/ do |m|
|
113
|
+
name = m[0]
|
114
|
+
if self.class.builtins.include? name
|
115
|
+
token Name::Builtin
|
116
|
+
else
|
117
|
+
token Name
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
state :macro do
|
123
|
+
mixin :has_literals
|
124
|
+
|
125
|
+
rule %r/[\[{(]/ do |m|
|
126
|
+
@macro_delims[delim_map[m[0]]] += 1
|
127
|
+
puts " macro_delims: #{@macro_delims.inspect}" if @debug
|
128
|
+
token Punctuation
|
129
|
+
end
|
130
|
+
|
131
|
+
rule %r/[\]})]/ do |m|
|
132
|
+
@macro_delims[m[0]] -= 1
|
133
|
+
puts " macro_delims: #{@macro_delims.inspect}" if @debug
|
134
|
+
pop! if macro_closed?
|
135
|
+
token Punctuation
|
136
|
+
end
|
137
|
+
|
138
|
+
# same as the rule in root, but don't push another macro state
|
139
|
+
rule %r/#{id}!/, Name::Decorator
|
140
|
+
mixin :root
|
141
|
+
|
142
|
+
# No syntax errors in macros
|
143
|
+
rule %r/./, Text
|
144
|
+
end
|
145
|
+
|
146
|
+
state :macro_rules do
|
147
|
+
rule %r/[$]#{id}(:#{id})?/, Name::Variable
|
148
|
+
rule %r/[$]/, Name::Variable
|
149
|
+
|
150
|
+
mixin :macro
|
151
|
+
end
|
152
|
+
|
153
|
+
state :has_literals do
|
154
|
+
# constants
|
155
|
+
rule %r/\b(?:true|false|nil)\b/, Keyword::Constant
|
156
|
+
# characters
|
157
|
+
rule %r(
|
158
|
+
' (?: #{escapes} | [^\\] ) '
|
159
|
+
)x, Str::Char
|
160
|
+
|
161
|
+
rule %r/"/, Str, :string
|
162
|
+
rule %r/r(#*)".*?"\1/m, Str
|
163
|
+
|
164
|
+
# numbers
|
165
|
+
dot = /[.][0-9_]+/
|
166
|
+
exp = /e[-+]?[0-9_]+/
|
167
|
+
flt = /f32|f64/
|
168
|
+
|
169
|
+
rule %r(
|
170
|
+
[0-9]+
|
171
|
+
(#{dot} #{exp}? #{flt}?
|
172
|
+
|#{dot}? #{exp} #{flt}?
|
173
|
+
|#{dot}? #{exp}? #{flt}
|
174
|
+
)
|
175
|
+
)x, Num::Float
|
176
|
+
|
177
|
+
rule %r(
|
178
|
+
( 0b[10_]+
|
179
|
+
| 0x[0-9a-fA-F_]+
|
180
|
+
| [0-9_]+
|
181
|
+
) (u#{size}?|i#{size})?
|
182
|
+
)x, Num::Integer
|
183
|
+
|
184
|
+
end
|
185
|
+
|
186
|
+
state :string do
|
187
|
+
rule %r/"/, Str, :pop!
|
188
|
+
rule escapes, Str::Escape
|
189
|
+
rule %r/[^"\\]+/m, Str
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
@@ -0,0 +1,563 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
|
3
|
+
module Rouge
|
4
|
+
module Lexers
|
5
|
+
class SAS < RegexLexer
|
6
|
+
title "SAS"
|
7
|
+
desc "SAS (Statistical Analysis Software)"
|
8
|
+
tag 'sas'
|
9
|
+
filenames '*.sas'
|
10
|
+
mimetypes 'application/x-sas', 'application/x-stat-sas', 'application/x-sas-syntax'
|
11
|
+
|
12
|
+
def self.data_step_statements
|
13
|
+
# from Data step statements - SAS 9.4 Statements reference
|
14
|
+
# http://support.sas.com/documentation/cdl/en/lestmtsref/68024/PDF/default/lestmtsref.pdf
|
15
|
+
@data_step_statements ||= Set.new %w(
|
16
|
+
ABORT ARRAY ATTRIB BY CALL CARDS CARDS4 CATNAME CHECKPOINT
|
17
|
+
EXECUTE_ALWAYS CONTINUE DATA DATALINES DATALINES4 DELETE DESCRIBE
|
18
|
+
DISPLAY DM DO UNTIL WHILE DROP END ENDSAS ERROR EXECUTE FILE FILENAME
|
19
|
+
FOOTNOTE FORMAT GO TO IF THEN ELSE INFILE INFORMAT INPUT
|
20
|
+
KEEP LABEL LEAVE LENGTH LIBNAME LINK LIST LOCK LOSTCARD MERGE
|
21
|
+
MISSING MODIFY OPTIONS OUTPUT PAGE PUT PUTLOG REDIRECT REMOVE RENAME
|
22
|
+
REPLACE RESETLINE RETAIN RETURN RUN SASFILE SELECT SET SKIP STOP
|
23
|
+
SYSECHO TITLE UPDATE WHERE WINDOW X
|
24
|
+
)
|
25
|
+
# label:
|
26
|
+
# Sum
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.sas_functions
|
30
|
+
# from SAS 9.4 Functions and CALL Routines reference
|
31
|
+
# http://support.sas.com/documentation/cdl/en/lefunctionsref/67960/PDF/default/lefunctionsref.pdf
|
32
|
+
@sas_functions ||= Set.new %w(
|
33
|
+
ABS ADDR ADDRLONG AIRY ALLCOMB ALLPERM ANYALNUM ANYALPHA ANYCNTRL
|
34
|
+
ANYDIGIT ANYFIRST ANYGRAPH ANYLOWER ANYNAME ANYPRINT ANYPUNCT
|
35
|
+
ANYSPACE ANYUPPER ANYXDIGIT ARCOS ARCOSH ARSIN ARSINH ARTANH ATAN
|
36
|
+
ATAN2 ATTRC ATTRN BAND BETA BETAINV BLACKCLPRC BLACKPTPRC
|
37
|
+
BLKSHCLPRC BLKSHPTPRC BLSHIFT BNOT BOR BRSHIFT BXOR BYTE CAT CATQ
|
38
|
+
CATS CATT CATX CDF CEIL CEILZ CEXIST CHAR CHOOSEC CHOOSEN CINV
|
39
|
+
CLOSE CMISS CNONCT COALESCE COALESCEC COLLATE COMB COMPARE COMPBL
|
40
|
+
COMPFUZZ COMPGED COMPLEV COMPOUND COMPRESS CONSTANT CONVX CONVXP
|
41
|
+
COS COSH COT COUNT COUNTC COUNTW CSC CSS CUMIPMT CUMPRINC CUROBS
|
42
|
+
CV DACCDB DACCDBSL DACCSL DACCSYD DACCTAB DAIRY DATDIF DATE
|
43
|
+
DATEJUL DATEPART DATETIME DAY DCLOSE DCREATE DEPDB DEPDBSL DEPSL
|
44
|
+
DEPSYD DEPTAB DEQUOTE DEVIANCE DHMS DIF DIGAMMA DIM DINFO DIVIDE
|
45
|
+
DNUM DOPEN DOPTNAME DOPTNUM DOSUBL DREAD DROPNOTE DSNAME
|
46
|
+
DSNCATLGD DUR DURP EFFRATE ENVLEN ERF ERFC EUCLID EXIST EXP FACT
|
47
|
+
FAPPEND FCLOSE FCOL FCOPY FDELETE FETCH FETCHOBS FEXIST FGET
|
48
|
+
FILEEXIST FILENAME FILEREF FINANCE FIND FINDC FINDW FINFO FINV
|
49
|
+
FIPNAME FIPNAMEL FIPSTATE FIRST FLOOR FLOORZ FMTINFO FNONCT FNOTE
|
50
|
+
FOPEN FOPTNAME FOPTNUM FPOINT FPOS FPUT FREAD FREWIND FRLEN FSEP
|
51
|
+
FUZZ FWRITE GAMINV GAMMA GARKHCLPRC GARKHPTPRC GCD GEODIST
|
52
|
+
GEOMEAN GEOMEANZ GETOPTION GETVARC GETVARN GRAYCODE HARMEAN
|
53
|
+
HARMEANZ HBOUND HMS HOLIDAY HOLIDAYCK HOLIDAYCOUNT HOLIDAYNAME
|
54
|
+
HOLIDAYNX HOLIDAYNY HOLIDAYTEST HOUR HTMLDECODE HTMLENCODE
|
55
|
+
IBESSEL IFC IFN INDEX INDEXC INDEXW INPUT INPUTC INPUTN INT
|
56
|
+
INTCINDEX INTCK INTCYCLE INTFIT INTFMT INTGET INTINDEX INTNX
|
57
|
+
INTRR INTSEAS INTSHIFT INTTEST INTZ IORCMSG IPMT IQR IRR JBESSEL
|
58
|
+
JULDATE JULDATE7 KURTOSIS LAG LARGEST LBOUND LCM LCOMB LEFT
|
59
|
+
LENGTH LENGTHC LENGTHM LENGTHN LEXCOMB LEXCOMBI LEXPERK LEXPERM
|
60
|
+
LFACT LGAMMA LIBNAME LIBREF LOG LOG1PX LOG10 LOG2 LOGBETA LOGCDF
|
61
|
+
LOGISTIC LOGPDF LOGSDF LOWCASE LPERM LPNORM MAD MARGRCLPRC
|
62
|
+
MARGRPTPRC MAX MD5 MDY MEAN MEDIAN MIN MINUTE MISSING MOD
|
63
|
+
MODEXIST MODULE MODULEC MODULEN MODZ MONTH MOPEN MORT MSPLINT
|
64
|
+
MVALID N NETPV NLITERAL NMISS NOMRATE NORMAL NOTALNUM NOTALPHA
|
65
|
+
NOTCNTRL NOTDIGIT NOTE NOTFIRST NOTGRAPH NOTLOWER NOTNAME
|
66
|
+
NOTPRINT NOTPUNCT NOTSPACE NOTUPPER NOTXDIGIT NPV NVALID NWKDOM
|
67
|
+
OPEN ORDINAL PATHNAME PCTL PDF PEEK PEEKC PEEKCLONG PEEKLONG PERM
|
68
|
+
PMT POINT POISSON PPMT PROBBETA PROBBNML PROBBNRM PROBCHI PROBF
|
69
|
+
PROBGAM PROBHYPR PROBIT PROBMC PROBNEGB PROBNORM PROBT PROPCASE
|
70
|
+
PRXCHANGE PRXMATCH PRXPAREN PRXPARSE PRXPOSN PTRLONGADD PUT PUTC
|
71
|
+
PUTN PVP QTR QUANTILE QUOTE RANBIN RANCAU RAND RANEXP RANGAM
|
72
|
+
RANGE RANK RANNOR RANPOI RANTBL RANTRI RANUNI RENAME REPEAT
|
73
|
+
RESOLVE REVERSE REWIND RIGHT RMS ROUND ROUNDE ROUNDZ SAVING
|
74
|
+
SAVINGS SCAN SDF SEC SECOND SHA256 SHA256HEX SHA256HMACHEX SIGN
|
75
|
+
SIN SINH SKEWNESS SLEEP SMALLEST SOAPWEB SOAPWEBMETA
|
76
|
+
SOAPWIPSERVICE SOAPWIPSRS SOAPWS SOAPWSMETA SOUNDEX SPEDIS SQRT
|
77
|
+
SQUANTILE STD STDERR STFIPS STNAME STNAMEL STRIP SUBPAD SUBSTR
|
78
|
+
SUBSTRN SUM SUMABS SYMEXIST SYMGET SYMGLOBL SYMLOCAL SYSEXIST
|
79
|
+
SYSGET SYSMSG SYSPARM SYSPROCESSID SYSPROCESSNAME SYSPROD SYSRC
|
80
|
+
SYSTEM TAN TANH TIME TIMEPART TIMEVALUE TINV TNONCT TODAY
|
81
|
+
TRANSLATE TRANSTRN TRANWRD TRIGAMMA TRIM TRIMN TRUNC TSO TYPEOF
|
82
|
+
TZONEID TZONENAME TZONEOFF TZONES2U TZONEU2S UNIFORM UPCASE
|
83
|
+
URLDECODE URLENCODE USS UUIDGEN VAR VARFMT VARINFMT VARLABEL
|
84
|
+
VARLEN VARNAME VARNUM VARRAY VARRAYX VARTYPE VERIFY VFORMAT
|
85
|
+
VFORMATD VFORMATDX VFORMATN VFORMATNX VFORMATW VFORMATWX VFORMATX
|
86
|
+
VINARRAY VINARRAYX VINFORMAT VINFORMATD VINFORMATDX VINFORMATN
|
87
|
+
VINFORMATNX VINFORMATW VINFORMATWX VINFORMATX VLABEL VLABELX
|
88
|
+
VLENGTH VLENGTHX VNAME VNAMEX VTYPE VTYPEX VVALUE VVALUEX WEEK
|
89
|
+
WEEKDAY WHICHC WHICHN WTO YEAR YIELDP YRDIF YYQ ZIPCITY
|
90
|
+
ZIPCITYDISTANCE ZIPFIPS ZIPNAME ZIPNAMEL ZIPSTATE
|
91
|
+
)
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.sas_macro_statements
|
95
|
+
# from SAS 9.4 Macro Language Reference
|
96
|
+
# Chapter 12
|
97
|
+
@sas_macro_statements ||= Set.new %w(
|
98
|
+
%COPY %DISPLAY %GLOBAL %INPUT %LET %MACRO %PUT %SYMDEL %SYSCALL
|
99
|
+
%SYSEXEC %SYSLPUT %SYSMACDELETE %SYSMSTORECLEAR %SYSRPUT %WINDOW
|
100
|
+
%ABORT %DO %TO %UNTIL %WHILE %END %GOTO %IF %THEN %ELSE %LOCAL
|
101
|
+
%RETURN
|
102
|
+
%INCLUDE %LIST %RUN
|
103
|
+
)
|
104
|
+
# Omitted:
|
105
|
+
# %label: Identifies the destination of a %GOTO statement.
|
106
|
+
# %MEND
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.sas_macro_functions
|
110
|
+
# from SAS 9.4 Macro Language Reference
|
111
|
+
# Chapter 12
|
112
|
+
|
113
|
+
@sas_macro_functions ||= Set.new %w(
|
114
|
+
%BQUOTE %NRBQUOTE %EVAL %INDEX %LENGTH %QUOTE %NRQUOTE %SCAN
|
115
|
+
%QSCAN %STR %NRSTR %SUBSTR %QSUBSTR %SUPERQ %SYMEXIST %SYMGLOBL
|
116
|
+
%SYMLOCAL %SYSEVALF %SYSFUNC %QSYSFUNC %SYSGET %SYSMACEXEC
|
117
|
+
%SYSMACEXIST %SYSMEXECDEPTH %SYSMEXECNAME %SYSPROD %UNQUOTE
|
118
|
+
%UPCASE %QUPCASE
|
119
|
+
)
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.sas_auto_macro_vars
|
123
|
+
# from SAS 9.4 Macro Language Reference
|
124
|
+
# Chapter 12
|
125
|
+
|
126
|
+
@sas_auto_macro_vars ||= Set.new %w(
|
127
|
+
&SYSADDRBITS &SYSBUFFR &SYSCC &SYSCHARWIDTH &SYSCMD &SYSDATASTEPPHASE &SYSDATE
|
128
|
+
&SYSDATE9 &SYSDAY &SYSDEVIC &SYSDMG &SYSDSN &SYSENCODING &SYSENDIAN &SYSENV
|
129
|
+
&SYSERR &SYSERRORTEXT &SYSFILRC &SYSHOSTINFOLONG &SYSHOSTNAME &SYSINDEX
|
130
|
+
&SYSINFO &SYSJOBID &SYSLAST &SYSLCKRC &SYSLIBRC &SYSLOGAPPLNAME &SYSMACRONAME
|
131
|
+
&SYSMENV &SYSMSG &SYSNCPU &SYSNOBS &SYSODSESCAPECHAR &SYSODSPATH &SYSPARM
|
132
|
+
&SYSPBUFF &SYSPRINTTOLIST &SYSPRINTTOLOG &SYSPROCESSID &SYSPROCESSMODE
|
133
|
+
&SYSPROCESSNAME &SYSPROCNAME &SYSRC &SYSSCP &SYSSCPL &SYSSITE &SYSSIZEOFLONG
|
134
|
+
&SYSSIZEOFPTR &SYSSIZEOFUNICODE &SYSSTARTID &SYSSTARTNAME &SYSTCPIPHOSTNAME
|
135
|
+
&SYSTIME &SYSTIMEZONE &SYSTIMEZONEIDENT &SYSTIMEZONEOFFSET &SYSUSERID &SYSVER
|
136
|
+
&SYSVLONG &SYSVLONG4 &SYSWARNINGTEXT
|
137
|
+
)
|
138
|
+
end
|
139
|
+
|
140
|
+
def self.proc_keywords
|
141
|
+
# Create a hash with keywords for common PROCs, keyed by PROC name
|
142
|
+
@proc_keywords ||= {}
|
143
|
+
|
144
|
+
@proc_keywords["SQL"] ||= Set.new %w(
|
145
|
+
ALTER TABLE CONNECT CREATE INDEX VIEW DELETE DESCRIBE DISCONNECT DROP EXECUTE
|
146
|
+
INSERT RESET SELECT UPDATE VALIDATE ADD CONSTRAINT DROP FOREIGN KEY PRIMARY
|
147
|
+
MODIFY LIKE AS ORDER BY USING FROM INTO SET VALUES RESET DISTINCT UNIQUE
|
148
|
+
WHERE GROUP HAVING LEFT RIGHT INNER JOIN ON
|
149
|
+
)
|
150
|
+
# from SAS 9.4 SQL Procedure User's Guide
|
151
|
+
|
152
|
+
@proc_keywords["MEANS"] ||= Set.new %w(
|
153
|
+
BY CLASS FREQ ID OUTPUT OUT TYPES VAR WAYS WEIGHT
|
154
|
+
ATTRIB FORMAT LABEL WHERE
|
155
|
+
DESCENDING NOTSORTED
|
156
|
+
NOTHREADS NOTRAP PCTLDEF SUMSIZE THREADS CLASSDATA COMPLETETYPES
|
157
|
+
EXCLUSIVE MISSING FW MAXDEC NONOBS NOPRINT ORDER FORMATTED FREQ
|
158
|
+
UNFORMATTED PRINT PRINTALLTYPES PRINTIDVARS STACKODSOUTPUT
|
159
|
+
CHARTYPE DESCENDTYPES IDMIN
|
160
|
+
ALPHA EXCLNPWGT QMARKERS QMETHOD QNTLDEF VARDEF
|
161
|
+
CLM CSS CV KURTOSIS KURT LCLM MAX MEAN MIN MODE N
|
162
|
+
NMISS RANGE SKEWNESS SKEW STDDEV STD STDERR SUM SUMWGT UCLM USS VAR
|
163
|
+
MEDIAN P50 Q1 P25 Q3 P75 P1 P90 P5 P95 P10 P99 P20 P30 P40 P60 P70
|
164
|
+
P80 QRANGE
|
165
|
+
PROBT PRT T
|
166
|
+
ASCENDING GROUPINTERNAL MLF PRELOADFMT
|
167
|
+
MAXID AUTOLABEL AUTONAME KEEPLEN LEVELS NOINHERIT
|
168
|
+
)
|
169
|
+
# from BASE SAS 9.4 Procedures Guide, Fifth Edition
|
170
|
+
|
171
|
+
@proc_keywords["DATASETS"] ||= Set.new %w(
|
172
|
+
AGE APPEND ATTRIB AUDIT CHANGE CONTENTS COPY DELETE EXCHANGE
|
173
|
+
EXCLUDE FORMAT IC CREATE DELETE REACTIVATE INDEX CENTILES INFORMAT
|
174
|
+
INITIATE LABEL LOG MODIFY REBUILD RENAME REPAIR RESUME SAVE SELECT
|
175
|
+
SUSPEND TERMINATE USER_VAR XATTR ADD OPTIONS REMOVE SET
|
176
|
+
)
|
177
|
+
# from BASE SAS 9.4 Procedures Guide, Fifth Edition
|
178
|
+
|
179
|
+
@proc_keywords["SORT"] ||= Set.new %w(
|
180
|
+
BY DESCENDING KEY ASCENDING ASC DESC DATECOPY FORCE OVERWRITE
|
181
|
+
PRESORTED SORTSIZE TAGSORT DUPOUT OUT UNIQUEOUT NODUPKEY NOUNIQUEKEY
|
182
|
+
NOTHREADS THREADS EQUALS NOEQUALS
|
183
|
+
ATTRIB FORMAT LABEL WHERE
|
184
|
+
)
|
185
|
+
# from BASE SAS 9.4 Procedures Guide, Fifth Edition
|
186
|
+
|
187
|
+
@proc_keywords["PRINT"] ||= Set.new %w(
|
188
|
+
BY DESCENDING NOTSORTED PAGEBY SUMBY ID STYLE SUM VAR CONTENTS DATA
|
189
|
+
GRANDTOTAL_LABEL HEADING LABEL SPLIT SUMLABEL NOSUMLABEL
|
190
|
+
BLANKLINE COUNT DOUBLE N NOOBS OBS ROUND
|
191
|
+
ROWS UNIFORM WIDTH
|
192
|
+
ATTRIB FORMAT LABEL WHERE
|
193
|
+
)
|
194
|
+
# from BASE SAS 9.4 Procedures Guide, Fifth Edition
|
195
|
+
|
196
|
+
@proc_keywords["APPEND"] ||= Set.new %w(
|
197
|
+
BASE APPENDVER DATA ENCRYPTKEY FORCE GETSORT NOWARN
|
198
|
+
ATTRIB FORMAT LABEL WHERE
|
199
|
+
)
|
200
|
+
# from BASE SAS 9.4 Procedures Guide, Fifth Edition
|
201
|
+
|
202
|
+
@proc_keywords["TRANSPOSE"] ||= Set.new %w(
|
203
|
+
DELIMITER LABEL LET NAME OUT PREFIX SUFFIX BY DESCENDING NOTSORTED
|
204
|
+
COPY ID IDLABEL VAR INDB
|
205
|
+
ATTRIB FORMAT LABEL WHERE
|
206
|
+
)
|
207
|
+
# from BASE SAS 9.4 Procedures Guide, Fifth Edition
|
208
|
+
|
209
|
+
@proc_keywords["FREQ"] ||= Set.new %w(
|
210
|
+
BY EXACT OUTPUT TABLES TEST WEIGHT
|
211
|
+
COMPRESS DATA FORMCHAR NLEVELS NOPRINT ORDER PAGE FORMATTED FREQ
|
212
|
+
INTERNAL
|
213
|
+
AGREE BARNARD BINOMIAL BIN CHISQ COMOR EQOR ZELEN FISHER JT KAPPA
|
214
|
+
KENTB TAUB LRCHI MCNEM MEASURES MHCHI OR ODDSRATIO PCHI PCORR RELRISK
|
215
|
+
RISKDIFF SCORR SMDCR SMDRC STUTC TAUC TREND WTKAP WTKAPPA
|
216
|
+
OUT AJCHI ALL BDCHI CMH CMH1 CMH2 CMHCOR CMHGA CMHRMS COCHQ CONTGY
|
217
|
+
CRAMV EQKAP EQWKP GAMMA GS GAILSIMON LAMCR LAMDAS LAMRC LGOR LGRRC1
|
218
|
+
LGRRC2 MHOR MHRRC1 MHRRC2 N NMISS PHI PLCORR RDIF1 RDIF2 RISKDIFF1
|
219
|
+
RISKDIFF2 RRC1 RELRISK1 RRC2 RELRISK2 RSK1 RISK1 RSK11 RISK11 RSK12
|
220
|
+
RISK12 RSK21 RISK21 RSK22 RISK22 TSYMM BOWKER U UCR URC
|
221
|
+
CELLCHI2 CUMCOL DEVIATION EXPECTED MISSPRINT PEARSONREF PRINTWKTS
|
222
|
+
SCOROUT SPARSE STDRES TOTPCT
|
223
|
+
CONTENTS CROSSLIST FORMAT LIST MAXLEVELS NOCOL NOCUM NOFREQ NOPERCENT
|
224
|
+
NOPRINT NOROW NOSPARSE NOWARN PLOTS OUT OUTCUM OUTEXPECT OUTPCT
|
225
|
+
ZEROS
|
226
|
+
)
|
227
|
+
# from Base SAS 9.4 Procedures Guide: Statistical Procedures, Fourth Edition
|
228
|
+
|
229
|
+
@proc_keywords["CORR"] ||= Set.new %w(
|
230
|
+
BY FREQ ID PARTIAL VAR WEIGHT WITH
|
231
|
+
DATA OUTH OUTK OUTP OUTPLC OUTPLS OUTS
|
232
|
+
EXCLNPWGHT FISHER HOEFFDING KENDALL NOMISS PEARSON POLYCHORIC
|
233
|
+
POLYSERIAL ALPHA COV CSSCP SINGULAR SSCP VARDEF PLOTS MATRIX SCATTER
|
234
|
+
BEST NOCORR NOPRINT NOPROB NOSIMPLE RANK
|
235
|
+
)
|
236
|
+
# from Base SAS 9.4 Procedures Guide: Statistical Procedures, Fourth Edition
|
237
|
+
|
238
|
+
@proc_keywords["REPORT"] ||= Set.new %w(
|
239
|
+
BREAK BY DESCENDING NOTSORTED COLUMN COMPUTE STYLE LINE ENDCOMP
|
240
|
+
CALL DEFINE _ROW_ FREQ RBREAK WEIGHT
|
241
|
+
ATTRIB FORMAT LABEL WHERE
|
242
|
+
DATA NOALIAS NOCENTER NOCOMPLETECOLS NOCOMPLETEROWS NOTHREADS
|
243
|
+
NOWINDOWS OUT PCTLDEF THREADS WINDOWS COMPLETECOLS NOCOMPLETECOLS
|
244
|
+
COMPLETEROWS NOCOMPLETEROWS CONTENTS SPANROWS COMMAND HELP PROMPT
|
245
|
+
BOX BYPAGENO CENTER NOCENTER COLWIDTH FORMCHAR LS MISSING PANELS PS
|
246
|
+
PSPACE SHOWALL SPACING WRAP EXCLNPWGT QMARKERS QMETHOD QNTLDEF VARDEF
|
247
|
+
NAMED NOHEADER SPLIT HEADLINE HEADSKIP LIST NOEXEC OUTREPT PROFILE
|
248
|
+
REPORT
|
249
|
+
COLOR DOL DUL OL PAGE SKIP SUMMARIZE SUPPRESS UL
|
250
|
+
BLINK COMMAND HIGHLIGHT RVSVIDEO MERGE REPLACE URL URLBP URLP
|
251
|
+
AFTER BEFORE _PAGE_ LEFT RIGHT CHARACTER LENGTH
|
252
|
+
EXCLUSIVE MISSING MLF ORDER DATA FORMATTED FREQ INTERNAL PRELOADFMT
|
253
|
+
WIDTH
|
254
|
+
ACROSS ANALYSIS COMPUTED DISPLAY GROUP ORDER
|
255
|
+
CONTENTS FLOW ID NOPRINT NOZERO PAGE
|
256
|
+
CSS CV MAX MEAN MIN MODE N NMISS PCTN PCTSUM RANGE STD STDERR SUM
|
257
|
+
SUMWGT USS VAR
|
258
|
+
MEDIAN P50 Q1 P25 Q3 P75 P1 P90 P5 P95 P10 P99 P20 P30 P40 P60 P70
|
259
|
+
P80 QRANGE
|
260
|
+
PROBT PRT T
|
261
|
+
)
|
262
|
+
# from BASE SAS 9.4 Procedures Guide, Fifth Edition
|
263
|
+
|
264
|
+
@proc_keywords["METALIB"] ||= Set.new %w(
|
265
|
+
OMR DBAUTH DBUSER DBPASSWORD EXCLUDE SELECT READ FOLDER FOLDERID
|
266
|
+
IMPACT_LIMIT NOEXEC PREFIX REPORT UPDATE_RULE DELETE NOADD NODELDUP
|
267
|
+
NOUPDATE
|
268
|
+
LIBID LIBRARY LIBURI
|
269
|
+
TYPE DETAIL SUMMARY
|
270
|
+
)
|
271
|
+
# from SAS 9.4 Language Interfaces to Metadata, Third Edition
|
272
|
+
|
273
|
+
@proc_keywords["GCHART"] ||= Set.new %w(
|
274
|
+
DATA ANNOTATE GOUT IMAGEMAP BLOCK HBAR HBAR3D VBAR VBAR3D PIE PIE3D
|
275
|
+
DONUT STAR ANNO
|
276
|
+
BY NOTE FORMAT LABEL WHERE
|
277
|
+
BLOCKMAX CAXIS COUTLINE CTEXT LEGEND NOHEADING NOLEGEND PATTERNID
|
278
|
+
GROUP MIDPOINT SUBGROUP WOUTLINE DESCRIPTION NAME DISCRETE LEVELS
|
279
|
+
OLD MISSING HTML_LEGEND HTML URL FREQ G100 SUMVAR TYPE
|
280
|
+
CAUTOREF CERROR CFRAME CLM CREF FRAME NOFRAME GSPACE IFRAME
|
281
|
+
IMAGESTYLE TILE FIT LAUTOREF NOSYMBOL PATTERNID SHAPE SPACE
|
282
|
+
SUBOUTSIDE WAUTOREF WIDTH WOUTLINE WREF
|
283
|
+
ASCENDING AUTOREF CLIPREF DESCENDING FRONTREF GAXIS MAXIS MINOR
|
284
|
+
NOAXIS NOBASEREF NOZERO RANGE AXIS REF CFREQ CFREQLABEL NONE CPERCENT
|
285
|
+
CPERCENTLABEL ERRORBAR BARS BOTH TOP FREQLABEL INSIDE MEAN MEANLABEL
|
286
|
+
NOSTATS OUTSIDE PERCENT PERCENTLABEL PERCENTSUM SUM
|
287
|
+
CFILL COUTLINE DETAIL_RADIUS EXPLODE FILL SOLID X INVISIBLE NOHEADING
|
288
|
+
RADIUS WOUTLINE DETAIL_THRESHOLD DETAIL_PERCENT DETAIL_SLICE
|
289
|
+
DETAIL_VALUE DONUTPCT LABEL ACROSS DOWN GROUP NOGROUPHEADING SUBGROUP
|
290
|
+
MATCHCOLOR OTHERCOLOR OTHERLABEL PERCENT ARROW PLABEL PPERCENT SLICE
|
291
|
+
VALUE
|
292
|
+
ANGLE ASCENDING CLOCKWISE DESCENDING JSTYLE
|
293
|
+
NOCONNECT STARMAX STARMIN
|
294
|
+
)
|
295
|
+
# from SAS GRAPH 9.4 Reference, Fourth Edition
|
296
|
+
|
297
|
+
@proc_keywords["GPLOT"] ||= Set.new %w(
|
298
|
+
DATA ANNOTATE GOUT IMAGEMAP UNIFORM BUBBLE BUBBLE2 PLOT PLOT2
|
299
|
+
BCOLOR BFILL BFONT BLABEL BSCALE AREA RADIUS BSIZE DESCRIPTION NAME
|
300
|
+
AUTOHREF CAUTOHREF CHREF HAXIS HMINOR HREF HREVERSE HZERO LAUTOHREF
|
301
|
+
LHREF WAUTOHREF WHREF HTML URL
|
302
|
+
CAXIS CFRAME CTEXT DATAORDER FRAME NOFRAME FRONTREF GRID IFRAME
|
303
|
+
IMAGESTYLE TILE FIT NOAXIS
|
304
|
+
AUTOVREF CAUTOVREF CVREF LAUTOVREF LVREF VAXIS VMINOR VREF VREVERSE
|
305
|
+
VZERO WAUTOVREF WVREF
|
306
|
+
CBASELINE COUTLINE
|
307
|
+
AREAS GRID LEGEND NOLASTAREA NOLEGEND OVERLAY REGEQN SKIPMISS
|
308
|
+
)
|
309
|
+
# from SAS GRAPH 9.4 Reference, Fourth Edition
|
310
|
+
|
311
|
+
@proc_keywords["REG"] ||= Set.new %w(
|
312
|
+
MODEL BY FREQ ID VAR WEIGHT ADD CODE DELETE MTEST OUTPUT PAINT
|
313
|
+
PLOT PRINT REFIT RESTRICT REWEIGHT STORE TEST
|
314
|
+
)
|
315
|
+
# from SAS/STAT 15.1 User's Guide
|
316
|
+
|
317
|
+
@proc_keywords["SGPLOT"] ||= Set.new %w(
|
318
|
+
STYLEATTRS BAND X Y UPPER LOWER BLOCK BUBBLE DENSITY DOT DROPLINE
|
319
|
+
ELLIPSE ELLIPSEPARM FRINGE GRADLEGEND HBAR HBARBASIC HBARPARM
|
320
|
+
HBOX HEATMAP HEATMAPPARM HIGHLOW HISTOGRAM HLINE INSET KEYLEGEND
|
321
|
+
LINEPARM LOESS NEEDLE PBSPLINE POLYGON REFLINE REG SCATTER SERIES
|
322
|
+
SPLINE STEP SYMBOLCHAR SYMBOLIMAGE TEXT VBAR VBARBASIC VBARPARM
|
323
|
+
VBOX VECTOR VLINE WATERFALL XAXIS X2AXIS XAXISTABLE YAXIS Y2AXIS
|
324
|
+
YAXISTABLE
|
325
|
+
)
|
326
|
+
# from ODS Graphics: Procedures Guide, Sixth Edition
|
327
|
+
return @proc_keywords
|
328
|
+
end
|
329
|
+
|
330
|
+
def self.sas_proc_names
|
331
|
+
# from SAS Procedures by Name
|
332
|
+
# http://support.sas.com/documentation/cdl/en/allprodsproc/68038/HTML/default/viewer.htm#procedures.htm
|
333
|
+
|
334
|
+
@sas_proc_names ||= Set.new %w(
|
335
|
+
ACCESS ACECLUS ADAPTIVEREG ALLELE ANOM ANOVA APPEND APPSRV ARIMA
|
336
|
+
AUTHLIB AUTOREG BCHOICE BOM BOXPLOT BTL BUILD CALENDAR CALIS CALLRFC
|
337
|
+
CANCORR CANDISC CAPABILITY CASECONTROL CATALOG CATMOD CDISC CDISC
|
338
|
+
CHART CIMPORT CLP CLUSTER COMPARE COMPILE COMPUTAB CONTENTS CONVERT
|
339
|
+
COPULA COPY CORR CORRESP COUNTREG CPM CPORT CUSUM CV2VIEW DATEKEYS
|
340
|
+
DATASETS DATASOURCE DB2EXT DB2UTIL DBCSTAB DBF DBLOAD DELETE DIF
|
341
|
+
DISCRIM DISPLAY DISTANCE DMSRVADM DMSRVDATASVC DMSRVPROCESSSVC
|
342
|
+
DOCUMENT DOWNLOAD DQLOCLST DQMATCH DQSCHEME DS2 DTREE ENTROPY ESM
|
343
|
+
EXPAND EXPLODE EXPORT FACTEX FACTOR FAMILY FASTCLUS FCMP FEDSQL FMM
|
344
|
+
FONTREG FORECAST FORMAT FORMS FREQ FSBROWSE FSEDIT FSLETTER FSLIST
|
345
|
+
FSVIEW G3D G3GRID GA GAM GAMPL GANNO GANTT GAREABAR GBARLINE GCHART
|
346
|
+
GCONTOUR GDEVICE GEE GENESELECT GENMOD GEOCODE GFONT GINSIDE GIS GKPI
|
347
|
+
GLIMMIX GLM GLMMOD GLMPOWER GLMSELECT GMAP GOPTIONS GPLOT GPROJECT
|
348
|
+
GRADAR GREDUCE GREMOVE GREPLAY GROOVY GSLIDE GTILE HADOOP HAPLOTYPE
|
349
|
+
HDMD HPBIN HPCANDISC HPCDM HPCOPULA HPCORR HPCOUNTREG HPDMDB HPDS2
|
350
|
+
HPFMM HPGENSELECT HPIMPUTE HPLMIXED HPLOGISTIC HPMIXED HPNLMOD
|
351
|
+
HPPANEL HPPLS HPPRINCOMP HPQUANTSELECT HPQLIM HPREG HPSAMPLE
|
352
|
+
HPSEVERITY HPSPLIT HPSUMMARY HTSNP HTTP ICLIFETEST ICPHREG IML IMPORT
|
353
|
+
IMSTAT IMXFER INBREED INFOMAPS INTPOINT IOMOPERATE IRT ISHIKAWA ITEMS
|
354
|
+
JAVAINFO JSON KDE KRIGE2D LASR LATTICE LIFEREG LIFETEST LOAN
|
355
|
+
LOCALEDATA LOESS LOGISTIC LP LUA MACONTROL MAPIMPORT MCMC MDC MDDB
|
356
|
+
MDS MEANS METADATA METALIB METAOPERATE MI MIANALYZE MIGRATE MIXED
|
357
|
+
MODECLUS MODEL MSCHART MULTTEST MVPDIAGNOSE MVPMODEL MVPMONITOR
|
358
|
+
NESTED NETDRAW NETFLOW NLIN NLMIXED NLP NPAR1WAY ODSLIST ODSTABLE
|
359
|
+
ODSTEXT OLAP OLAPCONTENTS OLAPOPERATE OPERATE OPTEX OPTGRAPH OPTIONS
|
360
|
+
OPTLOAD OPTLP OPTLSO OPTMILP OPTMODEL OPTNET OPTQP OPTSAVE ORTHOREG
|
361
|
+
PANEL PARETO PDLREG PDS PDSCOPY PHREG PLAN PLM PLOT PLS PM PMENU
|
362
|
+
POWER PRESENV PRINCOMP PRINQUAL PRINT PRINTTO PROBIT PROTO PRTDEF
|
363
|
+
PRTEXP PSMOOTH PWENCODE QDEVICE QLIM QUANTLIFE QUANTREG QUANTSELECT
|
364
|
+
QUEST RANK RAREEVENTS RDC RDPOOL RDSEC RECOMMEND REG REGISTRY RELEASE
|
365
|
+
RELIABILITY REPORT RISK ROBUSTREG RSREG SCAPROC SCORE SEQDESIGN
|
366
|
+
SEQTEST SERVER SEVERITY SGDESIGN SGPANEL SGPLOT SGRENDER SGSCATTER
|
367
|
+
SHEWHART SIM2D SIMILARITY SIMLIN SIMNORMAL SOAP SORT SOURCE SPECTRA
|
368
|
+
SPP SQL SQOOP SSM STANDARD STATESPACE STDIZE STDRATE STEPDISC STP
|
369
|
+
STREAM SUMMARY SURVEYFREQ SURVEYIMPUTE SURVEYLOGISTIC SURVEYMEANS
|
370
|
+
SURVEYPHREG SURVEYREG SURVEYSELECT SYSLIN TABULATE TAPECOPY TAPELABEL
|
371
|
+
TEMPLATE TIMEDATA TIMEID TIMEPLOT TIMESERIES TPSPLINE TRANSPOSE
|
372
|
+
TRANSREG TRANTAB TREE TSCSREG TTEST UCM UNIVARIATE UPLOAD VARCLUS
|
373
|
+
VARCOMP VARIOGRAM VARMAX VASMP X11 X12 X13 XSL
|
374
|
+
)
|
375
|
+
end
|
376
|
+
|
377
|
+
state :basics do
|
378
|
+
# Rules to be parsed before the keywords (which are different depending
|
379
|
+
# on the context)
|
380
|
+
|
381
|
+
rule %r/\s+/m, Text
|
382
|
+
|
383
|
+
# Single-line comments (between * and ;) - these can actually go onto multiple lines
|
384
|
+
# case 1 - where it starts a line
|
385
|
+
rule %r/^\s*%?\*[^;]*;/m, Comment::Single
|
386
|
+
# case 2 - where it follows the previous statement on the line (after a semicolon)
|
387
|
+
rule %r/(;)(\s*)(%?\*[^;]*;)/m do
|
388
|
+
groups Punctuation, Text, Comment::Single
|
389
|
+
end
|
390
|
+
|
391
|
+
# True multiline comments!
|
392
|
+
rule %r(/[*].*?[*]/)m, Comment::Multiline
|
393
|
+
|
394
|
+
# date/time constants (Language Reference pp91-2)
|
395
|
+
rule %r/'[0-9a-z]+?'d/i, Literal::Date
|
396
|
+
rule %r/'.+?'dt/i, Literal::Date
|
397
|
+
rule %r/'[0-9:]+?([a|p]m)?'t/i, Literal::Date
|
398
|
+
|
399
|
+
rule %r/'/, Str::Single, :single_string
|
400
|
+
rule %r/"/, Str::Double, :double_string
|
401
|
+
rule %r/&[a-z0-9_&.]+/i, Name::Variable
|
402
|
+
|
403
|
+
# numeric constants (Language Reference p91)
|
404
|
+
rule %r/\d[0-9a-f]*x/i, Num::Hex
|
405
|
+
rule %r/\d[0-9e\-.]+/i, Num # scientific notation
|
406
|
+
|
407
|
+
# auto variables from DATA step (Language Reference p46, p37)
|
408
|
+
rule %r/\b(_n_|_error_|_file_|_infile_|_msg_|_iorc_|_cmd_)\b/i, Name::Builtin::Pseudo
|
409
|
+
|
410
|
+
# auto variable list names
|
411
|
+
rule %r/\b(_character_|_numeric_|_all_)\b/i, Name::Builtin
|
412
|
+
|
413
|
+
# datalines/cards etc
|
414
|
+
rule %r/\b(datalines|cards)(\s*)(;)/i do
|
415
|
+
groups Keyword, Text, Punctuation
|
416
|
+
push :datalines
|
417
|
+
end
|
418
|
+
rule %r/\b(datalines4|cards4)(\s*)(;)/i do
|
419
|
+
groups Keyword, Text, Punctuation
|
420
|
+
push :datalines4
|
421
|
+
end
|
422
|
+
|
423
|
+
|
424
|
+
# operators (Language Reference p96)
|
425
|
+
rule %r(\*\*|[\*/\+-]), Operator
|
426
|
+
rule %r/[^¬~]?=:?|[<>]=?:?/, Operator
|
427
|
+
rule %r/\b(eq|ne|gt|lt|ge|le|in)\b/i, Operator::Word
|
428
|
+
rule %r/[&|!¦¬∘~]/, Operator
|
429
|
+
rule %r/\b(and|or|not)\b/i, Operator::Word
|
430
|
+
rule %r/(<>|><)/, Operator # min/max
|
431
|
+
rule %r/\|\|/, Operator # concatenation
|
432
|
+
|
433
|
+
# The OF operator should also be highlighted (Language Reference p49)
|
434
|
+
rule %r/\b(of)\b/i, Operator::Word
|
435
|
+
rule %r/\b(like)\b/i, Operator::Word # Language Ref p181
|
436
|
+
|
437
|
+
rule %r/\d+/, Num::Integer
|
438
|
+
|
439
|
+
rule %r/\$/, Keyword::Type
|
440
|
+
|
441
|
+
# Macro definitions
|
442
|
+
rule %r/(%macro|%mend)(\s*)(\w+)/i do
|
443
|
+
groups Keyword, Text, Name::Function
|
444
|
+
end
|
445
|
+
rule %r/%mend/, Keyword
|
446
|
+
|
447
|
+
rule %r/%\w+/ do |m|
|
448
|
+
if self.class.sas_macro_statements.include? m[0].upcase
|
449
|
+
token Keyword
|
450
|
+
elsif self.class.sas_macro_functions.include? m[0].upcase
|
451
|
+
token Keyword
|
452
|
+
else
|
453
|
+
token Name
|
454
|
+
end
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
state :basics2 do
|
459
|
+
# Rules to be parsed after the keywords (which are different depending
|
460
|
+
# on the context)
|
461
|
+
|
462
|
+
# Missing values (Language Reference p81)
|
463
|
+
rule %r/\s\.[;\s]/, Keyword::Constant # missing
|
464
|
+
rule %r/\s\.[a-z_]/, Name::Constant # user-defined missing
|
465
|
+
|
466
|
+
rule %r/[\(\),;:\{\}\[\]\\\.]/, Punctuation
|
467
|
+
|
468
|
+
rule %r/@/, Str::Symbol # line hold specifiers
|
469
|
+
rule %r/\?/, Str::Symbol # used for format modifiers
|
470
|
+
|
471
|
+
rule %r/[^\s]+/, Text # Fallback for anything we haven't matched so far
|
472
|
+
end
|
473
|
+
|
474
|
+
state :root do
|
475
|
+
mixin :basics
|
476
|
+
|
477
|
+
# PROC definitions
|
478
|
+
rule %r!(proc)(\s+)(\w+)!ix do |m|
|
479
|
+
@proc_name = m[3].upcase
|
480
|
+
puts " proc name: #{@proc_name}" if @debug
|
481
|
+
if self.class.sas_proc_names.include? @proc_name
|
482
|
+
groups Keyword, Text, Keyword
|
483
|
+
else
|
484
|
+
groups Keyword, Text, Name
|
485
|
+
end
|
486
|
+
|
487
|
+
push :proc
|
488
|
+
end
|
489
|
+
|
490
|
+
# Data step definitions
|
491
|
+
rule %r/(data)(\s+)([\w\.]+)/i do
|
492
|
+
groups Keyword, Text, Name::Variable
|
493
|
+
end
|
494
|
+
# Libname definitions
|
495
|
+
rule %r/(libname)(\s+)(\w+)/i do
|
496
|
+
groups Keyword, Text, Name::Variable
|
497
|
+
end
|
498
|
+
|
499
|
+
rule %r/\w+/ do |m|
|
500
|
+
if self.class.data_step_statements.include? m[0].upcase
|
501
|
+
token Keyword
|
502
|
+
elsif self.class.sas_functions.include? m[0].upcase
|
503
|
+
token Keyword
|
504
|
+
else
|
505
|
+
token Name
|
506
|
+
end
|
507
|
+
end
|
508
|
+
|
509
|
+
mixin :basics2
|
510
|
+
end
|
511
|
+
|
512
|
+
|
513
|
+
state :single_string do
|
514
|
+
rule %r/''/, Str::Escape
|
515
|
+
rule %r/'/, Str::Single, :pop!
|
516
|
+
rule %r/[^']+/, Str::Single
|
517
|
+
end
|
518
|
+
|
519
|
+
state :double_string do
|
520
|
+
rule %r/&[a-z0-9_&]+\.?/i, Str::Interpol
|
521
|
+
rule %r/""/, Str::Escape
|
522
|
+
rule %r/"/, Str::Double, :pop!
|
523
|
+
|
524
|
+
rule %r/[^&"]+/, Str::Double
|
525
|
+
# Allow & to be used as character if not already matched as macro variable
|
526
|
+
rule %r/&/, Str::Double
|
527
|
+
end
|
528
|
+
|
529
|
+
state :datalines do
|
530
|
+
rule %r/[^;]/, Literal::String::Heredoc
|
531
|
+
rule %r/;/, Punctuation, :pop!
|
532
|
+
end
|
533
|
+
|
534
|
+
state :datalines4 do
|
535
|
+
rule %r/;{4}/, Punctuation, :pop!
|
536
|
+
rule %r/[^;]/, Literal::String::Heredoc
|
537
|
+
rule %r/;{,3}/, Literal::String::Heredoc
|
538
|
+
end
|
539
|
+
|
540
|
+
|
541
|
+
# PROCS
|
542
|
+
state :proc do
|
543
|
+
rule %r/(quit|run)/i, Keyword, :pop!
|
544
|
+
|
545
|
+
mixin :basics
|
546
|
+
rule %r/\w+/ do |m|
|
547
|
+
if self.class.data_step_statements.include? m[0].upcase
|
548
|
+
token Keyword
|
549
|
+
elsif self.class.sas_functions.include? m[0].upcase
|
550
|
+
token Keyword
|
551
|
+
elsif self.class.proc_keywords.has_key?(@proc_name) and self.class.proc_keywords[@proc_name].include? m[0].upcase
|
552
|
+
token Keyword
|
553
|
+
else
|
554
|
+
token Name
|
555
|
+
end
|
556
|
+
end
|
557
|
+
|
558
|
+
mixin :basics2
|
559
|
+
end
|
560
|
+
|
561
|
+
end #class SAS
|
562
|
+
end #module Lexers
|
563
|
+
end #module Rouge
|