gitlab-rouge 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +23 -0
  3. data/LICENSE +186 -0
  4. data/bin/rougify +16 -0
  5. data/gitlab-rouge.gemspec +17 -0
  6. data/lib/rouge.rb +57 -0
  7. data/lib/rouge/cli.rb +363 -0
  8. data/lib/rouge/demos/apache +21 -0
  9. data/lib/rouge/demos/applescript +2 -0
  10. data/lib/rouge/demos/c +8 -0
  11. data/lib/rouge/demos/clojure +5 -0
  12. data/lib/rouge/demos/coffeescript +5 -0
  13. data/lib/rouge/demos/common_lisp +1 -0
  14. data/lib/rouge/demos/conf +4 -0
  15. data/lib/rouge/demos/cpp +8 -0
  16. data/lib/rouge/demos/csharp +5 -0
  17. data/lib/rouge/demos/css +4 -0
  18. data/lib/rouge/demos/dart +6 -0
  19. data/lib/rouge/demos/diff +7 -0
  20. data/lib/rouge/demos/elixir +1 -0
  21. data/lib/rouge/demos/erb +1 -0
  22. data/lib/rouge/demos/erlang +7 -0
  23. data/lib/rouge/demos/factor +5 -0
  24. data/lib/rouge/demos/gherkin +17 -0
  25. data/lib/rouge/demos/glsl +14 -0
  26. data/lib/rouge/demos/go +7 -0
  27. data/lib/rouge/demos/groovy +9 -0
  28. data/lib/rouge/demos/haml +5 -0
  29. data/lib/rouge/demos/handlebars +7 -0
  30. data/lib/rouge/demos/haskell +6 -0
  31. data/lib/rouge/demos/html +8 -0
  32. data/lib/rouge/demos/http +14 -0
  33. data/lib/rouge/demos/ini +4 -0
  34. data/lib/rouge/demos/io +11 -0
  35. data/lib/rouge/demos/java +5 -0
  36. data/lib/rouge/demos/javascript +1 -0
  37. data/lib/rouge/demos/json +1 -0
  38. data/lib/rouge/demos/json-doc +1 -0
  39. data/lib/rouge/demos/liquid +11 -0
  40. data/lib/rouge/demos/literate_coffeescript +3 -0
  41. data/lib/rouge/demos/literate_haskell +7 -0
  42. data/lib/rouge/demos/llvm +20 -0
  43. data/lib/rouge/demos/lua +12 -0
  44. data/lib/rouge/demos/make +6 -0
  45. data/lib/rouge/demos/markdown +4 -0
  46. data/lib/rouge/demos/matlab +6 -0
  47. data/lib/rouge/demos/moonscript +16 -0
  48. data/lib/rouge/demos/nginx +5 -0
  49. data/lib/rouge/demos/nim +27 -0
  50. data/lib/rouge/demos/objective_c +14 -0
  51. data/lib/rouge/demos/ocaml +12 -0
  52. data/lib/rouge/demos/perl +5 -0
  53. data/lib/rouge/demos/php +3 -0
  54. data/lib/rouge/demos/plaintext +1 -0
  55. data/lib/rouge/demos/powershell +49 -0
  56. data/lib/rouge/demos/prolog +9 -0
  57. data/lib/rouge/demos/properties +7 -0
  58. data/lib/rouge/demos/puppet +6 -0
  59. data/lib/rouge/demos/python +6 -0
  60. data/lib/rouge/demos/qml +9 -0
  61. data/lib/rouge/demos/r +8 -0
  62. data/lib/rouge/demos/racket +24 -0
  63. data/lib/rouge/demos/ruby +9 -0
  64. data/lib/rouge/demos/rust +12 -0
  65. data/lib/rouge/demos/sass +3 -0
  66. data/lib/rouge/demos/scala +3 -0
  67. data/lib/rouge/demos/scheme +4 -0
  68. data/lib/rouge/demos/scss +5 -0
  69. data/lib/rouge/demos/sed +4 -0
  70. data/lib/rouge/demos/shell +2 -0
  71. data/lib/rouge/demos/slim +17 -0
  72. data/lib/rouge/demos/smalltalk +6 -0
  73. data/lib/rouge/demos/sml +4 -0
  74. data/lib/rouge/demos/sql +1 -0
  75. data/lib/rouge/demos/swift +5 -0
  76. data/lib/rouge/demos/tcl +1 -0
  77. data/lib/rouge/demos/tex +1 -0
  78. data/lib/rouge/demos/toml +9 -0
  79. data/lib/rouge/demos/tulip +14 -0
  80. data/lib/rouge/demos/vb +4 -0
  81. data/lib/rouge/demos/viml +5 -0
  82. data/lib/rouge/demos/xml +2 -0
  83. data/lib/rouge/demos/yaml +4 -0
  84. data/lib/rouge/formatter.rb +50 -0
  85. data/lib/rouge/formatters/html.rb +117 -0
  86. data/lib/rouge/formatters/null.rb +19 -0
  87. data/lib/rouge/formatters/terminal256.rb +176 -0
  88. data/lib/rouge/lexer.rb +443 -0
  89. data/lib/rouge/lexers/apache.rb +68 -0
  90. data/lib/rouge/lexers/apache/keywords.yml +453 -0
  91. data/lib/rouge/lexers/apple_script.rb +367 -0
  92. data/lib/rouge/lexers/c.rb +212 -0
  93. data/lib/rouge/lexers/clojure.rb +112 -0
  94. data/lib/rouge/lexers/coffeescript.rb +174 -0
  95. data/lib/rouge/lexers/common_lisp.rb +345 -0
  96. data/lib/rouge/lexers/conf.rb +24 -0
  97. data/lib/rouge/lexers/cpp.rb +66 -0
  98. data/lib/rouge/lexers/csharp.rb +88 -0
  99. data/lib/rouge/lexers/css.rb +271 -0
  100. data/lib/rouge/lexers/dart.rb +104 -0
  101. data/lib/rouge/lexers/diff.rb +31 -0
  102. data/lib/rouge/lexers/elixir.rb +108 -0
  103. data/lib/rouge/lexers/erb.rb +56 -0
  104. data/lib/rouge/lexers/erlang.rb +118 -0
  105. data/lib/rouge/lexers/factor.rb +302 -0
  106. data/lib/rouge/lexers/gherkin.rb +137 -0
  107. data/lib/rouge/lexers/gherkin/keywords.rb +14 -0
  108. data/lib/rouge/lexers/glsl.rb +135 -0
  109. data/lib/rouge/lexers/go.rb +178 -0
  110. data/lib/rouge/lexers/groovy.rb +104 -0
  111. data/lib/rouge/lexers/haml.rb +228 -0
  112. data/lib/rouge/lexers/handlebars.rb +79 -0
  113. data/lib/rouge/lexers/haskell.rb +183 -0
  114. data/lib/rouge/lexers/html.rb +94 -0
  115. data/lib/rouge/lexers/http.rb +80 -0
  116. data/lib/rouge/lexers/ini.rb +57 -0
  117. data/lib/rouge/lexers/io.rb +68 -0
  118. data/lib/rouge/lexers/java.rb +76 -0
  119. data/lib/rouge/lexers/javascript.rb +297 -0
  120. data/lib/rouge/lexers/liquid.rb +287 -0
  121. data/lib/rouge/lexers/literate_coffeescript.rb +33 -0
  122. data/lib/rouge/lexers/literate_haskell.rb +36 -0
  123. data/lib/rouge/lexers/llvm.rb +84 -0
  124. data/lib/rouge/lexers/lua.rb +122 -0
  125. data/lib/rouge/lexers/lua/builtins.rb +22 -0
  126. data/lib/rouge/lexers/make.rb +116 -0
  127. data/lib/rouge/lexers/markdown.rb +154 -0
  128. data/lib/rouge/lexers/matlab.rb +74 -0
  129. data/lib/rouge/lexers/matlab/builtins.rb +11 -0
  130. data/lib/rouge/lexers/moonscript.rb +110 -0
  131. data/lib/rouge/lexers/nginx.rb +71 -0
  132. data/lib/rouge/lexers/nim.rb +152 -0
  133. data/lib/rouge/lexers/objective_c.rb +197 -0
  134. data/lib/rouge/lexers/ocaml.rb +111 -0
  135. data/lib/rouge/lexers/perl.rb +197 -0
  136. data/lib/rouge/lexers/php.rb +173 -0
  137. data/lib/rouge/lexers/php/builtins.rb +204 -0
  138. data/lib/rouge/lexers/plain_text.rb +25 -0
  139. data/lib/rouge/lexers/powershell.rb +96 -0
  140. data/lib/rouge/lexers/prolog.rb +64 -0
  141. data/lib/rouge/lexers/properties.rb +55 -0
  142. data/lib/rouge/lexers/puppet.rb +128 -0
  143. data/lib/rouge/lexers/python.rb +228 -0
  144. data/lib/rouge/lexers/qml.rb +72 -0
  145. data/lib/rouge/lexers/r.rb +56 -0
  146. data/lib/rouge/lexers/racket.rb +542 -0
  147. data/lib/rouge/lexers/ruby.rb +415 -0
  148. data/lib/rouge/lexers/rust.rb +191 -0
  149. data/lib/rouge/lexers/sass.rb +74 -0
  150. data/lib/rouge/lexers/sass/common.rb +180 -0
  151. data/lib/rouge/lexers/scala.rb +142 -0
  152. data/lib/rouge/lexers/scheme.rb +112 -0
  153. data/lib/rouge/lexers/scss.rb +34 -0
  154. data/lib/rouge/lexers/sed.rb +170 -0
  155. data/lib/rouge/lexers/shell.rb +152 -0
  156. data/lib/rouge/lexers/slim.rb +228 -0
  157. data/lib/rouge/lexers/smalltalk.rb +116 -0
  158. data/lib/rouge/lexers/sml.rb +347 -0
  159. data/lib/rouge/lexers/sql.rb +140 -0
  160. data/lib/rouge/lexers/swift.rb +144 -0
  161. data/lib/rouge/lexers/tcl.rb +192 -0
  162. data/lib/rouge/lexers/tex.rb +72 -0
  163. data/lib/rouge/lexers/toml.rb +71 -0
  164. data/lib/rouge/lexers/tulip.rb +75 -0
  165. data/lib/rouge/lexers/vb.rb +164 -0
  166. data/lib/rouge/lexers/viml.rb +101 -0
  167. data/lib/rouge/lexers/viml/keywords.rb +12 -0
  168. data/lib/rouge/lexers/xml.rb +59 -0
  169. data/lib/rouge/lexers/yaml.rb +364 -0
  170. data/lib/rouge/plugins/redcarpet.rb +30 -0
  171. data/lib/rouge/regex_lexer.rb +439 -0
  172. data/lib/rouge/template_lexer.rb +22 -0
  173. data/lib/rouge/text_analyzer.rb +48 -0
  174. data/lib/rouge/theme.rb +195 -0
  175. data/lib/rouge/themes/base16.rb +130 -0
  176. data/lib/rouge/themes/colorful.rb +67 -0
  177. data/lib/rouge/themes/github.rb +71 -0
  178. data/lib/rouge/themes/molokai.rb +82 -0
  179. data/lib/rouge/themes/monokai.rb +92 -0
  180. data/lib/rouge/themes/monokai_sublime.rb +90 -0
  181. data/lib/rouge/themes/thankful_eyes.rb +71 -0
  182. data/lib/rouge/token.rb +182 -0
  183. data/lib/rouge/util.rb +101 -0
  184. data/lib/rouge/version.rb +7 -0
  185. metadata +231 -0
