rouge 3.18.0

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