rouge_ecl 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +26 -0
- data/LICENSE +186 -0
- data/bin/rougify +17 -0
- data/lib/rouge.rb +82 -0
- data/lib/rouge/cli.rb +429 -0
- data/lib/rouge/demos/abap +6 -0
- data/lib/rouge/demos/actionscript +4 -0
- data/lib/rouge/demos/apache +21 -0
- data/lib/rouge/demos/apiblueprint +33 -0
- data/lib/rouge/demos/applescript +2 -0
- data/lib/rouge/demos/awk +4 -0
- data/lib/rouge/demos/biml +38 -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/clojure +5 -0
- data/lib/rouge/demos/cmake +7 -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/csharp +5 -0
- data/lib/rouge/demos/css +4 -0
- data/lib/rouge/demos/d +16 -0
- data/lib/rouge/demos/dart +6 -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 +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/erb +1 -0
- data/lib/rouge/demos/erlang +7 -0
- data/lib/rouge/demos/factor +5 -0
- data/lib/rouge/demos/fortran +22 -0
- data/lib/rouge/demos/fsharp +12 -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/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/java +5 -0
- data/lib/rouge/demos/javascript +1 -0
- data/lib/rouge/demos/jinja +9 -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/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 +11 -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/make +6 -0
- data/lib/rouge/demos/markdown +4 -0
- data/lib/rouge/demos/matlab +6 -0
- data/lib/rouge/demos/moonscript +16 -0
- data/lib/rouge/demos/mosel +10 -0
- data/lib/rouge/demos/mxml +22 -0
- data/lib/rouge/demos/nasm +26 -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/ocaml +12 -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 +142 -0
- data/lib/rouge/demos/pony +17 -0
- data/lib/rouge/demos/powershell +49 -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 +2 -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/ruby +9 -0
- data/lib/rouge/demos/rust +12 -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/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/sql +1 -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/tex +1 -0
- data/lib/rouge/demos/toml +9 -0
- data/lib/rouge/demos/tsx +17 -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/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/yaml +4 -0
- data/lib/rouge/formatter.rb +75 -0
- data/lib/rouge/formatters/html.rb +37 -0
- data/lib/rouge/formatters/html_inline.rb +30 -0
- data/lib/rouge/formatters/html_legacy.rb +44 -0
- data/lib/rouge/formatters/html_linewise.rb +27 -0
- data/lib/rouge/formatters/html_pygments.rb +16 -0
- data/lib/rouge/formatters/html_table.rb +61 -0
- data/lib/rouge/formatters/null.rb +19 -0
- data/lib/rouge/formatters/terminal256.rb +180 -0
- data/lib/rouge/guesser.rb +55 -0
- data/lib/rouge/guessers/disambiguation.rb +101 -0
- data/lib/rouge/guessers/filename.rb +25 -0
- data/lib/rouge/guessers/glob_mapping.rb +43 -0
- data/lib/rouge/guessers/mimetype.rb +14 -0
- data/lib/rouge/guessers/modeline.rb +44 -0
- data/lib/rouge/guessers/source.rb +29 -0
- data/lib/rouge/guessers/util.rb +32 -0
- data/lib/rouge/lexer.rb +461 -0
- data/lib/rouge/lexers/abap.rb +238 -0
- data/lib/rouge/lexers/actionscript.rb +195 -0
- data/lib/rouge/lexers/apache.rb +71 -0
- data/lib/rouge/lexers/apache/keywords.yml +764 -0
- data/lib/rouge/lexers/apiblueprint.rb +47 -0
- data/lib/rouge/lexers/apple_script.rb +367 -0
- data/lib/rouge/lexers/awk.rb +161 -0
- data/lib/rouge/lexers/biml.rb +41 -0
- data/lib/rouge/lexers/bsl.rb +81 -0
- data/lib/rouge/lexers/c.rb +212 -0
- data/lib/rouge/lexers/ceylon.rb +123 -0
- data/lib/rouge/lexers/cfscript.rb +153 -0
- data/lib/rouge/lexers/clojure.rb +112 -0
- data/lib/rouge/lexers/cmake.rb +206 -0
- data/lib/rouge/lexers/coffeescript.rb +174 -0
- data/lib/rouge/lexers/common_lisp.rb +345 -0
- data/lib/rouge/lexers/conf.rb +24 -0
- data/lib/rouge/lexers/console.rb +136 -0
- data/lib/rouge/lexers/coq.rb +187 -0
- data/lib/rouge/lexers/cpp.rb +78 -0
- data/lib/rouge/lexers/csharp.rb +114 -0
- data/lib/rouge/lexers/css.rb +273 -0
- data/lib/rouge/lexers/d.rb +176 -0
- data/lib/rouge/lexers/dart.rb +104 -0
- data/lib/rouge/lexers/diff.rb +31 -0
- data/lib/rouge/lexers/digdag.rb +68 -0
- data/lib/rouge/lexers/docker.rb +50 -0
- data/lib/rouge/lexers/dot.rb +68 -0
- data/lib/rouge/lexers/ecl.rb +138 -0
- data/lib/rouge/lexers/eiffel.rb +65 -0
- data/lib/rouge/lexers/elixir.rb +133 -0
- data/lib/rouge/lexers/elm.rb +89 -0
- data/lib/rouge/lexers/erb.rb +52 -0
- data/lib/rouge/lexers/erlang.rb +114 -0
- data/lib/rouge/lexers/factor.rb +302 -0
- data/lib/rouge/lexers/fortran.rb +176 -0
- data/lib/rouge/lexers/fsharp.rb +118 -0
- data/lib/rouge/lexers/gherkin.rb +137 -0
- data/lib/rouge/lexers/gherkin/keywords.rb +14 -0
- data/lib/rouge/lexers/glsl.rb +135 -0
- data/lib/rouge/lexers/go.rb +174 -0
- data/lib/rouge/lexers/gradle.rb +37 -0
- data/lib/rouge/lexers/graphql.rb +243 -0
- data/lib/rouge/lexers/groovy.rb +112 -0
- data/lib/rouge/lexers/hack.rb +48 -0
- data/lib/rouge/lexers/haml.rb +229 -0
- data/lib/rouge/lexers/handlebars.rb +79 -0
- data/lib/rouge/lexers/haskell.rb +182 -0
- data/lib/rouge/lexers/html.rb +139 -0
- data/lib/rouge/lexers/http.rb +80 -0
- data/lib/rouge/lexers/hylang.rb +93 -0
- data/lib/rouge/lexers/idlang.rb +310 -0
- data/lib/rouge/lexers/igorpro.rb +408 -0
- data/lib/rouge/lexers/ini.rb +53 -0
- data/lib/rouge/lexers/io.rb +68 -0
- data/lib/rouge/lexers/irb.rb +66 -0
- data/lib/rouge/lexers/java.rb +87 -0
- data/lib/rouge/lexers/javascript.rb +281 -0
- data/lib/rouge/lexers/jinja.rb +137 -0
- data/lib/rouge/lexers/json.rb +29 -0
- data/lib/rouge/lexers/json_doc.rb +23 -0
- data/lib/rouge/lexers/jsonnet.rb +151 -0
- data/lib/rouge/lexers/jsx.rb +102 -0
- data/lib/rouge/lexers/julia.rb +172 -0
- data/lib/rouge/lexers/kotlin.rb +79 -0
- data/lib/rouge/lexers/lasso.rb +214 -0
- data/lib/rouge/lexers/lasso/keywords.yml +446 -0
- data/lib/rouge/lexers/liquid.rb +287 -0
- data/lib/rouge/lexers/literate_coffeescript.rb +33 -0
- data/lib/rouge/lexers/literate_haskell.rb +36 -0
- data/lib/rouge/lexers/llvm.rb +80 -0
- data/lib/rouge/lexers/lua.rb +125 -0
- data/lib/rouge/lexers/lua/builtins.rb +22 -0
- data/lib/rouge/lexers/make.rb +112 -0
- data/lib/rouge/lexers/markdown.rb +154 -0
- data/lib/rouge/lexers/matlab.rb +71 -0
- data/lib/rouge/lexers/matlab/builtins.rb +11 -0
- data/lib/rouge/lexers/moonscript.rb +114 -0
- data/lib/rouge/lexers/mosel.rb +231 -0
- data/lib/rouge/lexers/mxml.rb +68 -0
- data/lib/rouge/lexers/nasm.rb +198 -0
- data/lib/rouge/lexers/nginx.rb +71 -0
- data/lib/rouge/lexers/nim.rb +152 -0
- data/lib/rouge/lexers/nix.rb +205 -0
- data/lib/rouge/lexers/objective_c.rb +194 -0
- data/lib/rouge/lexers/ocaml.rb +100 -0
- data/lib/rouge/lexers/pascal.rb +66 -0
- data/lib/rouge/lexers/perl.rb +196 -0
- data/lib/rouge/lexers/php.rb +193 -0
- data/lib/rouge/lexers/php/builtins.rb +194 -0
- data/lib/rouge/lexers/plain_text.rb +26 -0
- data/lib/rouge/lexers/plist.rb +45 -0
- data/lib/rouge/lexers/pony.rb +93 -0
- data/lib/rouge/lexers/powershell.rb +678 -0
- data/lib/rouge/lexers/praat.rb +350 -0
- data/lib/rouge/lexers/prolog.rb +59 -0
- data/lib/rouge/lexers/prometheus.rb +121 -0
- data/lib/rouge/lexers/properties.rb +51 -0
- data/lib/rouge/lexers/protobuf.rb +70 -0
- data/lib/rouge/lexers/puppet.rb +128 -0
- data/lib/rouge/lexers/python.rb +232 -0
- data/lib/rouge/lexers/q.rb +123 -0
- data/lib/rouge/lexers/qml.rb +73 -0
- data/lib/rouge/lexers/r.rb +89 -0
- data/lib/rouge/lexers/racket.rb +543 -0
- data/lib/rouge/lexers/ruby.rb +437 -0
- data/lib/rouge/lexers/rust.rb +192 -0
- data/lib/rouge/lexers/sass.rb +74 -0
- data/lib/rouge/lexers/sass/common.rb +180 -0
- data/lib/rouge/lexers/scala.rb +142 -0
- data/lib/rouge/lexers/scheme.rb +112 -0
- data/lib/rouge/lexers/scss.rb +34 -0
- data/lib/rouge/lexers/sed.rb +172 -0
- data/lib/rouge/lexers/shell.rb +189 -0
- data/lib/rouge/lexers/sieve.rb +96 -0
- data/lib/rouge/lexers/slim.rb +228 -0
- data/lib/rouge/lexers/smalltalk.rb +116 -0
- data/lib/rouge/lexers/smarty.rb +80 -0
- data/lib/rouge/lexers/sml.rb +344 -0
- data/lib/rouge/lexers/sql.rb +140 -0
- data/lib/rouge/lexers/swift.rb +181 -0
- data/lib/rouge/lexers/tap.rb +87 -0
- data/lib/rouge/lexers/tcl.rb +192 -0
- data/lib/rouge/lexers/tex.rb +69 -0
- data/lib/rouge/lexers/toml.rb +67 -0
- data/lib/rouge/lexers/tsx.rb +19 -0
- data/lib/rouge/lexers/tulip.rb +106 -0
- data/lib/rouge/lexers/turtle.rb +63 -0
- data/lib/rouge/lexers/twig.rb +39 -0
- data/lib/rouge/lexers/typescript.rb +22 -0
- data/lib/rouge/lexers/typescript/common.rb +33 -0
- data/lib/rouge/lexers/vala.rb +77 -0
- data/lib/rouge/lexers/vb.rb +164 -0
- data/lib/rouge/lexers/verilog.rb +164 -0
- data/lib/rouge/lexers/vhdl.rb +97 -0
- data/lib/rouge/lexers/viml.rb +101 -0
- data/lib/rouge/lexers/viml/keywords.rb +12 -0
- data/lib/rouge/lexers/vue.rb +122 -0
- data/lib/rouge/lexers/wollok.rb +103 -0
- data/lib/rouge/lexers/xml.rb +57 -0
- data/lib/rouge/lexers/yaml.rb +373 -0
- data/lib/rouge/plugins/redcarpet.rb +30 -0
- data/lib/rouge/regex_lexer.rb +441 -0
- data/lib/rouge/template_lexer.rb +20 -0
- data/lib/rouge/text_analyzer.rb +49 -0
- data/lib/rouge/theme.rb +213 -0
- data/lib/rouge/themes/base16.rb +130 -0
- data/lib/rouge/themes/colorful.rb +67 -0
- data/lib/rouge/themes/github.rb +71 -0
- data/lib/rouge/themes/gruvbox.rb +167 -0
- data/lib/rouge/themes/igor_pro.rb +20 -0
- data/lib/rouge/themes/molokai.rb +82 -0
- data/lib/rouge/themes/monokai.rb +92 -0
- data/lib/rouge/themes/monokai_sublime.rb +90 -0
- data/lib/rouge/themes/pastie.rb +69 -0
- data/lib/rouge/themes/thankful_eyes.rb +74 -0
- data/lib/rouge/themes/tulip.rb +69 -0
- data/lib/rouge/token.rb +182 -0
- data/lib/rouge/util.rb +101 -0
- data/lib/rouge/version.rb +7 -0
- data/rouge.gemspec +23 -0
- metadata +365 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
module Rouge
|
|
2
|
+
module Lexers
|
|
3
|
+
class Q < RegexLexer
|
|
4
|
+
title 'Q'
|
|
5
|
+
desc 'The Q programming language (kx.com)'
|
|
6
|
+
tag 'q'
|
|
7
|
+
aliases 'kdb+'
|
|
8
|
+
filenames '*.q'
|
|
9
|
+
mimetypes 'text/x-q', 'application/x-q'
|
|
10
|
+
|
|
11
|
+
identifier = /\.?[a-z][a-z0-9_.]*/i
|
|
12
|
+
|
|
13
|
+
def self.keywords
|
|
14
|
+
@keywords ||= %w[do if while select update delete exec from by]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.word_operators
|
|
18
|
+
@word_operators ||= %w[
|
|
19
|
+
and or except inter like each cross vs sv within where in asof bin binr cor cov cut ej fby
|
|
20
|
+
div ij insert lj ljf mavg mcount mdev mmax mmin mmu mod msum over prior peach pj scan scov setenv ss
|
|
21
|
+
sublist uj union upsert wavg wsum xasc xbar xcol xcols xdesc xexp xgroup xkey xlog xprev xrank
|
|
22
|
+
]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.builtins
|
|
26
|
+
@builtins ||= %w[
|
|
27
|
+
first enlist value type get set count string key max min sum prd last flip distinct raze neg
|
|
28
|
+
desc differ dsave dev eval exit exp fills fkeys floor getenv group gtime hclose hcount hdel hopen hsym
|
|
29
|
+
iasc idesc inv keys load log lsq ltime ltrim maxs md5 med meta mins next parse plist prds prev rand rank ratios
|
|
30
|
+
read0 read1 reciprocal reverse rload rotate rsave rtrim save sdev show signum sin sqrt ssr sums svar system
|
|
31
|
+
tables tan til trim txf ungroup var view views wj wj1 ww
|
|
32
|
+
]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
state :root do
|
|
36
|
+
# q allows a file to start with a shebang
|
|
37
|
+
rule /#!(.*?)$/, Comment::Preproc, :top
|
|
38
|
+
rule //, Text, :top
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
state :top do
|
|
42
|
+
# indented lines at the top of the file are ignored by q
|
|
43
|
+
rule /^[ \t\r]+.*$/, Comment::Special
|
|
44
|
+
rule /\n+/, Text
|
|
45
|
+
rule //, Text, :base
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
state :base do
|
|
49
|
+
rule /\n+/m, Text
|
|
50
|
+
rule(/^.\)/, Keyword::Declaration)
|
|
51
|
+
|
|
52
|
+
# Identifiers, word operators, etc.
|
|
53
|
+
rule /#{identifier}/ do |m|
|
|
54
|
+
if self.class.keywords.include? m[0]
|
|
55
|
+
token Keyword
|
|
56
|
+
elsif self.class.word_operators.include? m[0]
|
|
57
|
+
token Operator::Word
|
|
58
|
+
elsif self.class.builtins.include? m[0]
|
|
59
|
+
token Name::Builtin
|
|
60
|
+
elsif /^\.[zQqho]\./ =~ m[0]
|
|
61
|
+
token Name::Constant
|
|
62
|
+
else
|
|
63
|
+
token Name
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# White space and comments
|
|
68
|
+
rule(%r{[ \t\r]\/.*$}, Comment::Single)
|
|
69
|
+
rule(/[ \t\r]+/, Text::Whitespace)
|
|
70
|
+
rule(%r{^/$.*?^\\$}m, Comment::Multiline)
|
|
71
|
+
rule(%r{^\/[^\n]*$(\n[^\S\n]+.*$)*}, Comment::Multiline)
|
|
72
|
+
# til EOF comment
|
|
73
|
+
rule(/^\\$/, Comment, :bottom)
|
|
74
|
+
rule(/^\\\\\s+/, Keyword, :bottom)
|
|
75
|
+
|
|
76
|
+
# Literals
|
|
77
|
+
## strings
|
|
78
|
+
rule(/"/, Str, :string)
|
|
79
|
+
## timespan/stamp constants
|
|
80
|
+
rule(/(?:\d+D|\d{4}\.[01]\d\.[0123]\d[DT])(?:[012]\d:[0-5]\d(?::[0-5]\d(?:\.\d+)?)?|([012]\d)?)[zpn]?\b/,
|
|
81
|
+
Literal::Date)
|
|
82
|
+
## time/minute/second constants
|
|
83
|
+
rule(/[012]\d:[0-5]\d(?::[0-5]\d(\.\d+)?)?[uvtpn]?\b/, Literal::Date)
|
|
84
|
+
## date constants
|
|
85
|
+
rule(/\d{4}\.[01]\d\.[0-3]\d[dpnzm]?\b/, Literal::Date)
|
|
86
|
+
## special values
|
|
87
|
+
rule(/0[nNwW][hijefcpmdznuvt]?/, Keyword::Constant)
|
|
88
|
+
|
|
89
|
+
# operators to match before numbers
|
|
90
|
+
rule(%r{'|\/:|\\:|':|\\|\/|0:|1:|2:}, Operator)
|
|
91
|
+
|
|
92
|
+
## numbers
|
|
93
|
+
rule(/(\d+[.]\d*|[.]\d+)(e[+-]?\d+)?[ef]?/, Num::Float)
|
|
94
|
+
rule(/\d+e[+-]?\d+[ef]?/, Num::Float)
|
|
95
|
+
rule(/\d+[ef]/, Num::Float)
|
|
96
|
+
rule(/0x[0-9a-f]+/i, Num::Hex)
|
|
97
|
+
rule(/[01]+b/, Num::Bin)
|
|
98
|
+
rule(/[0-9]+[hij]?/, Num::Integer)
|
|
99
|
+
## symbols and paths
|
|
100
|
+
rule(%r{(`:[:a-z0-9._\/]*|`(?:[a-z0-9.][:a-z0-9._]*)?)}i, Str::Symbol)
|
|
101
|
+
rule(/(?:<=|>=|<>|::)|[?:$%&|@._#*^\-+~,!><=]:?/, Operator)
|
|
102
|
+
|
|
103
|
+
rule /[{}\[\]();]/, Punctuation
|
|
104
|
+
|
|
105
|
+
# commands
|
|
106
|
+
rule(/\\.*\n/, Text)
|
|
107
|
+
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
state :string do
|
|
111
|
+
rule(/"/, Str, :pop!)
|
|
112
|
+
rule /\\([\\nr]|[01][0-7]{2})/, Str::Escape
|
|
113
|
+
rule /[^\\"\n]+/, Str
|
|
114
|
+
rule /\\/, Str # stray backslash
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
state :bottom do
|
|
118
|
+
rule /.*\z/m, Comment::Multiline
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
|
2
|
+
|
|
3
|
+
module Rouge
|
|
4
|
+
module Lexers
|
|
5
|
+
load_lexer 'javascript.rb'
|
|
6
|
+
|
|
7
|
+
class Qml < Javascript
|
|
8
|
+
title "QML"
|
|
9
|
+
desc 'QML, a UI markup language'
|
|
10
|
+
tag 'qml'
|
|
11
|
+
aliases 'qml'
|
|
12
|
+
filenames '*.qml'
|
|
13
|
+
|
|
14
|
+
mimetypes 'application/x-qml', 'text/x-qml'
|
|
15
|
+
|
|
16
|
+
id_with_dots = /[$a-zA-Z_][a-zA-Z0-9_.]*/
|
|
17
|
+
|
|
18
|
+
prepend :root do
|
|
19
|
+
rule /(#{id_with_dots})(\s*)({)/ do
|
|
20
|
+
groups Keyword::Type, Text, Punctuation
|
|
21
|
+
push :type_block
|
|
22
|
+
end
|
|
23
|
+
rule /(#{id_with_dots})(\s+)(on)(\s+)(#{id_with_dots})(\s*)({)/ do
|
|
24
|
+
groups Keyword::Type, Text, Keyword, Text, Name::Label, Text, Punctuation
|
|
25
|
+
push :type_block
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
rule /[{]/, Punctuation, :push
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
state :type_block do
|
|
32
|
+
rule /(id)(\s*)(:)(\s*)(#{id_with_dots})/ do
|
|
33
|
+
groups Name::Label, Text, Punctuation, Text, Keyword::Declaration
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
rule /(#{id_with_dots})(\s*)(:)/ do
|
|
37
|
+
groups Name::Label, Text, Punctuation
|
|
38
|
+
push :expr_start
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
rule /(signal)(\s+)(#{id_with_dots})/ do
|
|
42
|
+
groups Keyword::Declaration, Text, Name::Label
|
|
43
|
+
push :signal
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
rule /(property)(\s+)(#{id_with_dots})(\s+)(#{id_with_dots})(\s*)(:?)/ do
|
|
47
|
+
groups Keyword::Declaration, Text, Keyword::Type, Text, Name::Label, Text, Punctuation
|
|
48
|
+
push :expr_start
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
rule /[}]/, Punctuation, :pop!
|
|
52
|
+
mixin :root
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
state :signal do
|
|
56
|
+
mixin :comments_and_whitespace
|
|
57
|
+
rule /\(/ do
|
|
58
|
+
token Punctuation
|
|
59
|
+
goto :signal_args
|
|
60
|
+
end
|
|
61
|
+
rule //, Text, :pop!
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
state :signal_args do
|
|
65
|
+
mixin :comments_and_whitespace
|
|
66
|
+
rule /(#{id_with_dots})(\s+)(#{id_with_dots})(\s*)(,?)/ do
|
|
67
|
+
groups Keyword::Type, Text, Name, Text, Punctuation
|
|
68
|
+
end
|
|
69
|
+
rule /\)/ , Punctuation, :pop!
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
|
2
|
+
|
|
3
|
+
module Rouge
|
|
4
|
+
module Lexers
|
|
5
|
+
class R < RegexLexer
|
|
6
|
+
title "R"
|
|
7
|
+
desc 'The R statistics language (r-project.org)'
|
|
8
|
+
tag 'r'
|
|
9
|
+
aliases 'r', 'R', 's', 'S'
|
|
10
|
+
filenames '*.R', '*.r', '.Rhistory', '.Rprofile'
|
|
11
|
+
mimetypes 'text/x-r-source', 'text/x-r', 'text/x-R'
|
|
12
|
+
|
|
13
|
+
mimetypes 'text/x-r', 'application/x-r'
|
|
14
|
+
|
|
15
|
+
KEYWORDS = %w(if else for while repeat in next break function)
|
|
16
|
+
|
|
17
|
+
KEYWORD_CONSTANTS = %w(
|
|
18
|
+
NULL Inf TRUE FALSE NaN NA
|
|
19
|
+
NA_integer_ NA_real_ NA_complex_ NA_character_
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
BUILTIN_CONSTANTS = %w(LETTERS letters month.abb month.name pi T F)
|
|
23
|
+
|
|
24
|
+
# These are all the functions in `base` that are implemented as a
|
|
25
|
+
# `.Primitive`, minus those functions that are also keywords.
|
|
26
|
+
PRIMITIVE_FUNCTIONS = %w(
|
|
27
|
+
abs acos acosh all any anyNA Arg as.call as.character
|
|
28
|
+
as.complex as.double as.environment as.integer as.logical
|
|
29
|
+
as.null.default as.numeric as.raw asin asinh atan atanh attr
|
|
30
|
+
attributes baseenv browser c call ceiling class Conj cos cosh
|
|
31
|
+
cospi cummax cummin cumprod cumsum digamma dim dimnames
|
|
32
|
+
emptyenv exp expression floor forceAndCall gamma gc.time
|
|
33
|
+
globalenv Im interactive invisible is.array is.atomic is.call
|
|
34
|
+
is.character is.complex is.double is.environment is.expression
|
|
35
|
+
is.finite is.function is.infinite is.integer is.language
|
|
36
|
+
is.list is.logical is.matrix is.na is.name is.nan is.null
|
|
37
|
+
is.numeric is.object is.pairlist is.raw is.recursive is.single
|
|
38
|
+
is.symbol lazyLoadDBfetch length lgamma list log max min
|
|
39
|
+
missing Mod names nargs nzchar oldClass on.exit pos.to.env
|
|
40
|
+
proc.time prod quote range Re rep retracemem return round
|
|
41
|
+
seq_along seq_len seq.int sign signif sin sinh sinpi sqrt
|
|
42
|
+
standardGeneric substitute sum switch tan tanh tanpi tracemem
|
|
43
|
+
trigamma trunc unclass untracemem UseMethod xtfrm
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
def self.detect?(text)
|
|
47
|
+
return true if text.shebang? 'Rscript'
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
state :root do
|
|
51
|
+
rule /#'.*?$/, Comment::Doc
|
|
52
|
+
rule /#.*?$/, Comment::Single
|
|
53
|
+
rule /\s+/m, Text::Whitespace
|
|
54
|
+
|
|
55
|
+
rule /`[^`]+?`/, Name
|
|
56
|
+
rule /'(\\.|.)*?'/m, Str::Single
|
|
57
|
+
rule /"(\\.|.)*?"/m, Str::Double
|
|
58
|
+
|
|
59
|
+
rule /%[^%]*?%/, Operator
|
|
60
|
+
|
|
61
|
+
rule /0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?/, Num::Hex
|
|
62
|
+
rule /[+-]?(\d+([.]\d+)?|[.]\d+)([eE][+-]?\d+)?[Li]?/,
|
|
63
|
+
Num
|
|
64
|
+
|
|
65
|
+
# Only recognize built-in functions when they are actually used as a
|
|
66
|
+
# function call, i.e. followed by an opening parenthesis.
|
|
67
|
+
# `Name::Builtin` would be more logical, but is usually not
|
|
68
|
+
# highlighted specifically; thus use `Name::Function`.
|
|
69
|
+
rule /\b(?<!.)(#{PRIMITIVE_FUNCTIONS.join('|')})(?=\()/, Name::Function
|
|
70
|
+
|
|
71
|
+
rule /[a-zA-Z.]([a-zA-Z_][\w.]*)?/ do |m|
|
|
72
|
+
if KEYWORDS.include? m[0]
|
|
73
|
+
token Keyword
|
|
74
|
+
elsif KEYWORD_CONSTANTS.include? m[0]
|
|
75
|
+
token Keyword::Constant
|
|
76
|
+
elsif BUILTIN_CONSTANTS.include? m[0]
|
|
77
|
+
token Name::Builtin
|
|
78
|
+
else
|
|
79
|
+
token Name
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
rule /[\[\]{}();,]/, Punctuation
|
|
84
|
+
|
|
85
|
+
rule %r([-<>?*+^/!=~$@:%&|]), Operator
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
|
2
|
+
module Rouge
|
|
3
|
+
module Lexers
|
|
4
|
+
class Racket < RegexLexer
|
|
5
|
+
title "Racket"
|
|
6
|
+
desc "Racket is a Lisp descended from Scheme (racket-lang.org)"
|
|
7
|
+
|
|
8
|
+
tag 'racket'
|
|
9
|
+
filenames '*.rkt', '*.rktd', '*.rktl'
|
|
10
|
+
mimetypes 'text/x-racket', 'application/x-racket'
|
|
11
|
+
|
|
12
|
+
def self.detect?(text)
|
|
13
|
+
text =~ /\A#lang\s*(.*?)$/
|
|
14
|
+
lang_attr = $1
|
|
15
|
+
return false unless lang_attr
|
|
16
|
+
return true if lang_attr =~ /racket|scribble/
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.keywords
|
|
20
|
+
@keywords ||= Set.new %w(
|
|
21
|
+
... and begin begin-for-syntax begin0 case case-lambda cond
|
|
22
|
+
datum->syntax-object define define-for-syntax define-logger
|
|
23
|
+
define-struct define-syntax define-syntax-rule
|
|
24
|
+
define-syntaxes define-values define-values-for-syntax delay
|
|
25
|
+
do expand-path fluid-let force hash-table-copy
|
|
26
|
+
hash-table-count hash-table-for-each hash-table-get
|
|
27
|
+
hash-table-iterate-first hash-table-iterate-key
|
|
28
|
+
hash-table-iterate-next hash-table-iterate-value
|
|
29
|
+
hash-table-map hash-table-put! hash-table-remove!
|
|
30
|
+
hash-table? if lambda let let* let*-values let-struct
|
|
31
|
+
let-syntax let-syntaxes let-values let/cc let/ec letrec
|
|
32
|
+
letrec-syntax letrec-syntaxes letrec-syntaxes+values
|
|
33
|
+
letrec-values list-immutable make-hash-table
|
|
34
|
+
make-immutable-hash-table make-namespace module module*
|
|
35
|
+
module-identifier=? module-label-identifier=?
|
|
36
|
+
module-template-identifier=? module-transformer-identifier=?
|
|
37
|
+
namespace-transformer-require or parameterize parameterize*
|
|
38
|
+
parameterize-break promise? prop:method-arity-error provide
|
|
39
|
+
provide-for-label provide-for-syntax quasiquote quasisyntax
|
|
40
|
+
quasisyntax/loc quote quote-syntax quote-syntax/prune
|
|
41
|
+
require require-for-label require-for-syntax
|
|
42
|
+
require-for-template set! set!-values syntax syntax-case
|
|
43
|
+
syntax-case* syntax-id-rules syntax-object->datum
|
|
44
|
+
syntax-rules syntax/loc tcp-abandon-port tcp-accept
|
|
45
|
+
tcp-accept-evt tcp-accept-ready? tcp-accept/enable-break
|
|
46
|
+
tcp-addresses tcp-close tcp-connect tcp-connect/enable-break
|
|
47
|
+
tcp-listen tcp-listener? tcp-port? time transcript-off
|
|
48
|
+
transcript-on udp-addresses udp-bind! udp-bound? udp-close
|
|
49
|
+
udp-connect! udp-connected? udp-multicast-interface
|
|
50
|
+
udp-multicast-join-group! udp-multicast-leave-group!
|
|
51
|
+
udp-multicast-loopback? udp-multicast-set-interface!
|
|
52
|
+
udp-multicast-set-loopback! udp-multicast-set-ttl!
|
|
53
|
+
udp-multicast-ttl udp-open-socket udp-receive! udp-receive!*
|
|
54
|
+
udp-receive!-evt udp-receive!/enable-break
|
|
55
|
+
udp-receive-ready-evt udp-send udp-send* udp-send-evt
|
|
56
|
+
udp-send-ready-evt udp-send-to udp-send-to* udp-send-to-evt
|
|
57
|
+
udp-send-to/enable-break udp-send/enable-break udp? unless
|
|
58
|
+
unquote unquote-splicing unsyntax unsyntax-splicing when
|
|
59
|
+
with-continuation-mark with-handlers with-handlers*
|
|
60
|
+
with-syntax λ)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def self.builtins
|
|
64
|
+
@builtins ||= Set.new %w(
|
|
65
|
+
* + - / < <= = > >=
|
|
66
|
+
abort-current-continuation abs absolute-path? acos add1
|
|
67
|
+
alarm-evt always-evt andmap angle append apply
|
|
68
|
+
arithmetic-shift arity-at-least arity-at-least-value
|
|
69
|
+
arity-at-least? asin assoc assq assv atan banner bitwise-and
|
|
70
|
+
bitwise-bit-field bitwise-bit-set? bitwise-ior bitwise-not
|
|
71
|
+
bitwise-xor boolean? bound-identifier=? box box-cas!
|
|
72
|
+
box-immutable box? break-enabled break-thread build-path
|
|
73
|
+
build-path/convention-type byte-pregexp byte-pregexp?
|
|
74
|
+
byte-ready? byte-regexp byte-regexp? byte? bytes
|
|
75
|
+
bytes->immutable-bytes bytes->list bytes->path
|
|
76
|
+
bytes->path-element bytes->string/latin-1
|
|
77
|
+
bytes->string/locale bytes->string/utf-8 bytes-append
|
|
78
|
+
bytes-close-converter bytes-convert bytes-convert-end
|
|
79
|
+
bytes-converter? bytes-copy bytes-copy!
|
|
80
|
+
bytes-environment-variable-name? bytes-fill! bytes-length
|
|
81
|
+
bytes-open-converter bytes-ref bytes-set! bytes-utf-8-index
|
|
82
|
+
bytes-utf-8-length bytes-utf-8-ref bytes<? bytes=? bytes>?
|
|
83
|
+
bytes? caaaar caaadr caaar caadar caaddr caadr caar cadaar
|
|
84
|
+
cadadr cadar caddar cadddr caddr cadr call-in-nested-thread
|
|
85
|
+
call-with-break-parameterization
|
|
86
|
+
call-with-composable-continuation
|
|
87
|
+
call-with-continuation-barrier call-with-continuation-prompt
|
|
88
|
+
call-with-current-continuation
|
|
89
|
+
call-with-default-reading-parameterization
|
|
90
|
+
call-with-escape-continuation call-with-exception-handler
|
|
91
|
+
call-with-immediate-continuation-mark call-with-input-file
|
|
92
|
+
call-with-output-file call-with-parameterization
|
|
93
|
+
call-with-semaphore call-with-semaphore/enable-break
|
|
94
|
+
call-with-values call/cc call/ec car cdaaar cdaadr cdaar
|
|
95
|
+
cdadar cdaddr cdadr cdar cddaar cddadr cddar cdddar cddddr
|
|
96
|
+
cdddr cddr cdr ceiling channel-get channel-put
|
|
97
|
+
channel-put-evt channel-put-evt? channel-try-get channel?
|
|
98
|
+
chaperone-box chaperone-continuation-mark-key chaperone-evt
|
|
99
|
+
chaperone-hash chaperone-of? chaperone-procedure
|
|
100
|
+
chaperone-prompt-tag chaperone-struct chaperone-struct-type
|
|
101
|
+
chaperone-vector chaperone? char->integer char-alphabetic?
|
|
102
|
+
char-blank? char-ci<=? char-ci<? char-ci=? char-ci>=?
|
|
103
|
+
char-ci>? char-downcase char-foldcase char-general-category
|
|
104
|
+
char-graphic? char-iso-control? char-lower-case?
|
|
105
|
+
char-numeric? char-punctuation? char-ready? char-symbolic?
|
|
106
|
+
char-title-case? char-titlecase char-upcase char-upper-case?
|
|
107
|
+
char-utf-8-length char-whitespace? char<=? char<? char=?
|
|
108
|
+
char>=? char>? char? check-duplicate-identifier
|
|
109
|
+
checked-procedure-check-and-extract choice-evt cleanse-path
|
|
110
|
+
close-input-port close-output-port collect-garbage
|
|
111
|
+
collection-file-path collection-path compile
|
|
112
|
+
compile-allow-set!-undefined
|
|
113
|
+
compile-context-preservation-enabled
|
|
114
|
+
compile-enforce-module-constants compile-syntax
|
|
115
|
+
compiled-expression? compiled-module-expression?
|
|
116
|
+
complete-path? complex? cons continuation-mark-key?
|
|
117
|
+
continuation-mark-set->context continuation-mark-set->list
|
|
118
|
+
continuation-mark-set->list* continuation-mark-set-first
|
|
119
|
+
continuation-mark-set? continuation-marks
|
|
120
|
+
continuation-prompt-available? continuation-prompt-tag?
|
|
121
|
+
continuation? copy-file cos current-break-parameterization
|
|
122
|
+
current-code-inspector current-command-line-arguments
|
|
123
|
+
current-compile current-compiled-file-roots
|
|
124
|
+
current-continuation-marks current-custodian
|
|
125
|
+
current-directory current-directory-for-user current-drive
|
|
126
|
+
current-environment-variables current-error-port
|
|
127
|
+
current-eval current-evt-pseudo-random-generator
|
|
128
|
+
current-gc-milliseconds current-get-interaction-input-port
|
|
129
|
+
current-inexact-milliseconds current-input-port
|
|
130
|
+
current-inspector current-library-collection-paths
|
|
131
|
+
current-load current-load-extension
|
|
132
|
+
current-load-relative-directory current-load/use-compiled
|
|
133
|
+
current-locale current-memory-use current-milliseconds
|
|
134
|
+
current-module-declare-name current-module-declare-source
|
|
135
|
+
current-module-name-resolver current-module-path-for-load
|
|
136
|
+
current-namespace current-output-port
|
|
137
|
+
current-parameterization
|
|
138
|
+
current-preserved-thread-cell-values current-print
|
|
139
|
+
current-process-milliseconds current-prompt-read
|
|
140
|
+
current-pseudo-random-generator current-read-interaction
|
|
141
|
+
current-reader-guard current-readtable current-seconds
|
|
142
|
+
current-security-guard current-subprocess-custodian-mode
|
|
143
|
+
current-thread current-thread-group
|
|
144
|
+
current-thread-initial-stack-size
|
|
145
|
+
current-write-relative-directory custodian-box-value
|
|
146
|
+
custodian-box? custodian-limit-memory custodian-managed-list
|
|
147
|
+
custodian-memory-accounting-available?
|
|
148
|
+
custodian-require-memory custodian-shutdown-all custodian?
|
|
149
|
+
custom-print-quotable-accessor custom-print-quotable?
|
|
150
|
+
custom-write-accessor custom-write? date date*
|
|
151
|
+
date*-nanosecond date*-time-zone-name date*? date-day
|
|
152
|
+
date-dst? date-hour date-minute date-month date-second
|
|
153
|
+
date-time-zone-offset date-week-day date-year date-year-day
|
|
154
|
+
date? datum-intern-literal default-continuation-prompt-tag
|
|
155
|
+
delete-directory delete-file denominator directory-exists?
|
|
156
|
+
directory-list display displayln dump-memory-stats
|
|
157
|
+
dynamic-require dynamic-require-for-syntax dynamic-wind
|
|
158
|
+
environment-variables-copy environment-variables-names
|
|
159
|
+
environment-variables-ref environment-variables-set!
|
|
160
|
+
environment-variables? eof eof-object? ephemeron-value
|
|
161
|
+
ephemeron? eprintf eq-hash-code eq? equal-hash-code
|
|
162
|
+
equal-secondary-hash-code equal? equal?/recur eqv-hash-code
|
|
163
|
+
eqv? error error-display-handler error-escape-handler
|
|
164
|
+
error-print-context-length error-print-source-location
|
|
165
|
+
error-print-width error-value->string-handler eval
|
|
166
|
+
eval-jit-enabled eval-syntax even? evt? exact->inexact
|
|
167
|
+
exact-integer? exact-nonnegative-integer?
|
|
168
|
+
exact-positive-integer? exact? executable-yield-handler exit
|
|
169
|
+
exit-handler exn exn-continuation-marks exn-message
|
|
170
|
+
exn:break exn:break-continuation exn:break:hang-up
|
|
171
|
+
exn:break:hang-up? exn:break:terminate exn:break:terminate?
|
|
172
|
+
exn:break? exn:fail exn:fail:contract
|
|
173
|
+
exn:fail:contract:arity exn:fail:contract:arity?
|
|
174
|
+
exn:fail:contract:continuation
|
|
175
|
+
exn:fail:contract:continuation?
|
|
176
|
+
exn:fail:contract:divide-by-zero
|
|
177
|
+
exn:fail:contract:divide-by-zero?
|
|
178
|
+
exn:fail:contract:non-fixnum-result
|
|
179
|
+
exn:fail:contract:non-fixnum-result?
|
|
180
|
+
exn:fail:contract:variable exn:fail:contract:variable-id
|
|
181
|
+
exn:fail:contract:variable? exn:fail:contract?
|
|
182
|
+
exn:fail:filesystem exn:fail:filesystem:errno
|
|
183
|
+
exn:fail:filesystem:errno-errno exn:fail:filesystem:errno?
|
|
184
|
+
exn:fail:filesystem:exists exn:fail:filesystem:exists?
|
|
185
|
+
exn:fail:filesystem:missing-module
|
|
186
|
+
exn:fail:filesystem:missing-module-path
|
|
187
|
+
exn:fail:filesystem:missing-module?
|
|
188
|
+
exn:fail:filesystem:version exn:fail:filesystem:version?
|
|
189
|
+
exn:fail:filesystem? exn:fail:network exn:fail:network:errno
|
|
190
|
+
exn:fail:network:errno-errno exn:fail:network:errno?
|
|
191
|
+
exn:fail:network? exn:fail:out-of-memory
|
|
192
|
+
exn:fail:out-of-memory? exn:fail:read exn:fail:read-srclocs
|
|
193
|
+
exn:fail:read:eof exn:fail:read:eof? exn:fail:read:non-char
|
|
194
|
+
exn:fail:read:non-char? exn:fail:read? exn:fail:syntax
|
|
195
|
+
exn:fail:syntax-exprs exn:fail:syntax:missing-module
|
|
196
|
+
exn:fail:syntax:missing-module-path
|
|
197
|
+
exn:fail:syntax:missing-module? exn:fail:syntax:unbound
|
|
198
|
+
exn:fail:syntax:unbound? exn:fail:syntax?
|
|
199
|
+
exn:fail:unsupported exn:fail:unsupported? exn:fail:user
|
|
200
|
+
exn:fail:user? exn:fail? exn:missing-module-accessor
|
|
201
|
+
exn:missing-module? exn:srclocs-accessor exn:srclocs? exn?
|
|
202
|
+
exp expand expand-once expand-syntax expand-syntax-once
|
|
203
|
+
expand-syntax-to-top-form expand-to-top-form
|
|
204
|
+
expand-user-path explode-path expt file-exists?
|
|
205
|
+
file-or-directory-identity file-or-directory-modify-seconds
|
|
206
|
+
file-or-directory-permissions file-position file-position*
|
|
207
|
+
file-size file-stream-buffer-mode file-stream-port?
|
|
208
|
+
file-truncate filesystem-change-evt
|
|
209
|
+
filesystem-change-evt-cancel filesystem-change-evt?
|
|
210
|
+
filesystem-root-list find-executable-path
|
|
211
|
+
find-library-collection-paths find-system-path fixnum?
|
|
212
|
+
floating-point-bytes->real flonum? floor flush-output
|
|
213
|
+
for-each format fprintf free-identifier=? gcd
|
|
214
|
+
generate-temporaries gensym get-output-bytes
|
|
215
|
+
get-output-string getenv global-port-print-handler guard-evt
|
|
216
|
+
handle-evt handle-evt? hash hash-equal? hash-eqv?
|
|
217
|
+
hash-has-key? hash-placeholder? hash-ref! hasheq hasheqv
|
|
218
|
+
identifier-binding identifier-binding-symbol
|
|
219
|
+
identifier-label-binding identifier-prune-lexical-context
|
|
220
|
+
identifier-prune-to-source-module
|
|
221
|
+
identifier-remove-from-definition-context
|
|
222
|
+
identifier-template-binding identifier-transformer-binding
|
|
223
|
+
identifier? imag-part immutable? impersonate-box
|
|
224
|
+
impersonate-continuation-mark-key impersonate-hash
|
|
225
|
+
impersonate-procedure impersonate-prompt-tag
|
|
226
|
+
impersonate-struct impersonate-vector impersonator-ephemeron
|
|
227
|
+
impersonator-of? impersonator-prop:application-mark
|
|
228
|
+
impersonator-property-accessor-procedure?
|
|
229
|
+
impersonator-property? impersonator? inexact->exact
|
|
230
|
+
inexact-real? inexact? input-port? inspector? integer->char
|
|
231
|
+
integer->integer-bytes integer-bytes->integer integer-length
|
|
232
|
+
integer-sqrt integer-sqrt/remainder integer?
|
|
233
|
+
internal-definition-context-seal
|
|
234
|
+
internal-definition-context? keyword->string keyword<?
|
|
235
|
+
keyword? kill-thread lcm length liberal-define-context?
|
|
236
|
+
link-exists? list list* list->bytes list->string
|
|
237
|
+
list->vector list-ref list-tail list? load load-extension
|
|
238
|
+
load-on-demand-enabled load-relative load-relative-extension
|
|
239
|
+
load/cd load/use-compiled local-expand
|
|
240
|
+
local-expand/capture-lifts local-transformer-expand
|
|
241
|
+
local-transformer-expand/capture-lifts
|
|
242
|
+
locale-string-encoding log log-max-level magnitude
|
|
243
|
+
make-arity-at-least make-bytes make-channel
|
|
244
|
+
make-continuation-mark-key make-continuation-prompt-tag
|
|
245
|
+
make-custodian make-custodian-box make-date make-date*
|
|
246
|
+
make-derived-parameter make-directory
|
|
247
|
+
make-environment-variables make-ephemeron make-exn
|
|
248
|
+
make-exn:break make-exn:break:hang-up
|
|
249
|
+
make-exn:break:terminate make-exn:fail
|
|
250
|
+
make-exn:fail:contract make-exn:fail:contract:arity
|
|
251
|
+
make-exn:fail:contract:continuation
|
|
252
|
+
make-exn:fail:contract:divide-by-zero
|
|
253
|
+
make-exn:fail:contract:non-fixnum-result
|
|
254
|
+
make-exn:fail:contract:variable make-exn:fail:filesystem
|
|
255
|
+
make-exn:fail:filesystem:errno
|
|
256
|
+
make-exn:fail:filesystem:exists
|
|
257
|
+
make-exn:fail:filesystem:missing-module
|
|
258
|
+
make-exn:fail:filesystem:version make-exn:fail:network
|
|
259
|
+
make-exn:fail:network:errno make-exn:fail:out-of-memory
|
|
260
|
+
make-exn:fail:read make-exn:fail:read:eof
|
|
261
|
+
make-exn:fail:read:non-char make-exn:fail:syntax
|
|
262
|
+
make-exn:fail:syntax:missing-module
|
|
263
|
+
make-exn:fail:syntax:unbound make-exn:fail:unsupported
|
|
264
|
+
make-exn:fail:user make-file-or-directory-link
|
|
265
|
+
make-hash-placeholder make-hasheq-placeholder make-hasheqv
|
|
266
|
+
make-hasheqv-placeholder make-immutable-hasheqv
|
|
267
|
+
make-impersonator-property make-input-port make-inspector
|
|
268
|
+
make-known-char-range-list make-output-port make-parameter
|
|
269
|
+
make-phantom-bytes make-pipe make-placeholder make-polar
|
|
270
|
+
make-prefab-struct make-pseudo-random-generator
|
|
271
|
+
make-reader-graph make-readtable make-rectangular
|
|
272
|
+
make-rename-transformer make-resolved-module-path
|
|
273
|
+
make-security-guard make-semaphore make-set!-transformer
|
|
274
|
+
make-shared-bytes make-sibling-inspector
|
|
275
|
+
make-special-comment make-srcloc make-string
|
|
276
|
+
make-struct-field-accessor make-struct-field-mutator
|
|
277
|
+
make-struct-type make-struct-type-property
|
|
278
|
+
make-syntax-delta-introducer make-syntax-introducer
|
|
279
|
+
make-thread-cell make-thread-group make-vector make-weak-box
|
|
280
|
+
make-weak-hasheqv make-will-executor map max mcar mcdr mcons
|
|
281
|
+
member memq memv min module->exports module->imports
|
|
282
|
+
module->language-info module->namespace
|
|
283
|
+
module-compiled-cross-phase-persistent?
|
|
284
|
+
module-compiled-exports module-compiled-imports
|
|
285
|
+
module-compiled-language-info module-compiled-name
|
|
286
|
+
module-compiled-submodules module-declared?
|
|
287
|
+
module-path-index-join module-path-index-resolve
|
|
288
|
+
module-path-index-split module-path-index-submodule
|
|
289
|
+
module-path-index? module-path? module-predefined?
|
|
290
|
+
module-provide-protected? modulo mpair? nack-guard-evt
|
|
291
|
+
namespace-attach-module namespace-attach-module-declaration
|
|
292
|
+
namespace-base-phase namespace-mapped-symbols
|
|
293
|
+
namespace-module-identifier namespace-module-registry
|
|
294
|
+
namespace-require namespace-require/constant
|
|
295
|
+
namespace-require/copy namespace-require/expansion-time
|
|
296
|
+
namespace-set-variable-value! namespace-symbol->identifier
|
|
297
|
+
namespace-syntax-introduce namespace-undefine-variable!
|
|
298
|
+
namespace-unprotect-module namespace-variable-value
|
|
299
|
+
namespace? negative? never-evt newline normal-case-path not
|
|
300
|
+
null null? number->string number? numerator object-name odd?
|
|
301
|
+
open-input-bytes open-input-file open-input-output-file
|
|
302
|
+
open-input-string open-output-bytes open-output-file
|
|
303
|
+
open-output-string ormap output-port? pair?
|
|
304
|
+
parameter-procedure=? parameter? parameterization?
|
|
305
|
+
path->bytes path->complete-path path->directory-path
|
|
306
|
+
path->string path-add-suffix path-convention-type
|
|
307
|
+
path-element->bytes path-element->string
|
|
308
|
+
path-for-some-system? path-list-string->path-list
|
|
309
|
+
path-replace-suffix path-string? path? peek-byte
|
|
310
|
+
peek-byte-or-special peek-bytes peek-bytes!
|
|
311
|
+
peek-bytes-avail! peek-bytes-avail!*
|
|
312
|
+
peek-bytes-avail!/enable-break peek-char
|
|
313
|
+
peek-char-or-special peek-string peek-string! phantom-bytes?
|
|
314
|
+
pipe-content-length placeholder-get placeholder-set!
|
|
315
|
+
placeholder? poll-guard-evt port-closed-evt port-closed?
|
|
316
|
+
port-commit-peeked port-count-lines!
|
|
317
|
+
port-count-lines-enabled port-counts-lines?
|
|
318
|
+
port-display-handler port-file-identity port-file-unlock
|
|
319
|
+
port-next-location port-print-handler port-progress-evt
|
|
320
|
+
port-provides-progress-evts? port-read-handler
|
|
321
|
+
port-try-file-lock? port-write-handler port-writes-atomic?
|
|
322
|
+
port-writes-special? port? positive? prefab-key->struct-type
|
|
323
|
+
prefab-key? prefab-struct-key pregexp pregexp?
|
|
324
|
+
primitive-closure? primitive-result-arity primitive? print
|
|
325
|
+
print-as-expression print-boolean-long-form print-box
|
|
326
|
+
print-graph print-hash-table print-mpair-curly-braces
|
|
327
|
+
print-pair-curly-braces print-reader-abbreviations
|
|
328
|
+
print-struct print-syntax-width print-unreadable
|
|
329
|
+
print-vector-length printf procedure->method procedure-arity
|
|
330
|
+
procedure-arity-includes? procedure-arity?
|
|
331
|
+
procedure-closure-contents-eq? procedure-extract-target
|
|
332
|
+
procedure-reduce-arity procedure-rename
|
|
333
|
+
procedure-struct-type? procedure? progress-evt?
|
|
334
|
+
prop:arity-string prop:checked-procedure
|
|
335
|
+
prop:custom-print-quotable prop:custom-write prop:equal+hash
|
|
336
|
+
prop:evt prop:exn:missing-module prop:exn:srclocs
|
|
337
|
+
prop:impersonator-of prop:input-port
|
|
338
|
+
prop:liberal-define-context prop:output-port prop:procedure
|
|
339
|
+
prop:rename-transformer prop:set!-transformer
|
|
340
|
+
pseudo-random-generator->vector
|
|
341
|
+
pseudo-random-generator-vector? pseudo-random-generator?
|
|
342
|
+
putenv quotient quotient/remainder raise
|
|
343
|
+
raise-argument-error raise-arguments-error raise-arity-error
|
|
344
|
+
raise-mismatch-error raise-range-error raise-result-error
|
|
345
|
+
raise-syntax-error raise-type-error raise-user-error random
|
|
346
|
+
random-seed rational? rationalize read read-accept-bar-quote
|
|
347
|
+
read-accept-box read-accept-compiled read-accept-dot
|
|
348
|
+
read-accept-graph read-accept-infix-dot read-accept-lang
|
|
349
|
+
read-accept-quasiquote read-accept-reader read-byte
|
|
350
|
+
read-byte-or-special read-bytes read-bytes!
|
|
351
|
+
read-bytes-avail! read-bytes-avail!*
|
|
352
|
+
read-bytes-avail!/enable-break read-bytes-line
|
|
353
|
+
read-case-sensitive read-char read-char-or-special
|
|
354
|
+
read-curly-brace-as-paren read-decimal-as-inexact
|
|
355
|
+
read-eval-print-loop read-language read-line
|
|
356
|
+
read-on-demand-source read-square-bracket-as-paren
|
|
357
|
+
read-string read-string! read-syntax read-syntax/recursive
|
|
358
|
+
read/recursive readtable-mapping readtable?
|
|
359
|
+
real->double-flonum real->floating-point-bytes
|
|
360
|
+
real->single-flonum real-part real? regexp regexp-match
|
|
361
|
+
regexp-match-peek regexp-match-peek-immediate
|
|
362
|
+
regexp-match-peek-positions
|
|
363
|
+
regexp-match-peek-positions-immediate
|
|
364
|
+
regexp-match-peek-positions-immediate/end
|
|
365
|
+
regexp-match-peek-positions/end regexp-match-positions
|
|
366
|
+
regexp-match-positions/end regexp-match/end regexp-match?
|
|
367
|
+
regexp-max-lookbehind regexp-replace regexp-replace* regexp?
|
|
368
|
+
relative-path? remainder rename-file-or-directory
|
|
369
|
+
rename-transformer-target rename-transformer? reroot-path
|
|
370
|
+
resolve-path resolved-module-path-name resolved-module-path?
|
|
371
|
+
reverse round seconds->date security-guard?
|
|
372
|
+
semaphore-peek-evt semaphore-peek-evt? semaphore-post
|
|
373
|
+
semaphore-try-wait? semaphore-wait
|
|
374
|
+
semaphore-wait/enable-break semaphore?
|
|
375
|
+
set!-transformer-procedure set!-transformer? set-box!
|
|
376
|
+
set-mcar! set-mcdr! set-phantom-bytes!
|
|
377
|
+
set-port-next-location! shared-bytes shell-execute
|
|
378
|
+
simplify-path sin single-flonum? sleep special-comment-value
|
|
379
|
+
special-comment? split-path sqrt srcloc srcloc->string
|
|
380
|
+
srcloc-column srcloc-line srcloc-position srcloc-source
|
|
381
|
+
srcloc-span srcloc? string string->bytes/latin-1
|
|
382
|
+
string->bytes/locale string->bytes/utf-8
|
|
383
|
+
string->immutable-string string->keyword string->list
|
|
384
|
+
string->number string->path string->path-element
|
|
385
|
+
string->symbol string->uninterned-symbol
|
|
386
|
+
string->unreadable-symbol string-append string-ci<=?
|
|
387
|
+
string-ci<? string-ci=? string-ci>=? string-ci>? string-copy
|
|
388
|
+
string-copy! string-downcase
|
|
389
|
+
string-environment-variable-name? string-fill!
|
|
390
|
+
string-foldcase string-length string-locale-ci<?
|
|
391
|
+
string-locale-ci=? string-locale-ci>? string-locale-downcase
|
|
392
|
+
string-locale-upcase string-locale<? string-locale=?
|
|
393
|
+
string-locale>? string-normalize-nfc string-normalize-nfd
|
|
394
|
+
string-normalize-nfkc string-normalize-nfkd string-ref
|
|
395
|
+
string-set! string-titlecase string-upcase
|
|
396
|
+
string-utf-8-length string<=? string<? string=? string>=?
|
|
397
|
+
string>? string? struct->vector struct-accessor-procedure?
|
|
398
|
+
struct-constructor-procedure? struct-info
|
|
399
|
+
struct-mutator-procedure? struct-predicate-procedure?
|
|
400
|
+
struct-type-info struct-type-make-constructor
|
|
401
|
+
struct-type-make-predicate
|
|
402
|
+
struct-type-property-accessor-procedure?
|
|
403
|
+
struct-type-property? struct-type? struct:arity-at-least
|
|
404
|
+
struct:date struct:date* struct:exn struct:exn:break
|
|
405
|
+
struct:exn:break:hang-up struct:exn:break:terminate
|
|
406
|
+
struct:exn:fail struct:exn:fail:contract
|
|
407
|
+
struct:exn:fail:contract:arity
|
|
408
|
+
struct:exn:fail:contract:continuation
|
|
409
|
+
struct:exn:fail:contract:divide-by-zero
|
|
410
|
+
struct:exn:fail:contract:non-fixnum-result
|
|
411
|
+
struct:exn:fail:contract:variable struct:exn:fail:filesystem
|
|
412
|
+
struct:exn:fail:filesystem:errno
|
|
413
|
+
struct:exn:fail:filesystem:exists
|
|
414
|
+
struct:exn:fail:filesystem:missing-module
|
|
415
|
+
struct:exn:fail:filesystem:version struct:exn:fail:network
|
|
416
|
+
struct:exn:fail:network:errno struct:exn:fail:out-of-memory
|
|
417
|
+
struct:exn:fail:read struct:exn:fail:read:eof
|
|
418
|
+
struct:exn:fail:read:non-char struct:exn:fail:syntax
|
|
419
|
+
struct:exn:fail:syntax:missing-module
|
|
420
|
+
struct:exn:fail:syntax:unbound struct:exn:fail:unsupported
|
|
421
|
+
struct:exn:fail:user struct:srcloc struct? sub1 subbytes
|
|
422
|
+
subprocess subprocess-group-enabled subprocess-kill
|
|
423
|
+
subprocess-pid subprocess-status subprocess-wait subprocess?
|
|
424
|
+
substring symbol->string symbol-interned? symbol-unreadable?
|
|
425
|
+
symbol? sync sync/enable-break sync/timeout
|
|
426
|
+
sync/timeout/enable-break syntax->list syntax-arm
|
|
427
|
+
syntax-column syntax-disarm syntax-e syntax-line
|
|
428
|
+
syntax-local-bind-syntaxes syntax-local-certifier
|
|
429
|
+
syntax-local-context syntax-local-expand-expression
|
|
430
|
+
syntax-local-get-shadower syntax-local-introduce
|
|
431
|
+
syntax-local-lift-context syntax-local-lift-expression
|
|
432
|
+
syntax-local-lift-module-end-declaration
|
|
433
|
+
syntax-local-lift-provide syntax-local-lift-require
|
|
434
|
+
syntax-local-lift-values-expression
|
|
435
|
+
syntax-local-make-definition-context
|
|
436
|
+
syntax-local-make-delta-introducer
|
|
437
|
+
syntax-local-module-defined-identifiers
|
|
438
|
+
syntax-local-module-exports
|
|
439
|
+
syntax-local-module-required-identifiers syntax-local-name
|
|
440
|
+
syntax-local-phase-level syntax-local-submodules
|
|
441
|
+
syntax-local-transforming-module-provides?
|
|
442
|
+
syntax-local-value syntax-local-value/immediate
|
|
443
|
+
syntax-original? syntax-position syntax-property
|
|
444
|
+
syntax-property-symbol-keys syntax-protect syntax-rearm
|
|
445
|
+
syntax-recertify syntax-shift-phase-level syntax-source
|
|
446
|
+
syntax-source-module syntax-span syntax-taint
|
|
447
|
+
syntax-tainted? syntax-track-origin
|
|
448
|
+
syntax-transforming-module-expression? syntax-transforming?
|
|
449
|
+
syntax? system-big-endian? system-idle-evt
|
|
450
|
+
system-language+country system-library-subpath
|
|
451
|
+
system-path-convention-type system-type tan terminal-port?
|
|
452
|
+
thread thread-cell-ref thread-cell-set! thread-cell-values?
|
|
453
|
+
thread-cell? thread-dead-evt thread-dead? thread-group?
|
|
454
|
+
thread-resume thread-resume-evt thread-rewind-receive
|
|
455
|
+
thread-running? thread-suspend thread-suspend-evt
|
|
456
|
+
thread-wait thread/suspend-to-kill thread? time-apply
|
|
457
|
+
truncate unbox uncaught-exception-handler
|
|
458
|
+
use-collection-link-paths use-compiled-file-paths
|
|
459
|
+
use-user-specific-search-paths values
|
|
460
|
+
variable-reference->empty-namespace
|
|
461
|
+
variable-reference->module-base-phase
|
|
462
|
+
variable-reference->module-declaration-inspector
|
|
463
|
+
variable-reference->module-path-index
|
|
464
|
+
variable-reference->module-source
|
|
465
|
+
variable-reference->namespace variable-reference->phase
|
|
466
|
+
variable-reference->resolved-module-path
|
|
467
|
+
variable-reference-constant? variable-reference? vector
|
|
468
|
+
vector->immutable-vector vector->list
|
|
469
|
+
vector->pseudo-random-generator
|
|
470
|
+
vector->pseudo-random-generator! vector->values vector-fill!
|
|
471
|
+
vector-immutable vector-length vector-ref vector-set!
|
|
472
|
+
vector-set-performance-stats! vector? version void void?
|
|
473
|
+
weak-box-value weak-box? will-execute will-executor?
|
|
474
|
+
will-register will-try-execute with-input-from-file
|
|
475
|
+
with-output-to-file wrap-evt write write-byte write-bytes
|
|
476
|
+
write-bytes-avail write-bytes-avail* write-bytes-avail-evt
|
|
477
|
+
write-bytes-avail/enable-break write-char write-special
|
|
478
|
+
write-special-avail* write-special-evt write-string zero?
|
|
479
|
+
)
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
# Since Racket allows identifiers to consist of nearly anything,
|
|
483
|
+
# it's simpler to describe what an ID is _not_.
|
|
484
|
+
id = /[^\s\(\)\[\]\{\}'`,.]+/i
|
|
485
|
+
|
|
486
|
+
state :root do
|
|
487
|
+
# comments
|
|
488
|
+
rule /;.*$/, Comment::Single
|
|
489
|
+
rule /\s+/m, Text
|
|
490
|
+
|
|
491
|
+
rule /[+-]inf[.][f0]/, Num::Float
|
|
492
|
+
rule /[+-]nan[.]0/, Num::Float
|
|
493
|
+
rule /[-]min[.]0/, Num::Float
|
|
494
|
+
rule /[+]max[.]0/, Num::Float
|
|
495
|
+
|
|
496
|
+
rule /-?\d+\.\d+/, Num::Float
|
|
497
|
+
rule /-?\d+/, Num::Integer
|
|
498
|
+
|
|
499
|
+
rule /#:#{id}+/, Name::Tag # keyword
|
|
500
|
+
|
|
501
|
+
rule /#b[01]+/, Num::Bin
|
|
502
|
+
rule /#o[0-7]+/, Num::Oct
|
|
503
|
+
rule /#d[0-9]+/, Num::Integer
|
|
504
|
+
rule /#x[0-9a-f]+/i, Num::Hex
|
|
505
|
+
rule /#[ei][\d.]+/, Num::Other
|
|
506
|
+
|
|
507
|
+
rule /"(\\\\|\\"|[^"])*"/, Str
|
|
508
|
+
rule /['`]#{id}/i, Str::Symbol
|
|
509
|
+
rule /#\\([()\/'"._!\$%& ?=+-]{1}|[a-z0-9]+)/i,
|
|
510
|
+
Str::Char
|
|
511
|
+
rule /#t|#f/, Name::Constant
|
|
512
|
+
rule /(?:'|#|`|,@|,|\.)/, Operator
|
|
513
|
+
|
|
514
|
+
rule /(['#])(\s*)(\()/m do
|
|
515
|
+
groups Str::Symbol, Text, Punctuation
|
|
516
|
+
end
|
|
517
|
+
|
|
518
|
+
# () [] {} are all permitted as like pairs
|
|
519
|
+
rule /\(|\[|\{/, Punctuation, :command
|
|
520
|
+
rule /\)|\]|\}/, Punctuation
|
|
521
|
+
|
|
522
|
+
rule id, Name::Variable
|
|
523
|
+
end
|
|
524
|
+
|
|
525
|
+
state :command do
|
|
526
|
+
rule id, Name::Function do |m|
|
|
527
|
+
if self.class.keywords.include? m[0]
|
|
528
|
+
token Keyword
|
|
529
|
+
elsif self.class.builtins.include? m[0]
|
|
530
|
+
token Name::Builtin
|
|
531
|
+
else
|
|
532
|
+
token Name::Function
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
pop!
|
|
536
|
+
end
|
|
537
|
+
|
|
538
|
+
rule(//) { pop! }
|
|
539
|
+
end
|
|
540
|
+
|
|
541
|
+
end
|
|
542
|
+
end
|
|
543
|
+
end
|