@@ -0,0 +1,72 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ load_const :Javascript, 'javascript.rb'
6
+ class Qml < Javascript
7
+ title "QML"
8
+ desc 'QML, a UI markup language'
9
+ tag 'qml'
10
+ aliases 'qml'
11
+ filenames '*.qml'
12
+
13
+ mimetypes 'application/x-qml', 'text/x-qml'
14
+
15
+ id_with_dots = /[$a-zA-Z_][a-zA-Z0-9_.]*/
16
+
17
+ prepend :root do
18
+ rule /(#{id_with_dots})(\s*)({)/ do
19
+ groups Keyword::Type, Text, Punctuation
20
+ push :type_block
21
+ end
22
+ rule /(#{id_with_dots})(\s+)(on)(\s+)(#{id_with_dots})(\s*)({)/ do
23
+ groups Keyword::Type, Text, Keyword, Text, Name::Label, Text, Punctuation
24
+ push :type_block
25
+ end
26
+
27
+ rule /[{]/, Punctuation, :push
28
+ end
29
+
30
+ state :type_block do
31
+ rule /(id)(\s*)(:)(\s*)(#{id_with_dots})/ do
32
+ groups Name::Label, Text, Punctuation, Text, Keyword::Declaration
33
+ end
34
+
35
+ rule /(#{id_with_dots})(\s*)(:)/ do
36
+ groups Name::Label, Text, Punctuation
37
+ push :expr_start
38
+ end
39
+
40
+ rule /(signal)(\s+)(#{id_with_dots})/ do
41
+ groups Keyword::Declaration, Text, Name::Label
42
+ push :signal
43
+ end
44
+
45
+ rule /(property)(\s+)(#{id_with_dots})(\s+)(#{id_with_dots})(\s*)(:?)/ do
46
+ groups Keyword::Declaration, Text, Keyword::Type, Text, Name::Label, Text, Punctuation
47
+ push :expr_start
48
+ end
49
+
50
+ rule /[}]/, Punctuation, :pop!
51
+ mixin :root
52
+ end
53
+
54
+ state :signal do
55
+ mixin :comments_and_whitespace
56
+ rule /\(/ do
57
+ token Punctuation
58
+ goto :signal_args
59
+ end
60
+ rule //, Text, :pop!
61
+ end
62
+
63
+ state :signal_args do
64
+ mixin :comments_and_whitespace
65
+ rule /(#{id_with_dots})(\s+)(#{id_with_dots})(\s*)(,?)/ do
66
+ groups Keyword::Type, Text, Name, Text, Punctuation
67
+ end
68
+ rule /\)/ , Punctuation, :pop!
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,56 @@
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', '.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
+ def self.keywords
16
+ @keywords ||= %w(
17
+ if else for while repeat in next break return switch function
18
+ )
19
+ end
20
+
21
+ def self.analyze_text(text)
22
+ return 1 if text.shebang? 'Rscript'
23
+ end
24
+
25
+ state :root do
26
+ rule /#.*?\n/, Comment::Single
27
+ rule /\s+/m, Text
28
+ rule /[.]?[a-zA-Z_][\w.]*/ do |m|
29
+ if self.class.keywords.include? m[0]
30
+ token Keyword
31
+ else
32
+ token Name
33
+ end
34
+ end
35
+
36
+ rule /`.*?`/, Str::Backtick
37
+ rule /'(\\.|.)*?'/m, Str::Single
38
+ rule /"(\\.|.)*?"/m, Str::Double
39
+
40
+ rule /\b(NULL|Inf|TRUE|FALSE|NaN)\b/, Keyword::Constant
41
+ rule /\bNA(_(integer|real|complex|character)_)?\b/,
42
+ Keyword::Constant
43
+ rule /\b[TF]\b/, Keyword::Variable
44
+
45
+ rule /0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?/, Num::Hex
46
+ rule /[+-]?(\d+([.]\d+)?|[.]\d+)([eE][+-]?\d+)?[Li]?/,
47
+ Num
48
+
49
+ rule /[\[\]{}();,]/, Punctuation
50
+
51
+ rule %r([-<>?*+^/!=~$@:%&|]), Operator
52
+ rule /[.][.][.]/, Keyword
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,542 @@
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.analyze_text(text)
13
+ text = text.strip
14
+ return 1 if text.start_with? '#lang racket'
15
+ return 0.6 if text =~ %r(\A#lang [a-z/-]+$)i
16
+ end
17
+
18
+ def self.keywords
19
+ @keywords ||= Set.new %w(
20
+ ... and begin begin-for-syntax begin0 case case-lambda cond
21
+ datum->syntax-object define define-for-syntax define-logger
22
+ define-struct define-syntax define-syntax-rule
23
+ define-syntaxes define-values define-values-for-syntax delay
24
+ do expand-path fluid-let force hash-table-copy
25
+ hash-table-count hash-table-for-each hash-table-get
26
+ hash-table-iterate-first hash-table-iterate-key
27
+ hash-table-iterate-next hash-table-iterate-value
28
+ hash-table-map hash-table-put! hash-table-remove!
29
+ hash-table? if lambda let let* let*-values let-struct
30
+ let-syntax let-syntaxes let-values let/cc let/ec letrec
31
+ letrec-syntax letrec-syntaxes letrec-syntaxes+values
32
+ letrec-values list-immutable make-hash-table
33
+ make-immutable-hash-table make-namespace module module*
34
+ module-identifier=? module-label-identifier=?
35
+ module-template-identifier=? module-transformer-identifier=?
36
+ namespace-transformer-require or parameterize parameterize*
37
+ parameterize-break promise? prop:method-arity-error provide
38
+ provide-for-label provide-for-syntax quasiquote quasisyntax
39
+ quasisyntax/loc quote quote-syntax quote-syntax/prune
40
+ require require-for-label require-for-syntax
41
+ require-for-template set! set!-values syntax syntax-case
42
+ syntax-case* syntax-id-rules syntax-object->datum
43
+ syntax-rules syntax/loc tcp-abandon-port tcp-accept
44
+ tcp-accept-evt tcp-accept-ready? tcp-accept/enable-break
45
+ tcp-addresses tcp-close tcp-connect tcp-connect/enable-break
46
+ tcp-listen tcp-listener? tcp-port? time transcript-off
47
+ transcript-on udp-addresses udp-bind! udp-bound? udp-close
48
+ udp-connect! udp-connected? udp-multicast-interface
49
+ udp-multicast-join-group! udp-multicast-leave-group!
50
+ udp-multicast-loopback? udp-multicast-set-interface!
51
+ udp-multicast-set-loopback! udp-multicast-set-ttl!
52
+ udp-multicast-ttl udp-open-socket udp-receive! udp-receive!*
53
+ udp-receive!-evt udp-receive!/enable-break
54
+ udp-receive-ready-evt udp-send udp-send* udp-send-evt
55
+ udp-send-ready-evt udp-send-to udp-send-to* udp-send-to-evt
56
+ udp-send-to/enable-break udp-send/enable-break udp? unless
57
+ unquote unquote-splicing unsyntax unsyntax-splicing when
58
+ with-continuation-mark with-handlers with-handlers*
59
+ with-syntax λ)
60
+ end
61
+
62
+ def self.builtins
63
+ @builtins ||= Set.new %w(
64
+ * + - / < <= = > >=
65
+ abort-current-continuation abs absolute-path? acos add1
66
+ alarm-evt always-evt andmap angle append apply
67
+ arithmetic-shift arity-at-least arity-at-least-value
68
+ arity-at-least? asin assoc assq assv atan banner bitwise-and
69
+ bitwise-bit-field bitwise-bit-set? bitwise-ior bitwise-not
70
+ bitwise-xor boolean? bound-identifier=? box box-cas!
71
+ box-immutable box? break-enabled break-thread build-path
72
+ build-path/convention-type byte-pregexp byte-pregexp?
73
+ byte-ready? byte-regexp byte-regexp? byte? bytes
74
+ bytes->immutable-bytes bytes->list bytes->path
75
+ bytes->path-element bytes->string/latin-1
76
+ bytes->string/locale bytes->string/utf-8 bytes-append
77
+ bytes-close-converter bytes-convert bytes-convert-end
78
+ bytes-converter? bytes-copy bytes-copy!
79
+ bytes-environment-variable-name? bytes-fill! bytes-length
80
+ bytes-open-converter bytes-ref bytes-set! bytes-utf-8-index
81
+ bytes-utf-8-length bytes-utf-8-ref bytes<? bytes=? bytes>?
82
+ bytes? caaaar caaadr caaar caadar caaddr caadr caar cadaar
83
+ cadadr cadar caddar cadddr caddr cadr call-in-nested-thread
84
+ call-with-break-parameterization
85
+ call-with-composable-continuation
86
+ call-with-continuation-barrier call-with-continuation-prompt
87
+ call-with-current-continuation
88
+ call-with-default-reading-parameterization
89
+ call-with-escape-continuation call-with-exception-handler
90
+ call-with-immediate-continuation-mark call-with-input-file
91
+ call-with-output-file call-with-parameterization
92
+ call-with-semaphore call-with-semaphore/enable-break
93
+ call-with-values call/cc call/ec car cdaaar cdaadr cdaar
94
+ cdadar cdaddr cdadr cdar cddaar cddadr cddar cdddar cddddr
95
+ cdddr cddr cdr ceiling channel-get channel-put
96
+ channel-put-evt channel-put-evt? channel-try-get channel?
97
+ chaperone-box chaperone-continuation-mark-key chaperone-evt
98
+ chaperone-hash chaperone-of? chaperone-procedure
99
+ chaperone-prompt-tag chaperone-struct chaperone-struct-type
100
+ chaperone-vector chaperone? char->integer char-alphabetic?
101
+ char-blank? char-ci<=? char-ci<? char-ci=? char-ci>=?
102
+ char-ci>? char-downcase char-foldcase char-general-category
103
+ char-graphic? char-iso-control? char-lower-case?
104
+ char-numeric? char-punctuation? char-ready? char-symbolic?
105
+ char-title-case? char-titlecase char-upcase char-upper-case?
106
+ char-utf-8-length char-whitespace? char<=? char<? char=?
107
+ char>=? char>? char? check-duplicate-identifier
108
+ checked-procedure-check-and-extract choice-evt cleanse-path
109
+ close-input-port close-output-port collect-garbage
110
+ collection-file-path collection-path compile
111
+ compile-allow-set!-undefined
112
+ compile-context-preservation-enabled
113
+ compile-enforce-module-constants compile-syntax
114
+ compiled-expression? compiled-module-expression?
115
+ complete-path? complex? cons continuation-mark-key?
116
+ continuation-mark-set->context continuation-mark-set->list
117
+ continuation-mark-set->list* continuation-mark-set-first
118
+ continuation-mark-set? continuation-marks
119
+ continuation-prompt-available? continuation-prompt-tag?
120
+ continuation? copy-file cos current-break-parameterization
121
+ current-code-inspector current-command-line-arguments
122
+ current-compile current-compiled-file-roots
123
+ current-continuation-marks current-custodian
124
+ current-directory current-directory-for-user current-drive
125
+ current-environment-variables current-error-port
126
+ current-eval current-evt-pseudo-random-generator
127
+ current-gc-milliseconds current-get-interaction-input-port
128
+ current-inexact-milliseconds current-input-port
129
+ current-inspector current-library-collection-paths
130
+ current-load current-load-extension
131
+ current-load-relative-directory current-load/use-compiled
132
+ current-locale current-memory-use current-milliseconds
133
+ current-module-declare-name current-module-declare-source
134
+ current-module-name-resolver current-module-path-for-load
135
+ current-namespace current-output-port
136
+ current-parameterization
137
+ current-preserved-thread-cell-values current-print
138
+ current-process-milliseconds current-prompt-read
139
+ current-pseudo-random-generator current-read-interaction
140
+ current-reader-guard current-readtable current-seconds
141
+ current-security-guard current-subprocess-custodian-mode
142
+ current-thread current-thread-group
143
+ current-thread-initial-stack-size
144
+ current-write-relative-directory custodian-box-value
145
+ custodian-box? custodian-limit-memory custodian-managed-list
146
+ custodian-memory-accounting-available?
147
+ custodian-require-memory custodian-shutdown-all custodian?
148
+ custom-print-quotable-accessor custom-print-quotable?
149
+ custom-write-accessor custom-write? date date*
150
+ date*-nanosecond date*-time-zone-name date*? date-day
151
+ date-dst? date-hour date-minute date-month date-second
152
+ date-time-zone-offset date-week-day date-year date-year-day
153
+ date? datum-intern-literal default-continuation-prompt-tag
154
+ delete-directory delete-file denominator directory-exists?
155
+ directory-list display displayln dump-memory-stats
156
+ dynamic-require dynamic-require-for-syntax dynamic-wind
157
+ environment-variables-copy environment-variables-names
158
+ environment-variables-ref environment-variables-set!
159
+ environment-variables? eof eof-object? ephemeron-value
160
+ ephemeron? eprintf eq-hash-code eq? equal-hash-code
161
+ equal-secondary-hash-code equal? equal?/recur eqv-hash-code
162
+ eqv? error error-display-handler error-escape-handler
163
+ error-print-context-length error-print-source-location
164
+ error-print-width error-value->string-handler eval
165
+ eval-jit-enabled eval-syntax even? evt? exact->inexact
166
+ exact-integer? exact-nonnegative-integer?
167
+ exact-positive-integer? exact? executable-yield-handler exit
168
+ exit-handler exn exn-continuation-marks exn-message
169
+ exn:break exn:break-continuation exn:break:hang-up
170
+ exn:break:hang-up? exn:break:terminate exn:break:terminate?
171
+ exn:break? exn:fail exn:fail:contract
172
+ exn:fail:contract:arity exn:fail:contract:arity?
173
+ exn:fail:contract:continuation
174
+ exn:fail:contract:continuation?
175
+ exn:fail:contract:divide-by-zero
176
+ exn:fail:contract:divide-by-zero?
177
+ exn:fail:contract:non-fixnum-result
178
+ exn:fail:contract:non-fixnum-result?
179
+ exn:fail:contract:variable exn:fail:contract:variable-id
180
+ exn:fail:contract:variable? exn:fail:contract?
181
+ exn:fail:filesystem exn:fail:filesystem:errno
182
+ exn:fail:filesystem:errno-errno exn:fail:filesystem:errno?
183
+ exn:fail:filesystem:exists exn:fail:filesystem:exists?
184
+ exn:fail:filesystem:missing-module
185
+ exn:fail:filesystem:missing-module-path
186
+ exn:fail:filesystem:missing-module?
187
+ exn:fail:filesystem:version exn:fail:filesystem:version?
188
+ exn:fail:filesystem? exn:fail:network exn:fail:network:errno
189
+ exn:fail:network:errno-errno exn:fail:network:errno?
190
+ exn:fail:network? exn:fail:out-of-memory
191
+ exn:fail:out-of-memory? exn:fail:read exn:fail:read-srclocs
192
+ exn:fail:read:eof exn:fail:read:eof? exn:fail:read:non-char
193
+ exn:fail:read:non-char? exn:fail:read? exn:fail:syntax
194
+ exn:fail:syntax-exprs exn:fail:syntax:missing-module
195
+ exn:fail:syntax:missing-module-path
196
+ exn:fail:syntax:missing-module? exn:fail:syntax:unbound
197
+ exn:fail:syntax:unbound? exn:fail:syntax?
198
+ exn:fail:unsupported exn:fail:unsupported? exn:fail:user
199
+ exn:fail:user? exn:fail? exn:missing-module-accessor
200
+ exn:missing-module? exn:srclocs-accessor exn:srclocs? exn?
201
+ exp expand expand-once expand-syntax expand-syntax-once
202
+ expand-syntax-to-top-form expand-to-top-form
203
+ expand-user-path explode-path expt file-exists?
204
+ file-or-directory-identity file-or-directory-modify-seconds
205
+ file-or-directory-permissions file-position file-position*
206
+ file-size file-stream-buffer-mode file-stream-port?
207
+ file-truncate filesystem-change-evt
208
+ filesystem-change-evt-cancel filesystem-change-evt?
209
+ filesystem-root-list find-executable-path
210
+ find-library-collection-paths find-system-path fixnum?
211
+ floating-point-bytes->real flonum? floor flush-output
212
+ for-each format fprintf free-identifier=? gcd
213
+ generate-temporaries gensym get-output-bytes
214
+ get-output-string getenv global-port-print-handler guard-evt
215
+ handle-evt handle-evt? hash hash-equal? hash-eqv?
216
+ hash-has-key? hash-placeholder? hash-ref! hasheq hasheqv
217
+ identifier-binding identifier-binding-symbol
218
+ identifier-label-binding identifier-prune-lexical-context
219
+ identifier-prune-to-source-module
220
+ identifier-remove-from-definition-context
221
+ identifier-template-binding identifier-transformer-binding
222
+ identifier? imag-part immutable? impersonate-box
223
+ impersonate-continuation-mark-key impersonate-hash
224
+ impersonate-procedure impersonate-prompt-tag
225
+ impersonate-struct impersonate-vector impersonator-ephemeron
226
+ impersonator-of? impersonator-prop:application-mark
227
+ impersonator-property-accessor-procedure?
228
+ impersonator-property? impersonator? inexact->exact
229
+ inexact-real? inexact? input-port? inspector? integer->char
230
+ integer->integer-bytes integer-bytes->integer integer-length
231
+ integer-sqrt integer-sqrt/remainder integer?
232
+ internal-definition-context-seal
233
+ internal-definition-context? keyword->string keyword<?
234
+ keyword? kill-thread lcm length liberal-define-context?
235
+ link-exists? list list* list->bytes list->string
236
+ list->vector list-ref list-tail list? load load-extension
237
+ load-on-demand-enabled load-relative load-relative-extension
238
+ load/cd load/use-compiled local-expand
239
+ local-expand/capture-lifts local-transformer-expand
240
+ local-transformer-expand/capture-lifts
241
+ locale-string-encoding log log-max-level magnitude
242
+ make-arity-at-least make-bytes make-channel
243
+ make-continuation-mark-key make-continuation-prompt-tag
244
+ make-custodian make-custodian-box make-date make-date*
245
+ make-derived-parameter make-directory
246
+ make-environment-variables make-ephemeron make-exn
247
+ make-exn:break make-exn:break:hang-up
248
+ make-exn:break:terminate make-exn:fail
249
+ make-exn:fail:contract make-exn:fail:contract:arity
250
+ make-exn:fail:contract:continuation
251
+ make-exn:fail:contract:divide-by-zero
252
+ make-exn:fail:contract:non-fixnum-result
253
+ make-exn:fail:contract:variable make-exn:fail:filesystem
254
+ make-exn:fail:filesystem:errno
255
+ make-exn:fail:filesystem:exists
256
+ make-exn:fail:filesystem:missing-module
257
+ make-exn:fail:filesystem:version make-exn:fail:network
258
+ make-exn:fail:network:errno make-exn:fail:out-of-memory
259
+ make-exn:fail:read make-exn:fail:read:eof
260
+ make-exn:fail:read:non-char make-exn:fail:syntax
261
+ make-exn:fail:syntax:missing-module
262
+ make-exn:fail:syntax:unbound make-exn:fail:unsupported
263
+ make-exn:fail:user make-file-or-directory-link
264
+ make-hash-placeholder make-hasheq-placeholder make-hasheqv
265
+ make-hasheqv-placeholder make-immutable-hasheqv
266
+ make-impersonator-property make-input-port make-inspector
267
+ make-known-char-range-list make-output-port make-parameter
268
+ make-phantom-bytes make-pipe make-placeholder make-polar
269
+ make-prefab-struct make-pseudo-random-generator
270
+ make-reader-graph make-readtable make-rectangular
271
+ make-rename-transformer make-resolved-module-path
272
+ make-security-guard make-semaphore make-set!-transformer
273
+ make-shared-bytes make-sibling-inspector
274
+ make-special-comment make-srcloc make-string
275
+ make-struct-field-accessor make-struct-field-mutator
276
+ make-struct-type make-struct-type-property
277
+ make-syntax-delta-introducer make-syntax-introducer
278
+ make-thread-cell make-thread-group make-vector make-weak-box
279
+ make-weak-hasheqv make-will-executor map max mcar mcdr mcons
280
+ member memq memv min module->exports module->imports
281
+ module->language-info module->namespace
282
+ module-compiled-cross-phase-persistent?
283
+ module-compiled-exports module-compiled-imports
284
+ module-compiled-language-info module-compiled-name
285
+ module-compiled-submodules module-declared?
286
+ module-path-index-join module-path-index-resolve
287
+ module-path-index-split module-path-index-submodule
288
+ module-path-index? module-path? module-predefined?
289
+ module-provide-protected? modulo mpair? nack-guard-evt
290
+ namespace-attach-module namespace-attach-module-declaration
291
+ namespace-base-phase namespace-mapped-symbols
292
+ namespace-module-identifier namespace-module-registry
293
+ namespace-require namespace-require/constant
294
+ namespace-require/copy namespace-require/expansion-time
295
+ namespace-set-variable-value! namespace-symbol->identifier
296
+ namespace-syntax-introduce namespace-undefine-variable!
297
+ namespace-unprotect-module namespace-variable-value
298
+ namespace? negative? never-evt newline normal-case-path not
299
+ null null? number->string number? numerator object-name odd?
300
+ open-input-bytes open-input-file open-input-output-file
301
+ open-input-string open-output-bytes open-output-file
302
+ open-output-string ormap output-port? pair?
303
+ parameter-procedure=? parameter? parameterization?
304
+ path->bytes path->complete-path path->directory-path
305
+ path->string path-add-suffix path-convention-type
306
+ path-element->bytes path-element->string
307
+ path-for-some-system? path-list-string->path-list
308
+ path-replace-suffix path-string? path? peek-byte
309
+ peek-byte-or-special peek-bytes peek-bytes!
310
+ peek-bytes-avail! peek-bytes-avail!*
311
+ peek-bytes-avail!/enable-break peek-char
312
+ peek-char-or-special peek-string peek-string! phantom-bytes?
313
+ pipe-content-length placeholder-get placeholder-set!
314
+ placeholder? poll-guard-evt port-closed-evt port-closed?
315
+ port-commit-peeked port-count-lines!
316
+ port-count-lines-enabled port-counts-lines?
317
+ port-display-handler port-file-identity port-file-unlock
318
+ port-next-location port-print-handler port-progress-evt
319
+ port-provides-progress-evts? port-read-handler
320
+ port-try-file-lock? port-write-handler port-writes-atomic?
321
+ port-writes-special? port? positive? prefab-key->struct-type
322
+ prefab-key? prefab-struct-key pregexp pregexp?
323
+ primitive-closure? primitive-result-arity primitive? print
324
+ print-as-expression print-boolean-long-form print-box
325
+ print-graph print-hash-table print-mpair-curly-braces
326
+ print-pair-curly-braces print-reader-abbreviations
327
+ print-struct print-syntax-width print-unreadable
328
+ print-vector-length printf procedure->method procedure-arity
329
+ procedure-arity-includes? procedure-arity?
330
+ procedure-closure-contents-eq? procedure-extract-target
331
+ procedure-reduce-arity procedure-rename
332
+ procedure-struct-type? procedure? progress-evt?
333
+ prop:arity-string prop:checked-procedure
334
+ prop:custom-print-quotable prop:custom-write prop:equal+hash
335
+ prop:evt prop:exn:missing-module prop:exn:srclocs
336
+ prop:impersonator-of prop:input-port
337
+ prop:liberal-define-context prop:output-port prop:procedure
338
+ prop:rename-transformer prop:set!-transformer
339
+ pseudo-random-generator->vector
340
+ pseudo-random-generator-vector? pseudo-random-generator?
341
+ putenv quotient quotient/remainder raise
342
+ raise-argument-error raise-arguments-error raise-arity-error
343
+ raise-mismatch-error raise-range-error raise-result-error
344
+ raise-syntax-error raise-type-error raise-user-error random
345
+ random-seed rational? rationalize read read-accept-bar-quote
346
+ read-accept-box read-accept-compiled read-accept-dot
347
+ read-accept-graph read-accept-infix-dot read-accept-lang
348
+ read-accept-quasiquote read-accept-reader read-byte
349
+ read-byte-or-special read-bytes read-bytes!
350
+ read-bytes-avail! read-bytes-avail!*
351
+ read-bytes-avail!/enable-break read-bytes-line
352
+ read-case-sensitive read-char read-char-or-special
353
+ read-curly-brace-as-paren read-decimal-as-inexact
354
+ read-eval-print-loop read-language read-line
355
+ read-on-demand-source read-square-bracket-as-paren
356
+ read-string read-string! read-syntax read-syntax/recursive
357
+ read/recursive readtable-mapping readtable?
358
+ real->double-flonum real->floating-point-bytes
359
+ real->single-flonum real-part real? regexp regexp-match
360
+ regexp-match-peek regexp-match-peek-immediate
361
+ regexp-match-peek-positions
362
+ regexp-match-peek-positions-immediate
363
+ regexp-match-peek-positions-immediate/end
364
+ regexp-match-peek-positions/end regexp-match-positions
365
+ regexp-match-positions/end regexp-match/end regexp-match?
366
+ regexp-max-lookbehind regexp-replace regexp-replace* regexp?
367
+ relative-path? remainder rename-file-or-directory
368
+ rename-transformer-target rename-transformer? reroot-path
369
+ resolve-path resolved-module-path-name resolved-module-path?
370
+ reverse round seconds->date security-guard?
371
+ semaphore-peek-evt semaphore-peek-evt? semaphore-post
372
+ semaphore-try-wait? semaphore-wait
373
+ semaphore-wait/enable-break semaphore?
374
+ set!-transformer-procedure set!-transformer? set-box!
375
+ set-mcar! set-mcdr! set-phantom-bytes!
376
+ set-port-next-location! shared-bytes shell-execute
377
+ simplify-path sin single-flonum? sleep special-comment-value
378
+ special-comment? split-path sqrt srcloc srcloc->string
379
+ srcloc-column srcloc-line srcloc-position srcloc-source
380
+ srcloc-span srcloc? string string->bytes/latin-1
381
+ string->bytes/locale string->bytes/utf-8
382
+ string->immutable-string string->keyword string->list
383
+ string->number string->path string->path-element
384
+ string->symbol string->uninterned-symbol
385
+ string->unreadable-symbol string-append string-ci<=?
386
+ string-ci<? string-ci=? string-ci>=? string-ci>? string-copy
387
+ string-copy! string-downcase
388
+ string-environment-variable-name? string-fill!
389
+ string-foldcase string-length string-locale-ci<?
390
+ string-locale-ci=? string-locale-ci>? string-locale-downcase
391
+ string-locale-upcase string-locale<? string-locale=?
392
+ string-locale>? string-normalize-nfc string-normalize-nfd
393
+ string-normalize-nfkc string-normalize-nfkd string-ref
394
+ string-set! string-titlecase string-upcase
395
+ string-utf-8-length string<=? string<? string=? string>=?
396
+ string>? string? struct->vector struct-accessor-procedure?
397
+ struct-constructor-procedure? struct-info
398
+ struct-mutator-procedure? struct-predicate-procedure?
399
+ struct-type-info struct-type-make-constructor
400
+ struct-type-make-predicate
401
+ struct-type-property-accessor-procedure?
402
+ struct-type-property? struct-type? struct:arity-at-least
403
+ struct:date struct:date* struct:exn struct:exn:break
404
+ struct:exn:break:hang-up struct:exn:break:terminate
405
+ struct:exn:fail struct:exn:fail:contract
406
+ struct:exn:fail:contract:arity
407
+ struct:exn:fail:contract:continuation
408
+ struct:exn:fail:contract:divide-by-zero
409
+ struct:exn:fail:contract:non-fixnum-result
410
+ struct:exn:fail:contract:variable struct:exn:fail:filesystem
411
+ struct:exn:fail:filesystem:errno
412
+ struct:exn:fail:filesystem:exists
413
+ struct:exn:fail:filesystem:missing-module
414
+ struct:exn:fail:filesystem:version struct:exn:fail:network
415
+ struct:exn:fail:network:errno struct:exn:fail:out-of-memory
416
+ struct:exn:fail:read struct:exn:fail:read:eof
417
+ struct:exn:fail:read:non-char struct:exn:fail:syntax
418
+ struct:exn:fail:syntax:missing-module
419
+ struct:exn:fail:syntax:unbound struct:exn:fail:unsupported
420
+ struct:exn:fail:user struct:srcloc struct? sub1 subbytes
421
+ subprocess subprocess-group-enabled subprocess-kill
422
+ subprocess-pid subprocess-status subprocess-wait subprocess?
423
+ substring symbol->string symbol-interned? symbol-unreadable?
424
+ symbol? sync sync/enable-break sync/timeout
425
+ sync/timeout/enable-break syntax->list syntax-arm
426
+ syntax-column syntax-disarm syntax-e syntax-line
427
+ syntax-local-bind-syntaxes syntax-local-certifier
428
+ syntax-local-context syntax-local-expand-expression
429
+ syntax-local-get-shadower syntax-local-introduce
430
+ syntax-local-lift-context syntax-local-lift-expression
431
+ syntax-local-lift-module-end-declaration
432
+ syntax-local-lift-provide syntax-local-lift-require
433
+ syntax-local-lift-values-expression
434
+ syntax-local-make-definition-context
435
+ syntax-local-make-delta-introducer
436
+ syntax-local-module-defined-identifiers
437
+ syntax-local-module-exports
438
+ syntax-local-module-required-identifiers syntax-local-name
439
+ syntax-local-phase-level syntax-local-submodules
440
+ syntax-local-transforming-module-provides?
441
+ syntax-local-value syntax-local-value/immediate
442
+ syntax-original? syntax-position syntax-property
443
+ syntax-property-symbol-keys syntax-protect syntax-rearm
444
+ syntax-recertify syntax-shift-phase-level syntax-source
445
+ syntax-source-module syntax-span syntax-taint
446
+ syntax-tainted? syntax-track-origin
447
+ syntax-transforming-module-expression? syntax-transforming?
448
+ syntax? system-big-endian? system-idle-evt
449
+ system-language+country system-library-subpath
450
+ system-path-convention-type system-type tan terminal-port?
451
+ thread thread-cell-ref thread-cell-set! thread-cell-values?
452
+ thread-cell? thread-dead-evt thread-dead? thread-group?
453
+ thread-resume thread-resume-evt thread-rewind-receive
454
+ thread-running? thread-suspend thread-suspend-evt
455
+ thread-wait thread/suspend-to-kill thread? time-apply
456
+ truncate unbox uncaught-exception-handler
457
+ use-collection-link-paths use-compiled-file-paths
458
+ use-user-specific-search-paths values
459
+ variable-reference->empty-namespace
460
+ variable-reference->module-base-phase
461
+ variable-reference->module-declaration-inspector
462
+ variable-reference->module-path-index
463
+ variable-reference->module-source
464
+ variable-reference->namespace variable-reference->phase
465
+ variable-reference->resolved-module-path
466
+ variable-reference-constant? variable-reference? vector
467
+ vector->immutable-vector vector->list
468
+ vector->pseudo-random-generator
469
+ vector->pseudo-random-generator! vector->values vector-fill!
470
+ vector-immutable vector-length vector-ref vector-set!
471
+ vector-set-performance-stats! vector? version void void?
472
+ weak-box-value weak-box? will-execute will-executor?
473
+ will-register will-try-execute with-input-from-file
474
+ with-output-to-file wrap-evt write write-byte write-bytes
475
+ write-bytes-avail write-bytes-avail* write-bytes-avail-evt
476
+ write-bytes-avail/enable-break write-char write-special
477
+ write-special-avail* write-special-evt write-string zero?
478
+ )
479
+ end
480
+
481
+ # Since Racket allows identifiers to consist of nearly anything,
482
+ # it's simpler to describe what an ID is _not_.
483
+ id = /[^\s\(\)\[\]\{\}'`,.]+/i
484
+
485
+ state :root do
486
+ # comments
487
+ rule /;.*$/, Comment::Single
488
+ rule /\s+/m, Text
489
+
490
+ rule /[+-]inf[.][f0]/, Num::Float
491
+ rule /[+-]nan[.]0/, Num::Float
492
+ rule /[-]min[.]0/, Num::Float
493
+ rule /[+]max[.]0/, Num::Float
494
+
495
+ rule /-?\d+\.\d+/, Num::Float
496
+ rule /-?\d+/, Num::Integer
497
+
498
+ rule /#:#{id}+/, Name::Tag # keyword
499
+
500
+ rule /#b[01]+/, Num::Bin
501
+ rule /#o[0-7]+/, Num::Oct
502
+ rule /#d[0-9]+/, Num::Integer
503
+ rule /#x[0-9a-f]+/i, Num::Hex
504
+ rule /#[ei][\d.]+/, Num::Other
505
+
506
+ rule /"(\\\\|\\"|[^"])*"/, Str
507
+ rule /['`]#{id}/i, Str::Symbol
508
+ rule /#\\([()\/'"._!\$%& ?=+-]{1}|[a-z0-9]+)/i,
509
+ Str::Char
510
+ rule /#t|#f/, Name::Constant
511
+ rule /(?:'|#|`|,@|,|\.)/, Operator
512
+
513
+ rule /(['#])(\s*)(\()/m do
514
+ groups Str::Symbol, Text, Punctuation
515
+ end
516
+
517
+ # () [] {} are all permitted as like pairs
518
+ rule /\(|\[|\{/, Punctuation, :command
519
+ rule /\)|\]|\}/, Punctuation
520
+
521
+ rule id, Name::Variable
522
+ end
523
+
524
+ state :command do
525
+ rule id, Name::Function do |m|
526
+ if self.class.keywords.include? m[0]
527
+ token Keyword
528
+ elsif self.class.builtins.include? m[0]
529
+ token Name::Builtin
530
+ else
531
+ token Name::Function
532
+ end
533
+
534
+ pop!
535
+ end
536
+
537
+ rule(//) { pop! }
538
+ end
539
+
540
+ end
541
+ end
542
+ end