rouge 3.1.0 → 3.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (318) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +17 -3
  3. data/bin/rougify +1 -0
  4. data/lib/rouge.rb +67 -42
  5. data/lib/rouge/cli.rb +87 -18
  6. data/lib/rouge/demos/ada +26 -0
  7. data/lib/rouge/demos/apex +9 -0
  8. data/lib/rouge/demos/armasm +12 -0
  9. data/lib/rouge/demos/batchfile +3 -0
  10. data/lib/rouge/demos/bbcbasic +6 -0
  11. data/lib/rouge/demos/bpf +7 -0
  12. data/lib/rouge/demos/brainfuck +5 -0
  13. data/lib/rouge/demos/clean +6 -0
  14. data/lib/rouge/demos/cmhg +8 -0
  15. data/lib/rouge/demos/crystal +45 -0
  16. data/lib/rouge/demos/csvs +8 -0
  17. data/lib/rouge/demos/cuda +11 -0
  18. data/lib/rouge/demos/cypher +5 -0
  19. data/lib/rouge/demos/cython +6 -0
  20. data/lib/rouge/demos/datastudio +21 -0
  21. data/lib/rouge/demos/ecl +18 -0
  22. data/lib/rouge/demos/eex +1 -0
  23. data/lib/rouge/demos/epp +4 -0
  24. data/lib/rouge/demos/escape +3 -0
  25. data/lib/rouge/demos/freefem +16 -0
  26. data/lib/rouge/demos/gdscript +18 -0
  27. data/lib/rouge/demos/ghc-cmm +23 -0
  28. data/lib/rouge/demos/ghc-core +26 -0
  29. data/lib/rouge/demos/haxe +5 -0
  30. data/lib/rouge/demos/hcl +7 -0
  31. data/lib/rouge/demos/hocon +8 -0
  32. data/lib/rouge/demos/hql +5 -0
  33. data/lib/rouge/demos/isbl +4 -0
  34. data/lib/rouge/demos/jsl +3 -0
  35. data/lib/rouge/demos/jsp +29 -0
  36. data/lib/rouge/demos/liquid +0 -1
  37. data/lib/rouge/demos/lustre +6 -0
  38. data/lib/rouge/demos/lutin +18 -0
  39. data/lib/rouge/demos/m68k +16 -0
  40. data/lib/rouge/demos/magik +6 -0
  41. data/lib/rouge/demos/mason +22 -0
  42. data/lib/rouge/demos/mathematica +8 -0
  43. data/lib/rouge/demos/minizinc +23 -0
  44. data/lib/rouge/demos/msgtrans +4 -0
  45. data/lib/rouge/demos/nasm +6 -6
  46. data/lib/rouge/demos/nesasm +11 -0
  47. data/lib/rouge/demos/objective_cpp +17 -0
  48. data/lib/rouge/demos/openedge +4 -0
  49. data/lib/rouge/demos/opentype_feature_file +6 -0
  50. data/lib/rouge/demos/plist +1 -132
  51. data/lib/rouge/demos/powershell +12 -48
  52. data/lib/rouge/demos/q +6 -0
  53. data/lib/rouge/demos/reasonml +12 -0
  54. data/lib/rouge/demos/rego +8 -0
  55. data/lib/rouge/demos/robot_framework +27 -0
  56. data/lib/rouge/demos/sas +13 -0
  57. data/lib/rouge/demos/slice +10 -0
  58. data/lib/rouge/demos/solidity +13 -0
  59. data/lib/rouge/demos/sparql +6 -0
  60. data/lib/rouge/demos/sqf +14 -0
  61. data/lib/rouge/demos/supercollider +11 -0
  62. data/lib/rouge/demos/terraform +16 -0
  63. data/lib/rouge/demos/ttcn3 +6 -0
  64. data/lib/rouge/demos/vcl +12 -0
  65. data/lib/rouge/demos/xojo +14 -0
  66. data/lib/rouge/demos/xpath +2 -0
  67. data/lib/rouge/demos/xquery +22 -0
  68. data/lib/rouge/demos/yang +17 -0
  69. data/lib/rouge/formatter.rb +39 -2
  70. data/lib/rouge/formatters/html.rb +21 -2
  71. data/lib/rouge/formatters/html_inline.rb +1 -0
  72. data/lib/rouge/formatters/html_legacy.rb +1 -0
  73. data/lib/rouge/formatters/html_line_table.rb +53 -0
  74. data/lib/rouge/formatters/html_linewise.rb +7 -11
  75. data/lib/rouge/formatters/html_pygments.rb +2 -0
  76. data/lib/rouge/formatters/html_table.rb +21 -31
  77. data/lib/rouge/formatters/null.rb +1 -0
  78. data/lib/rouge/formatters/terminal256.rb +23 -5
  79. data/lib/rouge/formatters/terminal_truecolor.rb +37 -0
  80. data/lib/rouge/formatters/tex.rb +92 -0
  81. data/lib/rouge/guesser.rb +2 -0
  82. data/lib/rouge/guessers/disambiguation.rb +35 -0
  83. data/lib/rouge/guessers/filename.rb +2 -0
  84. data/lib/rouge/guessers/glob_mapping.rb +3 -1
  85. data/lib/rouge/guessers/mimetype.rb +2 -0
  86. data/lib/rouge/guessers/modeline.rb +3 -1
  87. data/lib/rouge/guessers/source.rb +3 -1
  88. data/lib/rouge/guessers/util.rb +2 -0
  89. data/lib/rouge/lexer.rb +71 -15
  90. data/lib/rouge/lexers/abap.rb +13 -11
  91. data/lib/rouge/lexers/actionscript.rb +35 -34
  92. data/lib/rouge/lexers/ada.rb +162 -0
  93. data/lib/rouge/lexers/apache.rb +13 -15
  94. data/lib/rouge/lexers/apache/keywords.rb +15 -0
  95. data/lib/rouge/lexers/apex.rb +126 -0
  96. data/lib/rouge/lexers/apiblueprint.rb +2 -0
  97. data/lib/rouge/lexers/apple_script.rb +17 -14
  98. data/lib/rouge/lexers/armasm.rb +145 -0
  99. data/lib/rouge/lexers/awk.rb +26 -25
  100. data/lib/rouge/lexers/batchfile.rb +164 -0
  101. data/lib/rouge/lexers/bbcbasic.rb +112 -0
  102. data/lib/rouge/lexers/biml.rb +6 -4
  103. data/lib/rouge/lexers/bpf.rb +118 -0
  104. data/lib/rouge/lexers/brainfuck.rb +53 -0
  105. data/lib/rouge/lexers/bsl.rb +13 -12
  106. data/lib/rouge/lexers/c.rb +35 -57
  107. data/lib/rouge/lexers/ceylon.rb +7 -34
  108. data/lib/rouge/lexers/cfscript.rb +27 -26
  109. data/lib/rouge/lexers/clean.rb +156 -0
  110. data/lib/rouge/lexers/clojure.rb +15 -14
  111. data/lib/rouge/lexers/cmake.rb +16 -14
  112. data/lib/rouge/lexers/cmhg.rb +34 -0
  113. data/lib/rouge/lexers/coffeescript.rb +90 -49
  114. data/lib/rouge/lexers/common_lisp.rb +39 -38
  115. data/lib/rouge/lexers/conf.rb +7 -6
  116. data/lib/rouge/lexers/console.rb +92 -38
  117. data/lib/rouge/lexers/coq.rb +27 -23
  118. data/lib/rouge/lexers/cpp.rb +24 -13
  119. data/lib/rouge/lexers/crystal.rb +430 -0
  120. data/lib/rouge/lexers/csharp.rb +29 -29
  121. data/lib/rouge/lexers/css.rb +24 -23
  122. data/lib/rouge/lexers/csvs.rb +44 -0
  123. data/lib/rouge/lexers/cuda.rb +35 -0
  124. data/lib/rouge/lexers/cypher.rb +108 -0
  125. data/lib/rouge/lexers/cython.rb +151 -0
  126. data/lib/rouge/lexers/d.rb +64 -63
  127. data/lib/rouge/lexers/dart.rb +34 -33
  128. data/lib/rouge/lexers/datastudio.rb +138 -0
  129. data/lib/rouge/lexers/diff.rb +10 -4
  130. data/lib/rouge/lexers/digdag.rb +3 -1
  131. data/lib/rouge/lexers/docker.rb +12 -11
  132. data/lib/rouge/lexers/dot.rb +19 -18
  133. data/lib/rouge/lexers/ecl.rb +175 -0
  134. data/lib/rouge/lexers/eex.rb +52 -0
  135. data/lib/rouge/lexers/eiffel.rb +21 -20
  136. data/lib/rouge/lexers/elixir.rb +52 -36
  137. data/lib/rouge/lexers/elm.rb +30 -29
  138. data/lib/rouge/lexers/epp.rb +51 -0
  139. data/lib/rouge/lexers/erb.rb +5 -4
  140. data/lib/rouge/lexers/erlang.rb +1 -0
  141. data/lib/rouge/lexers/escape.rb +58 -0
  142. data/lib/rouge/lexers/factor.rb +41 -40
  143. data/lib/rouge/lexers/fortran.rb +36 -34
  144. data/lib/rouge/lexers/freefem.rb +240 -0
  145. data/lib/rouge/lexers/fsharp.rb +33 -31
  146. data/lib/rouge/lexers/gdscript.rb +171 -0
  147. data/lib/rouge/lexers/ghc_cmm.rb +340 -0
  148. data/lib/rouge/lexers/ghc_core.rb +151 -0
  149. data/lib/rouge/lexers/gherkin.rb +17 -14
  150. data/lib/rouge/lexers/gherkin/keywords.rb +2 -0
  151. data/lib/rouge/lexers/glsl.rb +2 -5
  152. data/lib/rouge/lexers/go.rb +3 -2
  153. data/lib/rouge/lexers/gradle.rb +1 -0
  154. data/lib/rouge/lexers/graphql.rb +78 -60
  155. data/lib/rouge/lexers/groovy.rb +24 -25
  156. data/lib/rouge/lexers/hack.rb +2 -1
  157. data/lib/rouge/lexers/haml.rb +26 -29
  158. data/lib/rouge/lexers/handlebars.rb +32 -20
  159. data/lib/rouge/lexers/haskell.rb +78 -61
  160. data/lib/rouge/lexers/haxe.rb +246 -0
  161. data/lib/rouge/lexers/hcl.rb +163 -0
  162. data/lib/rouge/lexers/hocon.rb +86 -0
  163. data/lib/rouge/lexers/hql.rb +139 -0
  164. data/lib/rouge/lexers/html.rb +36 -33
  165. data/lib/rouge/lexers/http.rb +10 -9
  166. data/lib/rouge/lexers/hylang.rb +15 -14
  167. data/lib/rouge/lexers/idlang.rb +34 -32
  168. data/lib/rouge/lexers/igorpro.rb +481 -225
  169. data/lib/rouge/lexers/ini.rb +13 -12
  170. data/lib/rouge/lexers/io.rb +10 -9
  171. data/lib/rouge/lexers/irb.rb +6 -5
  172. data/lib/rouge/lexers/isbl.rb +97 -0
  173. data/lib/rouge/lexers/isbl/builtins.rb +17 -0
  174. data/lib/rouge/lexers/java.rb +30 -26
  175. data/lib/rouge/lexers/javascript.rb +59 -61
  176. data/lib/rouge/lexers/jinja.rb +39 -22
  177. data/lib/rouge/lexers/jsl.rb +55 -0
  178. data/lib/rouge/lexers/json.rb +54 -11
  179. data/lib/rouge/lexers/json_doc.rb +8 -5
  180. data/lib/rouge/lexers/jsonnet.rb +19 -18
  181. data/lib/rouge/lexers/jsp.rb +120 -0
  182. data/lib/rouge/lexers/jsx.rb +18 -16
  183. data/lib/rouge/lexers/julia.rb +192 -74
  184. data/lib/rouge/lexers/kotlin.rb +79 -27
  185. data/lib/rouge/lexers/lasso.rb +54 -58
  186. data/lib/rouge/lexers/lasso/keywords.rb +14 -0
  187. data/lib/rouge/lexers/liquid.rb +116 -118
  188. data/lib/rouge/lexers/literate_coffeescript.rb +3 -2
  189. data/lib/rouge/lexers/literate_haskell.rb +6 -5
  190. data/lib/rouge/lexers/llvm.rb +66 -49
  191. data/lib/rouge/lexers/lua.rb +43 -4
  192. data/lib/rouge/lexers/lua/builtins.rb +2 -0
  193. data/lib/rouge/lexers/lustre.rb +79 -0
  194. data/lib/rouge/lexers/lutin.rb +33 -0
  195. data/lib/rouge/lexers/m68k.rb +143 -0
  196. data/lib/rouge/lexers/magik.rb +127 -0
  197. data/lib/rouge/lexers/make.rb +57 -34
  198. data/lib/rouge/lexers/markdown.rb +67 -39
  199. data/lib/rouge/lexers/mason.rb +110 -0
  200. data/lib/rouge/lexers/mathematica.rb +96 -0
  201. data/lib/rouge/lexers/mathematica/builtins.rb +13 -0
  202. data/lib/rouge/lexers/matlab.rb +26 -17
  203. data/lib/rouge/lexers/matlab/builtins.rb +4 -4
  204. data/lib/rouge/lexers/minizinc.rb +87 -0
  205. data/lib/rouge/lexers/moonscript.rb +4 -3
  206. data/lib/rouge/lexers/mosel.rb +64 -63
  207. data/lib/rouge/lexers/msgtrans.rb +26 -0
  208. data/lib/rouge/lexers/mxml.rb +19 -18
  209. data/lib/rouge/lexers/nasm.rb +43 -169
  210. data/lib/rouge/lexers/nesasm.rb +78 -0
  211. data/lib/rouge/lexers/nginx.rb +15 -14
  212. data/lib/rouge/lexers/nim.rb +4 -2
  213. data/lib/rouge/lexers/nix.rb +48 -42
  214. data/lib/rouge/lexers/objective_c.rb +5 -178
  215. data/lib/rouge/lexers/objective_c/common.rb +184 -0
  216. data/lib/rouge/lexers/objective_cpp.rb +31 -0
  217. data/lib/rouge/lexers/ocaml.rb +29 -64
  218. data/lib/rouge/lexers/ocaml/common.rb +53 -0
  219. data/lib/rouge/lexers/openedge.rb +429 -0
  220. data/lib/rouge/lexers/opentype_feature_file.rb +113 -0
  221. data/lib/rouge/lexers/pascal.rb +6 -5
  222. data/lib/rouge/lexers/perl.rb +103 -68
  223. data/lib/rouge/lexers/php.rb +91 -53
  224. data/lib/rouge/lexers/php/builtins.rb +183 -174
  225. data/lib/rouge/lexers/plain_text.rb +2 -1
  226. data/lib/rouge/lexers/plist.rb +16 -14
  227. data/lib/rouge/lexers/pony.rb +21 -20
  228. data/lib/rouge/lexers/powershell.rb +190 -638
  229. data/lib/rouge/lexers/praat.rb +76 -75
  230. data/lib/rouge/lexers/prolog.rb +27 -19
  231. data/lib/rouge/lexers/prometheus.rb +32 -30
  232. data/lib/rouge/lexers/properties.rb +13 -12
  233. data/lib/rouge/lexers/protobuf.rb +23 -22
  234. data/lib/rouge/lexers/puppet.rb +33 -32
  235. data/lib/rouge/lexers/python.rb +124 -99
  236. data/lib/rouge/lexers/q.rb +17 -14
  237. data/lib/rouge/lexers/qml.rb +13 -12
  238. data/lib/rouge/lexers/r.rb +13 -13
  239. data/lib/rouge/lexers/racket.rb +47 -22
  240. data/lib/rouge/lexers/reasonml.rb +65 -0
  241. data/lib/rouge/lexers/rego.rb +45 -0
  242. data/lib/rouge/lexers/robot_framework.rb +249 -0
  243. data/lib/rouge/lexers/ruby.rb +88 -71
  244. data/lib/rouge/lexers/rust.rb +45 -44
  245. data/lib/rouge/lexers/sas.rb +563 -0
  246. data/lib/rouge/lexers/sass.rb +9 -8
  247. data/lib/rouge/lexers/sass/common.rb +41 -40
  248. data/lib/rouge/lexers/scala.rb +67 -40
  249. data/lib/rouge/lexers/scheme.rb +19 -18
  250. data/lib/rouge/lexers/scss.rb +4 -3
  251. data/lib/rouge/lexers/sed.rb +31 -30
  252. data/lib/rouge/lexers/shell.rb +67 -55
  253. data/lib/rouge/lexers/sieve.rb +10 -9
  254. data/lib/rouge/lexers/slice.rb +32 -0
  255. data/lib/rouge/lexers/slim.rb +27 -26
  256. data/lib/rouge/lexers/smalltalk.rb +34 -33
  257. data/lib/rouge/lexers/smarty.rb +20 -19
  258. data/lib/rouge/lexers/sml.rb +68 -67
  259. data/lib/rouge/lexers/solidity.rb +185 -0
  260. data/lib/rouge/lexers/sparql.rb +129 -0
  261. data/lib/rouge/lexers/sqf.rb +109 -0
  262. data/lib/rouge/lexers/sqf/commands.rb +15 -0
  263. data/lib/rouge/lexers/sql.rb +47 -26
  264. data/lib/rouge/lexers/supercollider.rb +116 -0
  265. data/lib/rouge/lexers/swift.rb +50 -45
  266. data/lib/rouge/lexers/tap.rb +22 -20
  267. data/lib/rouge/lexers/tcl.rb +28 -27
  268. data/lib/rouge/lexers/terraform.rb +128 -0
  269. data/lib/rouge/lexers/tex.rb +20 -19
  270. data/lib/rouge/lexers/toml.rb +59 -20
  271. data/lib/rouge/lexers/tsx.rb +1 -0
  272. data/lib/rouge/lexers/ttcn3.rb +119 -0
  273. data/lib/rouge/lexers/tulip.rb +38 -36
  274. data/lib/rouge/lexers/turtle.rb +36 -38
  275. data/lib/rouge/lexers/twig.rb +1 -0
  276. data/lib/rouge/lexers/typescript.rb +12 -0
  277. data/lib/rouge/lexers/typescript/common.rb +1 -0
  278. data/lib/rouge/lexers/vala.rb +19 -18
  279. data/lib/rouge/lexers/varnish.rb +168 -0
  280. data/lib/rouge/lexers/vb.rb +28 -27
  281. data/lib/rouge/lexers/verilog.rb +27 -28
  282. data/lib/rouge/lexers/vhdl.rb +13 -12
  283. data/lib/rouge/lexers/viml.rb +15 -14
  284. data/lib/rouge/lexers/viml/keywords.rb +2 -0
  285. data/lib/rouge/lexers/vue.rb +19 -12
  286. data/lib/rouge/lexers/wollok.rb +27 -26
  287. data/lib/rouge/lexers/xml.rb +18 -21
  288. data/lib/rouge/lexers/xojo.rb +61 -0
  289. data/lib/rouge/lexers/xpath.rb +332 -0
  290. data/lib/rouge/lexers/xquery.rb +145 -0
  291. data/lib/rouge/lexers/yaml.rb +64 -61
  292. data/lib/rouge/lexers/yang.rb +147 -0
  293. data/lib/rouge/plugins/redcarpet.rb +9 -2
  294. data/lib/rouge/regex_lexer.rb +27 -25
  295. data/lib/rouge/template_lexer.rb +1 -0
  296. data/lib/rouge/tex_theme_renderer.rb +132 -0
  297. data/lib/rouge/text_analyzer.rb +1 -0
  298. data/lib/rouge/theme.rb +5 -0
  299. data/lib/rouge/themes/base16.rb +1 -0
  300. data/lib/rouge/themes/bw.rb +41 -0
  301. data/lib/rouge/themes/colorful.rb +1 -0
  302. data/lib/rouge/themes/github.rb +1 -0
  303. data/lib/rouge/themes/gruvbox.rb +1 -0
  304. data/lib/rouge/themes/igor_pro.rb +1 -0
  305. data/lib/rouge/themes/magritte.rb +78 -0
  306. data/lib/rouge/themes/molokai.rb +1 -0
  307. data/lib/rouge/themes/monokai.rb +1 -0
  308. data/lib/rouge/themes/monokai_sublime.rb +4 -1
  309. data/lib/rouge/themes/pastie.rb +2 -1
  310. data/lib/rouge/themes/thankful_eyes.rb +2 -1
  311. data/lib/rouge/themes/tulip.rb +2 -1
  312. data/lib/rouge/token.rb +31 -22
  313. data/lib/rouge/util.rb +3 -2
  314. data/lib/rouge/version.rb +2 -1
  315. data/rouge.gemspec +6 -3
  316. metadata +136 -8
  317. data/lib/rouge/lexers/apache/keywords.yml +0 -764
  318. data/lib/rouge/lexers/lasso/keywords.yml +0 -446
@@ -0,0 +1,185 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class Solidity < RegexLexer
6
+ title "Solidity"
7
+ desc "Solidity, an Ethereum smart contract programming language"
8
+ tag 'solidity'
9
+ filenames '*.sol', '*.solidity'
10
+ mimetypes 'text/x-solidity'
11
+
12
+ # optional comment or whitespace
13
+ ws = %r((?:\s|//.*?\n|/[*].*?[*]/)+)
14
+ id = /[a-zA-Z$_][\w$_]*/
15
+
16
+ def self.detect?(text)
17
+ return true if text.start_with? 'pragma solidity'
18
+ end
19
+
20
+ # TODO: seperate by "type"
21
+ def self.keywords
22
+ @keywords ||= Set.new %w(
23
+ abstract anonymous as assembly break catch calldata constant
24
+ constructor continue contract do delete else emit enum event
25
+ external fallback for function hex if indexed interface
26
+ internal import is library mapping memory modifier new
27
+ override payable public pure pragma private receive return
28
+ returns storage struct throw try type using var view virtual
29
+ while
30
+ )
31
+ end
32
+
33
+ def self.builtins
34
+ return @builtins if @builtins
35
+
36
+ @builtins = Set.new %w(
37
+ now
38
+ false true
39
+ balance now selector super this
40
+ blockhash gasleft
41
+ assert require revert
42
+ selfdestruct suicide
43
+ call callcode delegatecall
44
+ send transfer
45
+ addmod ecrecover keccak256 mulmod sha256 sha3 ripemd160
46
+ )
47
+
48
+ # TODO: use (currently shadowed by catch-all in :statements)
49
+ abi = %w(decode encode encodePacked encodeWithSelector encodeWithSignature)
50
+ @builtins.merge( abi.map { |i| "abi.#{i}" } )
51
+ block = %w(coinbase difficulty gaslimit hash number timestamp)
52
+ @builtins.merge( block.map { |i| "block.#{i}" } )
53
+ msg = %w(data gas sender sig value)
54
+ @builtins.merge( msg.map { |i| "msg.#{i}" } )
55
+ tx = %w(gasprice origin)
56
+ @builtins.merge( tx.map { |i| "tx.#{i}" } )
57
+ end
58
+
59
+ def self.constants
60
+ @constants ||= Set.new %w(
61
+ wei finney szabo ether
62
+ seconds minutes hours days weeks years
63
+ )
64
+ end
65
+
66
+ def self.keywords_type
67
+ @keywords_type ||= Set.new %w(
68
+ address bool byte bytes int string uint
69
+ )
70
+ end
71
+
72
+ def self.reserved
73
+ @reserved ||= Set.new %w(
74
+ alias after apply auto case copyof default define final fixed
75
+ immutable implements in inline let macro match mutable null of
76
+ partial promise reference relocatable sealed sizeof static
77
+ supports switch typedef typeof ufixed unchecked
78
+ )
79
+ end
80
+
81
+ start { push :bol }
82
+
83
+ state :expr_bol do
84
+ mixin :inline_whitespace
85
+
86
+ rule(//) { pop! }
87
+ end
88
+
89
+ # :expr_bol is the same as :bol but without labels, since
90
+ # labels can only appear at the beginning of a statement.
91
+ state :bol do
92
+ mixin :expr_bol
93
+ end
94
+
95
+ # TODO: natspec in comments
96
+ state :inline_whitespace do
97
+ rule %r/[ \t\r]+/, Text
98
+ rule %r/\\\n/, Text # line continuation
99
+ rule %r(/\*), Comment::Multiline, :comment_multi
100
+ end
101
+
102
+ state :whitespace do
103
+ rule %r/\n+/m, Text, :bol
104
+ rule %r(//(\\.|.)*?\n), Comment::Single, :bol
105
+ mixin :inline_whitespace
106
+ end
107
+
108
+ state :expr_whitespace do
109
+ rule %r/\n+/m, Text, :expr_bol
110
+ mixin :whitespace
111
+ end
112
+
113
+ state :statements do
114
+ mixin :whitespace
115
+ rule %r/(hex)?\"/, Str, :string_double
116
+ rule %r/(hex)?\'/, Str, :string_single
117
+ rule %r('(\\.|\\[0-7]{1,3}|\\x[a-f0-9]{1,2}|[^\\'\n])')i, Str::Char
118
+ rule %r/\d\d*\.\d+([eE]\d+)?/i, Num::Float
119
+ rule %r/0x[0-9a-f]+/i, Num::Hex
120
+ rule %r/\d+([eE]\d+)?/i, Num::Integer
121
+ rule %r(\*/), Error
122
+ rule %r([~!%^&*+=\|?:<>/-]), Operator
123
+ rule %r/[()\[\],.]/, Punctuation
124
+ rule %r/u?fixed\d+x\d+/, Keyword::Reserved
125
+ rule %r/bytes\d+/, Keyword::Type
126
+ rule %r/u?int\d+/, Keyword::Type
127
+ rule id do |m|
128
+ name = m[0]
129
+
130
+ if self.class.keywords.include? name
131
+ token Keyword
132
+ elsif self.class.builtins.include? name
133
+ token Name::Builtin
134
+ elsif self.class.constants.include? name
135
+ token Keyword::Constant
136
+ elsif self.class.keywords_type.include? name
137
+ token Keyword::Type
138
+ elsif self.class.reserved.include? name
139
+ token Keyword::Reserved
140
+ else
141
+ token Name
142
+ end
143
+ end
144
+ end
145
+
146
+ state :root do
147
+ mixin :expr_whitespace
148
+ rule(//) { push :statement }
149
+ # TODO: function declarations
150
+ end
151
+
152
+ state :statement do
153
+ rule %r/;/, Punctuation, :pop!
154
+ mixin :expr_whitespace
155
+ mixin :statements
156
+ rule %r/[{}]/, Punctuation
157
+ end
158
+
159
+ state :string_common do
160
+ rule %r/\\(u[a-fA-F0-9]{4}|x..|[^x])/, Str::Escape
161
+ rule %r/[^\\\"\'\n]+/, Str
162
+ rule %r/\\\n/, Str # line continuation
163
+ rule %r/\\/, Str # stray backslash
164
+ end
165
+
166
+ state :string_double do
167
+ mixin :string_common
168
+ rule %r/\"/, Str, :pop!
169
+ rule %r/\'/, Str
170
+ end
171
+
172
+ state :string_single do
173
+ mixin :string_common
174
+ rule %r/\'/, Str, :pop!
175
+ rule %r/\"/, Str
176
+ end
177
+
178
+ state :comment_multi do
179
+ rule %r(\*/), Comment::Multiline, :pop!
180
+ rule %r([^*/]+), Comment::Multiline
181
+ rule %r([*/]), Comment::Multiline
182
+ end
183
+ end
184
+ end
185
+ end
@@ -0,0 +1,129 @@
1
+ # -*- coding: utf-8 -*- #
2
+ # frozen_string_literal: true
3
+
4
+ module Rouge
5
+ module Lexers
6
+ class SPARQL < RegexLexer
7
+ title "SPARQL"
8
+ desc "Semantic Query Language, for RDF data"
9
+ tag 'sparql'
10
+ filenames '*.rq'
11
+ mimetypes 'application/sparql-query'
12
+
13
+ def self.builtins
14
+ @builtins = Set.new %w[
15
+ ABS AVG BNODE BOUND CEIL COALESCE CONCAT CONTAINS COUNT DATATYPE DAY
16
+ ENCODE_FOR_URI FLOOR GROUP_CONCAT HOURS IF IRI isBLANK isIRI
17
+ isLITERAL isNUMERIC isURI LANG LANGMATCHES LCASE MAX MD5 MIN MINUTES
18
+ MONTH NOW RAND REGEX REPLACE ROUND SAMETERM SAMPLE SECONDS SEPARATOR
19
+ SHA1 SHA256 SHA384 SHA512 STR STRAFTER STRBEFORE STRDT STRENDS
20
+ STRLANG STRLEN STRSTARTS STRUUID SUBSTR SUM TIMEZONE TZ UCASE URI
21
+ UUID YEAR
22
+ ]
23
+ end
24
+
25
+ def self.keywords
26
+ @keywords = Set.new %w[
27
+ ADD ALL AS ASC ASK BASE BIND BINDINGS BY CLEAR CONSTRUCT COPY CREATE
28
+ DATA DEFAULT DELETE DESC DESCRIBE DISTINCT DROP EXISTS FILTER FROM
29
+ GRAPH GROUP BY HAVING IN INSERT LIMIT LOAD MINUS MOVE NAMED NOT
30
+ OFFSET OPTIONAL ORDER PREFIX SELECT REDUCED SERVICE SILENT TO UNDEF
31
+ UNION USING VALUES WHERE WITH
32
+ ]
33
+ end
34
+
35
+ state :root do
36
+ rule %r(\s+)m, Text::Whitespace
37
+ rule %r(#.*), Comment::Single
38
+
39
+ rule %r("""), Str::Double, :string_double_literal
40
+ rule %r("), Str::Double, :string_double
41
+ rule %r('''), Str::Single, :string_single_literal
42
+ rule %r('), Str::Single, :string_single
43
+
44
+ rule %r([$?]\w+), Name::Variable
45
+ rule %r((\w*:)(\w+)?) do |m|
46
+ token Name::Namespace, m[1]
47
+ token Str::Symbol, m[2]
48
+ end
49
+ rule %r(<[^>]*>), Name::Namespace
50
+ rule %r(true|false)i, Keyword::Constant
51
+
52
+ rule %r([A-Z]\w+\b)i do |m|
53
+ if self.class.builtins.include? m[0].upcase
54
+ token Name::Builtin
55
+ elsif self.class.keywords.include? m[0].upcase
56
+ token Keyword
57
+ else
58
+ token Error
59
+ end
60
+ end
61
+
62
+ rule %r([+\-]?(?:\d+\.\d*|\.\d+)(?:[e][+\-]?[0-9]+)?)i, Num::Float
63
+ rule %r([+\-]?\d+), Num::Integer
64
+ rule %r([\]\[(){}.,;=]), Punctuation
65
+ rule %r([/?*+=!<>]|&&|\|\||\^\^), Operator
66
+ end
67
+
68
+ state :string_double_common do
69
+ mixin :string_escapes
70
+ rule %r(\\), Str::Double
71
+ rule %r([^"\\]+), Str::Double
72
+ end
73
+
74
+ state :string_double do
75
+ rule %r(") do
76
+ token Str::Double
77
+ goto :string_end
78
+ end
79
+ mixin :string_double_common
80
+ end
81
+
82
+ state :string_double_literal do
83
+ rule %r(""") do
84
+ token Str::Double
85
+ goto :string_end
86
+ end
87
+ rule %r("), Str::Double
88
+ mixin :string_double_common
89
+ end
90
+
91
+ state :string_single_common do
92
+ mixin :string_escapes
93
+ rule %r(\\), Str::Single
94
+ rule %r([^'\\]+), Str::Single
95
+ end
96
+
97
+ state :string_single do
98
+ rule %r(') do
99
+ token Str::Single
100
+ goto :string_end
101
+ end
102
+ mixin :string_single_common
103
+ end
104
+
105
+ state :string_single_literal do
106
+ rule %r(''') do
107
+ token Str::Single
108
+ goto :string_end
109
+ end
110
+ rule %r('), Str::Single
111
+ mixin :string_single_common
112
+ end
113
+
114
+ state :string_escapes do
115
+ rule %r(\\[tbnrf"'\\]), Str::Escape
116
+ rule %r(\\u\h{4}), Str::Escape
117
+ rule %r(\\U\h{8}), Str::Escape
118
+ end
119
+
120
+ state :string_end do
121
+ rule %r((@)([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)) do
122
+ groups Operator, Name::Property
123
+ end
124
+ rule %r(\^\^), Operator
125
+ rule(//) { pop! }
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,109 @@
1
+ # -*- coding: utf-8 -*- #
2
+ # frozen_string_literal: true
3
+
4
+ module Rouge
5
+ module Lexers
6
+ class SQF < RegexLexer
7
+ tag "sqf"
8
+ filenames "*.sqf"
9
+
10
+ title "SQF"
11
+ desc "Status Quo Function, a Real Virtuality engine scripting language"
12
+
13
+ def self.wordoperators
14
+ @wordoperators ||= Set.new %w(
15
+ and or not
16
+ )
17
+ end
18
+
19
+ def self.initializers
20
+ @initializers ||= Set.new %w(
21
+ private param params
22
+ )
23
+ end
24
+
25
+ def self.controlflow
26
+ @controlflow ||= Set.new %w(
27
+ if then else exitwith switch do case default while for from to step
28
+ foreach
29
+ )
30
+ end
31
+
32
+ def self.constants
33
+ @constants ||= Set.new %w(
34
+ true false player confignull controlnull displaynull grpnull
35
+ locationnull netobjnull objnull scriptnull tasknull teammembernull
36
+ )
37
+ end
38
+
39
+ def self.namespaces
40
+ @namespaces ||= Set.new %w(
41
+ currentnamespace missionnamespace parsingnamespace profilenamespace
42
+ uinamespace
43
+ )
44
+ end
45
+
46
+ def self.diag_commands
47
+ @diag_commands ||= Set.new %w(
48
+ diag_activemissionfsms diag_activesqfscripts diag_activesqsscripts
49
+ diag_activescripts diag_captureframe diag_captureframetofile
50
+ diag_captureslowframe diag_codeperformance diag_drawmode diag_enable
51
+ diag_enabled diag_fps diag_fpsmin diag_frameno diag_lightnewload
52
+ diag_list diag_log diag_logslowframe diag_mergeconfigfile
53
+ diag_recordturretlimits diag_setlightnew diag_ticktime diag_toggle
54
+ )
55
+ end
56
+
57
+ def self.commands
58
+ load File.join(Lexers::BASE_DIR, "sqf/commands.rb")
59
+ @commands = self.commands
60
+ end
61
+
62
+ state :root do
63
+ # Whitespace
64
+ rule %r"\s+", Text
65
+
66
+ # Preprocessor instructions
67
+ rule %r"/\*.*?\*/"m, Comment::Multiline
68
+ rule %r"//.*", Comment::Single
69
+ rule %r"#(define|undef|if(n)?def|else|endif|include)", Comment::Preproc
70
+ rule %r"\\\r?\n", Comment::Preproc
71
+ rule %r"__(EVAL|EXEC|LINE__|FILE__)", Name::Builtin
72
+
73
+ # Literals
74
+ rule %r"\".*?\"", Literal::String
75
+ rule %r"'.*?'", Literal::String
76
+ rule %r"(\$|0x)[0-9a-fA-F]+", Literal::Number::Hex
77
+ rule %r"[0-9]+(\.)?(e[0-9]+)?", Literal::Number::Float
78
+
79
+ # Symbols
80
+ rule %r"[\!\%\&\*\+\-\/\<\=\>\^\|\#]", Operator
81
+ rule %r"[\(\)\{\}\[\]\,\:\;]", Punctuation
82
+
83
+ # Identifiers (variables and functions)
84
+ rule %r"[a-zA-Z0-9_]+" do |m|
85
+ name = m[0].downcase
86
+ if self.class.wordoperators.include? name
87
+ token Operator::Word
88
+ elsif self.class.initializers.include? name
89
+ token Keyword::Declaration
90
+ elsif self.class.controlflow.include? name
91
+ token Keyword::Reserved
92
+ elsif self.class.constants.include? name
93
+ token Keyword::Constant
94
+ elsif self.class.namespaces.include? name
95
+ token Keyword::Namespace
96
+ elsif self.class.diag_commands.include? name
97
+ token Name::Function
98
+ elsif self.class.commands.include? name
99
+ token Name::Function
100
+ elsif %r"_.+" =~ name
101
+ token Name::Variable
102
+ else
103
+ token Name::Variable::Global
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,15 @@
1
+ # -*- coding: utf-8 -*- #
2
+ # frozen_string_literal: true
3
+
4
+ # automatically generated by `rake builtins:sqf`
5
+ module Rouge
6
+ module Lexers
7
+ class SQF < RegexLexer
8
+ def self.commands
9
+ @commands = Set.new %w(
10
+ abs acos actionids actionkeys actionkeysimages actionkeysnames actionkeysnamesarray actionname activateaddons activatekey add3denconnection add3deneventhandler addcamshake addforcegeneratorrtd additempool addmagazinepool addmissioneventhandler addmusiceventhandler addswitchableunit addtoremainscollector addweaponpool admin agent agltoasl aimpos airdensityrtd airplanethrottle airportside aisfinishheal alive allcontrols allmissionobjects allsimpleobjects allturrets allturrets allvariables allvariables allvariables allvariables allvariables allvariables allvariables animationnames animationstate asin asltoagl asltoatl assert assignedcargo assignedcommander assigneddriver assignedgunner assigneditems assignedtarget assignedteam assignedvehicle assignedvehiclerole atan atg atltoasl attachedobject attachedobjects attachedto attackenabled backpack backpackcargo backpackcontainer backpackitems backpackmagazines behaviour binocular boundingbox boundingboxreal boundingcenter breakout breakto buldozer_enableroaddiag buldozer_loadnewroads buttonaction buttonaction buttonsetaction call camcommitted camdestroy cameraeffectenablehud camerainterest campreloaded camtarget camusenvg cancelsimpletaskdestination canfire canmove canstand cantriggerdynamicsimulation canunloadincombat captive captivenum case cbchecked ceil channelenabled checkaifeature classname clear3deninventory clearallitemsfrombackpack clearbackpackcargo clearbackpackcargoglobal cleargroupicons clearitemcargo clearitemcargoglobal clearmagazinecargo clearmagazinecargoglobal clearoverlay clearweaponcargo clearweaponcargoglobal closedialog closeoverlay collapseobjecttree collect3denhistory collectivertd combatmode commander commandgetout commandstop comment commitoverlay compile compilefinal completedfsm composetext confighierarchy configname configproperties configsourceaddonlist configsourcemod configsourcemodlist copytoclipboard cos count count count create3dencomposition create3denentity createagent createcenter createdialog creatediarylink creategeardialog creategroup createguardedpoint createlocation createmarker createmarkerlocal createmine createsimpleobject createsoundsource createteam createtrigger createvehicle createvehiclecrew crew ctaddheader ctaddrow ctclear ctcursel ctheadercount ctrlactivate ctrlangle ctrlautoscrolldelay ctrlautoscrollrewind ctrlautoscrollspeed ctrlchecked ctrlclassname ctrlcommitted ctrldelete ctrlenable ctrlenabled ctrlenabled ctrlfade ctrlhtmlloaded ctrlidc ctrlidd ctrlmapanimclear ctrlmapanimcommit ctrlmapanimdone ctrlmapmouseover ctrlmapscale ctrlmodel ctrlmodeldirandup ctrlmodelscale ctrlparent ctrlparentcontrolsgroup ctrlposition ctrlscale ctrlsetfocus ctrlsettext ctrlshow ctrlshown ctrltext ctrltext ctrltextheight ctrltextsecondary ctrltextwidth ctrltype ctrlvisible ctrowcount curatoraddons curatorcameraarea curatorcameraareaceiling curatoreditableobjects curatoreditingarea curatoreditingareatype curatorpoints curatorregisteredobjects curatorwaypointcost currentcommand currentmagazine currentmagazinedetail currentmuzzle currenttask currenttasks currentthrowable currentvisionmode currentwaypoint currentweapon currentweaponmode currentzeroing cutobj cutrsc cuttext damage datetonumber deactivatekey debriefingtext debuglog default deg delete3denentities deletecenter deletecollection deletegroup deleteidentity deletelocation deletemarker deletemarkerlocal deletesite deletestatus deleteteam deletevehicle deletewaypoint detach detectedmines diag_captureframe diag_captureframetofile diag_captureslowframe diag_codeperformance diag_dynamicsimulationend diag_lightnewload diag_log diag_logslowframe diag_setlightnew didjipowner difficultyenabled difficultyoption direction direction disablemapindicators disableremotesensors disableuserinput displayparent dissolveteam do3denaction dogetout dostop drawicon3d drawline3d driver drop dynamicsimulationdistance dynamicsimulationdistancecoef dynamicsimulationenabled dynamicsimulationenabled echo edit3denmissionattributes effectivecommander enableaudiofeature enablecamshake enablecaustics enabledebriefingstats enablediaglegend enabledynamicsimulationsystem enableengineartillery enableenvironment enableradio enablesatnormalondetail enablesaving enablesentences enablestressdamage enableteamswitch enabletraffic enableweapondisassembly endmission enginesisonrtd enginespowerrtd enginesrpmrtd enginestorquertd entities entities estimatedtimeleft everybackpack everycontainer execfsm execvm exp expecteddestination exportjipmessages eyedirection eyepos face faction failmission fillweaponsfrompool finddisplay finite firstbackpack flag flaganimationphase flagowner flagside flagtexture fleeing floor for for forceatpositionrtd forcegeneratorrtd forcemap forcerespawn format formation formation formationdirection formationleader formationmembers formationposition formationtask formattext formleader fromeditor fuel fullcrew fullcrew gearidcammocount gearslotammocount gearslotdata get3denactionstate get3denconnections get3denentity get3denentityid get3dengrid get3denlayerentities get3denselected getaimingcoef getallenvsoundcontrollers getallhitpointsdamage getallownedmines getallsoundcontrollers getammocargo getanimaimprecision getanimspeedcoef getarray getartilleryammo getassignedcuratorlogic getassignedcuratorunit getbackpackcargo getbleedingremaining getburningvalue getcameraviewdirection getcenterofmass getconnecteduav getcontainermaxload getcustomaimcoef getdammage getdescription getdir getdirvisual getdlcassetsusagebyname getdlcs getdlcusagetime geteditorcamera geteditormode getenginetargetrpmrtd getfatigue getfieldmanualstartpage getforcedflagtexture getfuelcargo getgroupiconparams getgroupicons getitemcargo getmagazinecargo getmarkercolor getmarkerpos getmarkersize getmarkertype getmass getmissionconfig getmissionconfigvalue getmissionlayerentities getmodelinfo getnumber getobjectdlc getobjectmaterials getobjecttextures getobjecttype getoxygenremaining getpersonuseddlcs getpilotcameradirection getpilotcameraposition getpilotcamerarotation getpilotcameratarget getplatenumber getplayerchannel getplayerscores getplayeruid getpos getpos getposasl getposaslvisual getposaslw getposatl getposatlvisual getposvisual getposworld getpylonmagazines getrepaircargo getrotorbrakertd getshotparents getslingload getstamina getstatvalue getsuppression getterrainheightasl gettext gettrimoffsetrtd getunitloadout getunitloadout getunitloadout getusermfdtext getusermfdvalue getvehiclecargo getweaponcargo getweaponsway getwingsorientationrtd getwingspositionrtd getwppos goggles goto group groupfromnetid groupid groupowner groupselectedunits gunner handgunitems handgunmagazine handgunweapon handshit haspilotcamera hcallgroups hcleader hcremoveallgroups hcselected hcshowbar headgear hidebody hideobject hideobjectglobal hint hintc hintcadet hintsilent hmd hostmission if image importallgroups importance incapacitatedstate inflamed infopanel infopanels ingameuiseteventhandler inheritsfrom inputaction isabletobreathe isagent isaimprecisionenabled isarray isautohoveron isautonomous isautostartupenabledrtd isautotrimonrtd isbleeding isburning isclass iscollisionlighton iscopilotenabled isdamageallowed isdlcavailable isengineon isforcedwalk isformationleader isgroupdeletedwhenempty ishidden isinremainscollector iskeyactive islaseron islighton islocalized ismanualfire ismarkedforcollection isnil isnull isnull isnull isnull isnull isnull isnull isnull isnull isnumber isobjecthidden isobjectrtd isonroad isplayer isrealtime isshowing3dicons issimpleobject issprintallowed isstaminaenabled istext istouchingground isturnedout isuavconnected isvehiclecargo isvehicleradaron iswalking isweapondeployed isweaponrested itemcargo items itemswithmagazines keyimage keyname landresult lasertarget lbadd lbclear lbclear lbcolor lbcolorright lbcursel lbcursel lbdata lbdelete lbpicture lbpictureright lbselection lbsetcolor lbsetcolorright lbsetcursel lbsetdata lbsetpicture lbsetpicturecolor lbsetpicturecolordisabled lbsetpicturecolorselected lbsetpictureright lbsetselectcolor lbsetselectcolorright lbsettext lbsettooltip lbsetvalue lbsize lbsize lbsort lbsort lbsort lbsortbyvalue lbsortbyvalue lbtext lbtextright lbvalue leader leader leader leaderboarddeinit leaderboardgetrows leaderboardinit leaderboardrequestrowsfriends leaderboardrequestrowsglobal leaderboardrequestrowsglobalarounduser leaderboardsrequestuploadscore leaderboardsrequestuploadscorekeepbest leaderboardstate lifestate lightdetachobject lightison linearconversion lineintersects lineintersectsobjs lineintersectssurfaces lineintersectswith list listremotetargets listvehiclesensors ln lnbaddarray lnbaddcolumn lnbaddrow lnbclear lnbclear lnbcolor lnbcolorright lnbcurselrow lnbcurselrow lnbdata lnbdeletecolumn lnbdeleterow lnbgetcolumnsposition lnbgetcolumnsposition lnbpicture lnbpictureright lnbsetcolor lnbsetcolorright lnbsetcolumnspos lnbsetcurselrow lnbsetdata lnbsetpicture lnbsetpicturecolor lnbsetpicturecolorright lnbsetpicturecolorselected lnbsetpicturecolorselectedright lnbsetpictureright lnbsettext lnbsettextright lnbsetvalue lnbsize lnbsize lnbsort lnbsortbyvalue lnbtext lnbtextright lnbvalue load loadabs loadbackpack loadfile loaduniform loadvest local local localize locationposition locked lockeddriver lockidentity log lognetwork lognetworkterminate magazinecargo magazines magazinesallturrets magazinesammo magazinesammocargo magazinesammofull magazinesdetail magazinesdetailbackpack magazinesdetailuniform magazinesdetailvest mapanimadd mapcenteroncamera mapgridposition markeralpha markerbrush markercolor markerdir markerpos markershape markersize markertext markertype members menuaction menuadd menuchecked menuclear menuclear menucollapse menudata menudelete menuenable menuenabled menuexpand menuhover menuhover menupicture menusetaction menusetcheck menusetdata menusetpicture menusetvalue menushortcut menushortcuttext menusize menusort menutext menuurl menuvalue mineactive modparams moonphase morale move3dencamera moveout movetime movetocompleted movetofailed name name namesound nearestbuilding nearestbuilding nearestlocation nearestlocations nearestlocationwithdubbing nearestobject nearestobjects nearestterrainobjects needreload netid netid nextmenuitemindex not numberofenginesrtd numbertodate objectcurators objectfromnetid objectparent onbriefinggroup onbriefingnotes onbriefingplan onbriefingteamswitch oncommandmodechanged oneachframe ongroupiconclick ongroupiconoverenter ongroupiconoverleave onhcgroupselectionchanged onmapsingleclick onplayerconnected onplayerdisconnected onpreloadfinished onpreloadstarted onteamswitch opendlcpage openmap openmap opensteamapp openyoutubevideo owner param params parsenumber parsenumber parsesimplearray parsetext pickweaponpool pitch playableslotsnumber playersnumber playmission playmusic playmusic playscriptedmission playsound playsound playsound3d position position positioncameratoworld ppeffectcommitted ppeffectcommitted ppeffectcreate ppeffectdestroy ppeffectdestroy ppeffectenabled precision preloadcamera preloadsound preloadtitleobj preloadtitlersc preprocessfile preprocessfilelinenumbers primaryweapon primaryweaponitems primaryweaponmagazine priority private processdiarylink progressloadingscreen progressposition publicvariable publicvariableserver putweaponpool queryitemspool querymagazinepool queryweaponpool rad radiochannelcreate random random rank rankid rating rectangular registeredtasks reload reloadenabled remoteexec remoteexeccall remove3denconnection remove3deneventhandler remove3denlayer removeall3deneventhandlers removeallactions removeallassigneditems removeallcontainers removeallcuratoraddons removeallcuratorcameraareas removeallcuratoreditingareas removeallhandgunitems removeallitems removeallitemswithmagazines removeallmissioneventhandlers removeallmusiceventhandlers removeallownedmines removeallprimaryweaponitems removeallweapons removebackpack removebackpackglobal removefromremainscollector removegoggles removeheadgear removemissioneventhandler removemusiceventhandler removeswitchableunit removeuniform removevest requiredversion resetsubgroupdirection resources restarteditorcamera reverse roadat roadsconnectedto roledescription ropeattachedobjects ropeattachedto ropeattachenabled ropecreate ropecut ropedestroy ropeendposition ropelength ropes ropeunwind ropeunwound rotorsforcesrtd rotorsrpmrtd round save3deninventory saveoverlay savevar scopename score scoreside screenshot screentoworld scriptdone scriptname scudstate secondaryweapon secondaryweaponitems secondaryweaponmagazine selectbestplaces selectededitorobjects selectionnames selectmax selectmin selectplayer selectrandom selectrandomweighted sendaumessage sendudpmessage servercommand servercommandavailable servercommandexecutable set3denattributes set3dengrid set3deniconsvisible set3denlinesvisible set3denmissionattributes set3denmodelsvisible set3denselected setacctime setaperture setaperturenew setarmorypoints setcamshakedefparams setcamshakeparams setcompassoscillation setcurrentchannel setcustommissiondata setdate setdefaultcamera setdetailmapblendpars setgroupiconsselectable setgroupiconsvisible sethorizonparallaxcoef sethudmovementlevels setinfopanel setlocalwindparams setmouseposition setmusiceventhandler setobjectviewdistance setobjectviewdistance setplayable setplayerrespawntime setshadowdistance setsimulweatherlayers setstaminascheme setstatvalue setsystemofunits setterraingrid settimemultiplier settrafficdensity settrafficdistance settrafficgap settrafficspeed setviewdistance setwind setwinddir showchat showcinemaborder showcommandingmenu showcompass showcuratorcompass showgps showhud showhud showmap showpad showradio showscoretable showsubtitles showuavfeed showwarrant showwatch showwaypoints side side side simpletasks simulationenabled simulclouddensity simulcloudocclusion simulinclouds sin size sizeof skill skiptime sleep sliderposition sliderposition sliderrange sliderrange slidersetposition slidersetrange slidersetspeed sliderspeed sliderspeed soldiermagazines someammo speaker speed speedmode sqrt squadparams stance startloadingscreen stopenginertd stopped str supportinfo surfaceiswater surfacenormal surfacetype switch switchcamera synchronizedobjects synchronizedtriggers synchronizedwaypoints synchronizedwaypoints systemchat tan taskalwaysvisible taskchildren taskcompleted taskcustomdata taskdescription taskdestination taskhint taskmarkeroffset taskparent taskresult taskstate tasktype teammember teamname teamtype terminate terrainintersect terrainintersectasl terrainintersectatasl text text textlog textlogformat tg throw titlecut titlefadeout titleobj titlersc titletext toarray tofixed tolower tostring toupper triggeractivated triggeractivation triggerarea triggerattachedvehicle triggerstatements triggertext triggertimeout triggertimeoutcurrent triggertype try tvadd tvclear tvclear tvcollapse tvcollapseall tvcollapseall tvcount tvcursel tvcursel tvdata tvdelete tvexpand tvexpandall tvexpandall tvpicture tvpictureright tvsetcursel tvsetdata tvsetpicture tvsetpicturecolor tvsetpictureright tvsetpicturerightcolor tvsettext tvsettooltip tvsetvalue tvsort tvsortbyvalue tvtext tvtooltip tvvalue type type typename typeof uavcontrol uisleep unassigncurator unassignteam unassignvehicle underwater uniform uniformcontainer uniformitems uniformmagazines unitaddons unitaimposition unitaimpositionvisual unitbackpack unitisuav unitpos unitready unitrecoilcoefficient units units unlockachievement updateobjecttree useaiopermapobstructiontest useaisteeringcomponent vectordir vectordirvisual vectormagnitude vectormagnitudesqr vectornormalized vectorup vectorupvisual vehicle vehiclecargoenabled vehiclereceiveremotetargets vehiclereportownposition vehiclereportremotetargets vehiclevarname velocity velocitymodelspace verifysignature vest vestcontainer vestitems vestmagazines visibleposition visiblepositionasl waituntil waypointattachedobject waypointattachedvehicle waypointbehaviour waypointcombatmode waypointcompletionradius waypointdescription waypointforcebehaviour waypointformation waypointhouseposition waypointloiterradius waypointloitertype waypointname waypointposition waypoints waypointscript waypointsenableduav waypointshow waypointspeed waypointstatements waypointtimeout waypointtimeoutcurrent waypointtype waypointvisible weaponcargo weaponinertia weaponlowered weapons weaponsitems weaponsitemscargo weaponstate weaponstate weightrtd wfsidetext wfsidetext wfsidetext while wingsforcesrtd with worldtoscreen action actionparams add3denlayer addaction addbackpack addbackpackcargo addbackpackcargoglobal addbackpackglobal addcuratoraddons addcuratorcameraarea addcuratoreditableobjects addcuratoreditingarea addcuratorpoints addeditorobject addeventhandler addforce addgoggles addgroupicon addhandgunitem addheadgear additem additemcargo additemcargoglobal additemtobackpack additemtouniform additemtovest addlivestats addmagazine addmagazine addmagazineammocargo addmagazinecargo addmagazinecargoglobal addmagazineglobal addmagazines addmagazineturret addmenu addmenuitem addmpeventhandler addownedmine addplayerscores addprimaryweaponitem addpublicvariableeventhandler addpublicvariableeventhandler addrating addresources addscore addscoreside addsecondaryweaponitem addteammember addtorque adduniform addvehicle addvest addwaypoint addweapon addweaponcargo addweaponcargoglobal addweaponglobal addweaponitem addweaponturret aimedattarget allow3dmode allowcrewinimmobile allowcuratorlogicignoreareas allowdamage allowdammage allowfileoperations allowfleeing allowgetin allowsprint ammo ammoonpylon and and animate animatebay animatedoor animatepylon animatesource animationphase animationsourcephase append apply arrayintersect assignascargo assignascargoindex assignascommander assignasdriver assignasgunner assignasturret assigncurator assignitem assignteam assigntoairport atan2 attachobject attachto backpackspacefor breakout buildingexit buildingpos buttonsetaction call callextension callextension camcommand camcommit camcommitprepared camconstuctionsetparams camcreate cameraeffect campreload campreparebank campreparedir campreparedive campreparefocus campreparefov campreparefovrange campreparepos campreparerelpos campreparetarget campreparetarget camsetbank camsetdir camsetdive camsetfocus camsetfov camsetfovrange camsetpos camsetrelpos camsettarget camsettarget canadd canadditemtobackpack canadditemtouniform canadditemtovest canslingload canvehiclecargo catch cbsetchecked checkvisibility clear3denattribute closedisplay commandartilleryfire commandchat commandfire commandfollow commandfsm commandmove commandradio commandsuppressivefire commandtarget commandwatch commandwatch configclasses confirmsensortarget connectterminaltouav controlsgroupctrl copywaypoints count countenemy countfriendly countside counttype countunknown create3denentity creatediaryrecord creatediarysubject createdisplay createmenu createmissiondisplay createmissiondisplay creatempcampaigndisplay createsimpletask createsite createtask createunit createunit createvehicle createvehiclelocal ctdata ctfindheaderrows ctfindrowheader ctheadercontrols ctremoveheaders ctremoverows ctrladdeventhandler ctrlchecked ctrlcommit ctrlcreate ctrlenable ctrlmapanimadd ctrlmapcursor ctrlmapscreentoworld ctrlmapworldtoscreen ctrlremovealleventhandlers ctrlremoveeventhandler ctrlsetactivecolor ctrlsetangle ctrlsetautoscrolldelay ctrlsetautoscrollrewind ctrlsetautoscrollspeed ctrlsetbackgroundcolor ctrlsetchecked ctrlsetchecked ctrlsetdisabledcolor ctrlseteventhandler ctrlsetfade ctrlsetfont ctrlsetfonth1 ctrlsetfonth1b ctrlsetfonth2 ctrlsetfonth2b ctrlsetfonth3 ctrlsetfonth3b ctrlsetfonth4 ctrlsetfonth4b ctrlsetfonth5 ctrlsetfonth5b ctrlsetfonth6 ctrlsetfonth6b ctrlsetfontheight ctrlsetfontheighth1 ctrlsetfontheighth2 ctrlsetfontheighth3 ctrlsetfontheighth4 ctrlsetfontheighth5 ctrlsetfontheighth6 ctrlsetfontheightsecondary ctrlsetfontp ctrlsetfontp ctrlsetfontpb ctrlsetfontsecondary ctrlsetforegroundcolor ctrlsetmodel ctrlsetmodeldirandup ctrlsetmodelscale ctrlsetpixelprecision ctrlsetpixelprecision ctrlsetposition ctrlsetscale ctrlsetstructuredtext ctrlsettext ctrlsettextcolor ctrlsettextcolorsecondary ctrlsettextsecondary ctrlsettooltip ctrlsettooltipcolorbox ctrlsettooltipcolorshade ctrlsettooltipcolortext ctrlshow ctrowcontrols ctsetcursel ctsetdata ctsetheadertemplate ctsetrowtemplate ctsetvalue ctvalue curatorcoef currentmagazinedetailturret currentmagazineturret currentweaponturret customchat customradio cutfadeout cutfadeout cutobj cutobj cutrsc cutrsc cuttext cuttext debugfsm deleteat deleteeditorobject deletegroupwhenempty deleterange deleteresources deletevehiclecrew diarysubjectexists directsay disableai disablecollisionwith disableconversation disablenvgequipment disabletiequipment disableuavconnectability displayaddeventhandler displayctrl displayremovealleventhandlers displayremoveeventhandler displayseteventhandler distance distance distance distance distance2d distancesqr distancesqr distancesqr distancesqr do do do do doartilleryfire dofire dofollow dofsm domove doorphase dosuppressivefire dotarget dowatch dowatch drawarrow drawellipse drawicon drawline drawlink drawlocation drawpolygon drawrectangle drawtriangle editobject editorseteventhandler else emptypositions enableai enableaifeature enableaimprecision enableattack enableautostartuprtd enableautotrimrtd enablechannel enablechannel enablecollisionwith enablecopilot enabledynamicsimulation enabledynamicsimulation enablefatigue enablegunlights enableinfopanelcomponent enableirlasers enablemimics enablepersonturret enablereload enableropeattach enablesimulation enablesimulationglobal enablestamina enableuavconnectability enableuavwaypoints enablevehiclecargo enablevehiclesensor enableweapondisassembly engineon evalobjectargument exec execeditorscript execfsm execvm exitwith fademusic faderadio fadesound fadespeech find find findcover findeditorobject findeditorobject findemptyposition findemptypositionready findif findnearestenemy fire fire fireattarget flyinheight flyinheightasl forceadduniform forceflagtexture forcefollowroad forcespeed forcewalk forceweaponfire foreach foreachmember foreachmemberagent foreachmemberteam forgettarget from get3denattribute get3denattribute get3denattribute get3denattribute get3denattribute get3denmissionattribute getartilleryeta getcargoindex getcompatiblepylonmagazines getcompatiblepylonmagazines getdir geteditorobjectscope getenvsoundcontroller getfriend getfsmvariable getgroupicon gethidefrom gethit gethitindex gethitpointdamage getobjectargument getobjectchildren getobjectproxy getpos getreldir getrelpos getsoundcontroller getsoundcontrollerresult getspeed getunittrait getvariable getvariable getvariable getvariable getvariable getvariable getvariable getvariable getvariable getvariable getvariable getvariable getvariable getvariable glanceat globalchat globalradio groupchat groupradio groupselectunit hasweapon hcgroupparams hcremovegroup hcselectgroup hcsetgroup hideobject hideobjectglobal hideselection hintc hintc hintc htmlload in in in inarea inarea inarea inarea inarea inareaarray inareaarray inareaarray inareaarray inflame infopanelcomponentenabled infopanelcomponents inpolygon inrangeofartillery inserteditorobject intersect isequalto isequaltype isequaltypeall isequaltypeany isequaltypearray isequaltypeparams isflashlighton isflatempty isirlaseron iskindof iskindof iskindof issensortargetconfirmed isuavconnectable isuniformallowed isvehiclesensorenabled join joinas joinassilent joinsilent joinstring kbadddatabase kbadddatabasetargets kbaddtopic kbhastopic kbreact kbremovetopic kbtell kbwassaid knowsabout knowsabout land landat lbadd lbcolor lbcolorright lbdata lbdelete lbisselected lbpicture lbpictureright lbsetcolor lbsetcolorright lbsetcursel lbsetdata lbsetpicture lbsetpicturecolor lbsetpicturecolordisabled lbsetpicturecolorselected lbsetpictureright lbsetpicturerightcolor lbsetpicturerightcolordisabled lbsetpicturerightcolorselected lbsetselectcolor lbsetselectcolorright lbsetselected lbsettext lbsettextright lbsettooltip lbsetvalue lbtext lbtextright lbvalue leavevehicle leavevehicle lightattachobject limitspeed linkitem listobjects lnbaddcolumn lnbaddrow lnbcolor lnbcolorright lnbdata lnbdeletecolumn lnbdeleterow lnbpicture lnbpictureright lnbsetcolor lnbsetcolorright lnbsetcolumnspos lnbsetcurselrow lnbsetdata lnbsetpicture lnbsetpicturecolor lnbsetpicturecolorright lnbsetpicturecolorselected lnbsetpicturecolorselectedright lnbsetpictureright lnbsettext lnbsettextright lnbsetvalue lnbsort lnbsortbyvalue lnbtext lnbtextright lnbvalue loadidentity loadmagazine loadoverlay loadstatus lock lock lockcamerato lockcargo lockcargo lockdriver lockedcargo lockedturret lockturret lockwp lookat lookatpos magazinesturret magazineturretammo mapcenteroncamera max menuaction menuadd menuchecked menucollapse menudata menudelete menuenable menuenabled menuexpand menupicture menusetaction menusetcheck menusetdata menusetpicture menusetvalue menushortcut menushortcuttext menusize menusort menutext menuurl menuvalue min minedetectedby mod modeltoworld modeltoworldvisual modeltoworldvisualworld modeltoworldworld move moveinany moveincargo moveincargo moveincommander moveindriver moveingunner moveinturret moveobjecttoend moveto nearentities nearestobject nearestobject nearobjects nearobjectsready nearroads nearsupplies neartargets newoverlay nmenuitems objstatus ondoubleclick onmapsingleclick onshownewobject or or ordergetin param params playaction playactionnow playgesture playmove playmovenow posscreentoworld posworldtoscreen ppeffectadjust ppeffectadjust ppeffectcommit ppeffectcommit ppeffectcommit ppeffectenable ppeffectenable ppeffectenable ppeffectforceinnvg preloadobject progresssetposition publicvariableclient pushback pushbackunique radiochanneladd radiochannelremove radiochannelsetcallsign radiochannelsetlabel random registertask remotecontrol remoteexec remoteexeccall removeaction removealleventhandlers removeallmpeventhandlers removecuratoraddons removecuratorcameraarea removecuratoreditableobjects removecuratoreditingarea removedrawicon removedrawlinks removeeventhandler removegroupicon removehandgunitem removeitem removeitemfrombackpack removeitemfromuniform removeitemfromvest removeitems removemagazine removemagazineglobal removemagazines removemagazinesturret removemagazineturret removemenuitem removemenuitem removempeventhandler removeownedmine removeprimaryweaponitem removesecondaryweaponitem removesimpletask removeteammember removeweapon removeweaponattachmentcargo removeweaponcargo removeweaponglobal removeweaponturret reportremotetarget resize respawnvehicle reveal reveal revealmine ropeattachto ropedetach saveidentity savestatus say say say2d say2d say3d say3d select select select select select select selectdiarysubject selecteditorobject selectionposition selectleader selectrandomweighted selectweapon selectweaponturret sendsimplecommand sendtask sendtaskresult servercommand set set3denattribute set3denlayer set3denlogictype set3denmissionattribute set3denobjecttype setactualcollectivertd setairplanethrottle setairportside setammo setammocargo setammoonpylon setanimspeedcoef setattributes setautonomous setbehaviour setbleedingremaining setbrakesrtd setcamerainterest setcamuseti setcaptive setcenterofmass setcollisionlight setcombatmode setcombatmode setconvoyseparation setcuratorcameraareaceiling setcuratorcoef setcuratoreditingareatype setcuratorwaypointcost setcurrenttask setcurrentwaypoint setcustomaimcoef setcustomweightrtd setdamage setdammage setdebriefingtext setdestination setdir setdirection setdrawicon setdriveonpath setdropinterval setdynamicsimulationdistance setdynamicsimulationdistancecoef seteditormode seteditorobjectscope seteffectcondition setenginerpmrtd setface setfaceanimation setfatigue setfeaturetype setflaganimationphase setflagowner setflagside setflagtexture setfog setforcegeneratorrtd setformation setformation setformationtask setformdir setfriend setfromeditor setfsmvariable setfuel setfuelcargo setgroupicon setgroupiconparams setgroupid setgroupidglobal setgroupowner setgusts sethidebehind sethit sethitindex sethitpointdamage setidentity setimportance setleader setlightambient setlightattenuation setlightbrightness setlightcolor setlightdaylight setlightflaremaxdistance setlightflaresize setlightintensity setlightnings setlightuseflare setmagazineturretammo setmarkeralpha setmarkeralphalocal setmarkerbrush setmarkerbrushlocal setmarkercolor setmarkercolorlocal setmarkerdir setmarkerdirlocal setmarkerpos setmarkerposlocal setmarkershape setmarkershapelocal setmarkersize setmarkersizelocal setmarkertext setmarkertextlocal setmarkertype setmarkertypelocal setmass setmimic setmusiceffect setname setname setname setnamesound setobjectarguments setobjectmaterial setobjectmaterialglobal setobjectproxy setobjecttexture setobjecttextureglobal setovercast setowner setoxygenremaining setparticlecircle setparticleclass setparticlefire setparticleparams setparticlerandom setpilotcameradirection setpilotcamerarotation setpilotcameratarget setpilotlight setpipeffect setpitch setplatenumber setpos setposasl setposasl2 setposaslw setposatl setposition setposworld setpylonloadout setpylonspriority setradiomsg setrain setrainbow setrandomlip setrank setrectangular setrepaircargo setrotorbrakertd setshotparents setside setsimpletaskalwaysvisible setsimpletaskcustomdata setsimpletaskdescription setsimpletaskdestination setsimpletasktarget setsimpletasktype setsize setskill setskill setslingload setsoundeffect setspeaker setspeech setspeedmode setstamina setsuppression settargetage settaskmarkeroffset settaskresult settaskstate settext settitleeffect settriggeractivation settriggerarea settriggerstatements settriggertext settriggertimeout settriggertype settype setunconscious setunitability setunitloadout setunitloadout setunitloadout setunitpos setunitposweak setunitrank setunitrecoilcoefficient setunittrait setunloadincombat setuseractiontext setusermfdtext setusermfdvalue setvariable setvariable setvariable setvariable setvariable setvariable setvariable setvariable setvectordir setvectordirandup setvectorup setvehicleammo setvehicleammodef setvehiclearmor setvehiclecargo setvehicleid setvehiclelock setvehicleposition setvehicleradar setvehiclereceiveremotetargets setvehiclereportownposition setvehiclereportremotetargets setvehicletipars setvehiclevarname setvelocity setvelocitymodelspace setvelocitytransformation setvisibleiftreecollapsed setwantedrpmrtd setwaves setwaypointbehaviour setwaypointcombatmode setwaypointcompletionradius setwaypointdescription setwaypointforcebehaviour setwaypointformation setwaypointhouseposition setwaypointloiterradius setwaypointloitertype setwaypointname setwaypointposition setwaypointscript setwaypointspeed setwaypointstatements setwaypointtimeout setwaypointtype setwaypointvisible setweaponreloadingtime setwinddir setwindforce setwindstr setwingforcescalertd setwppos show3dicons showlegend showneweditorobject showwaypoint sidechat sideradio skill skillfinal slidersetposition slidersetrange slidersetspeed sort spawn splitstring step stop suppressfor swimindepth switchaction switchcamera switchgesture switchlight switchmove synchronizeobjectsadd synchronizeobjectsremove synchronizetrigger synchronizewaypoint synchronizewaypoint targetknowledge targets targetsaggregate targetsquery then then throw to tofixed triggerattachobject triggerattachvehicle triggerdynamicsimulation try turretlocal turretowner turretunit tvadd tvcollapse tvcount tvdata tvdelete tvexpand tvpicture tvpictureright tvsetcolor tvsetcursel tvsetdata tvsetpicture tvsetpicturecolor tvsetpicturecolordisabled tvsetpicturecolorselected tvsetpictureright tvsetpicturerightcolor tvsetpicturerightcolordisabled tvsetpicturerightcolorselected tvsetselectcolor tvsettext tvsettooltip tvsetvalue tvsort tvsortbyvalue tvtext tvtooltip tvvalue unassignitem unitsbelowheight unitsbelowheight unlinkitem unregistertask updatedrawicon updatemenuitem useaudiotimeformoves vectoradd vectorcos vectorcrossproduct vectordiff vectordistance vectordistancesqr vectordotproduct vectorfromto vectormodeltoworld vectormodeltoworldvisual vectormultiply vectorworldtomodel vectorworldtomodelvisual vehiclechat vehicleradio waypointattachobject waypointattachvehicle weaponaccessories weaponaccessoriescargo weapondirection weaponsturret worldtomodel worldtomodelvisual acctime activatedaddons agents airdensitycurvertd all3denentities allairports allcurators allcutlayers alldead alldeadmen alldisplays allgroups allmapmarkers allmines allplayers allsites allunits allunitsuav armorypoints benchmark blufor briefingname buldozer_isenabledroaddiag buldozer_reloadopermap cadetmode cameraon cameraview campaignconfigfile cansuspend cheatsenabled civilian clearforcesrtd clearitempool clearmagazinepool clearradio clearweaponpool clientowner commandingmenu configfile confignull controlnull copyfromclipboard curatorcamera curatormouseover curatorselected current3denoperation currentchannel currentnamespace cursorobject cursortarget date daytime diag_activemissionfsms diag_activescripts diag_activesqfscripts diag_activesqsscripts diag_fps diag_fpsmin diag_frameno diag_ticktime dialog didjip difficulty difficultyenabledrtd disabledebriefingstats disableserialization displaynull distributionregion dynamicsimulationsystemenabled east enableenddialog endl endloadingscreen environmentenabled estimatedendservertime exit false finishmissioninit fog fogforecast fogparams forcedmap forceend forceweatherchange freelook get3dencamera get3deniconsvisible get3denlinesvisible get3denmouseover getartillerycomputersettings getclientstate getclientstatenumber getcursorobjectparams getdlcassetsusage getelevationoffset getmissiondlcs getmissionlayers getmouseposition getmusicplayedtime getobjectviewdistance getremotesensorsdisabled getresolution getshadowdistance getterraingrid gettotaldlcusagetime groupiconselectable groupiconsvisible grpnull gusts halt hasinterface hcshownbar hudmovementlevels humidity independent initambientlife is3den is3denmultiplayer isautotest isdedicated isfilepatchingenabled isinstructorfigureenabled ismultiplayer ismultiplayersolo ispipenabled isremoteexecuted isremoteexecutedjip isserver issteammission isstreamfriendlyuienabled isstressdamageenabled istuthintsenabled isuicontext language librarycredits librarydisclaimers lightnings linebreak loadgame locationnull logentities mapanimclear mapanimcommit mapanimdone markasfinishedonsteam missionconfigfile missiondifficulty missionname missionnamespace missionstart missionversion moonintensity musicvolume netobjnull nextweatherchange nil objnull opencuratorinterface opfor overcast overcastforecast parsingnamespace particlesquality pi pixelgrid pixelgridbase pixelgridnouiscale pixelh pixelw playableunits player playerrespawntime playerside productversion profilename profilenamespace profilenamesteam radiovolume rain rainbow remoteexecutedowner resetcamshake resistance reversedmousey runinitscript safezoneh safezonew safezonewabs safezonex safezonexabs safezoney savegame savejoysticks saveprofilenamespace savingenabled scriptnull selectnoplayer servername servertime shownartillerycomputer shownchat showncompass showncuratorcompass showngps shownhud shownmap shownpad shownradio shownscoretable shownuavfeed shownwarrant shownwatch sideambientlife sideempty sideenemy sidefriendly sidelogic sideunknown simulweathersync slingloadassistantshown soundvolume sunormoon switchableunits systemofunits tasknull teammembernull teams teamswitch teamswitchenabled time timemultiplier true uinamespace userinputdisabled vehicles viewdistance visiblecompass visiblegps visiblemap visiblescoretable visiblewatch waves west wind winddir windrtd windstr worldname worldsize
11
+ )
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*- #
2
+ # frozen_string_literal: true
2
3
 
3
4
  module Rouge
4
5
  module Lexers
@@ -50,7 +51,7 @@ module Rouge
50
51
  LOCALTIME LOCALTIMESTAMP LOCATION LOCATOR LOCK LOWER MAP MATCH
51
52
  MAX MAXVALUE MESSAGE_LENGTH MESSAGE_OCTET_LENGTH MESSAGE_TEXT
52
53
  METHOD MIN MINUTE MINVALUE MOD MODE MODIFIES MODIFY MONTH
53
- MORE MOVE MUMPS NAMES NATIONAL NATURAL NCHAR NCLOB NEW NEXT
54
+ MORE MOVE MUMPS NAMES NATURAL NCLOB NEW NEXT
54
55
  NO NOCREATEDB NOCREATEUSER NONE NOT NOTHING NOTIFY NOTNULL
55
56
  NULL NULLABLE NULLIF OBJECT OCTET_LENGTH OF OFF OFFSET OIDS
56
57
  OLD ON ONLY OPEN OPERATION OPERATOR OPTION OPTIONS OR ORDER
@@ -58,7 +59,7 @@ module Rouge
58
59
  OWNER PAD PARAMETER PARAMETERS PARAMETER_MODE PARAMATER_NAME
59
60
  PARAMATER_ORDINAL_POSITION PARAMETER_SPECIFIC_CATALOG
60
61
  PARAMETER_SPECIFIC_NAME PARAMATER_SPECIFIC_SCHEMA PARTIAL PASCAL
61
- PENDANT PLACING PLI POSITION POSTFIX PRECISION PREFIX PREORDER
62
+ PENDANT PLACING PLI POSITION POSTFIX PREFIX PREORDER
62
63
  PREPARE PRESERVE PRIMARY PRIOR PRIVILEGES PROCEDURAL PROCEDURE
63
64
  PUBLIC READ READS RECHECK RECURSIVE REF REFERENCES REFERENCING
64
65
  REINDEX RELATIVE RENAME REPEATABLE REPLACE RESET RESTART
@@ -74,7 +75,7 @@ module Rouge
74
75
  STDIN STDOUT STORAGE STRICT STRUCTURE STYPE SUBCLASS_ORIGIN
75
76
  SUBLIST SUBSTRING SUM SYMMETRIC SYSID SYSTEM SYSTEM_USER
76
77
  TABLE TABLE_NAME TEMP TEMPLATE TEMPORARY TERMINATE THAN THEN
77
- TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TO TOAST TRAILING
78
+ TIMEZONE_HOUR TIMEZONE_MINUTE TO TOAST TRAILING
78
79
  TRANSATION TRANSACTIONS_COMMITTED TRANSACTIONS_ROLLED_BACK
79
80
  TRANSATION_ACTIVE TRANSFORM TRANSFORMS TRANSLATE TRANSLATION
80
81
  TREAT TRIGGER TRIGGER_CATALOG TRIGGER_NAME TRIGGER_SCHEMA TRIM
@@ -83,29 +84,49 @@ module Rouge
83
84
  USAGE USER USER_DEFINED_TYPE_CATALOG USER_DEFINED_TYPE_NAME
84
85
  USER_DEFINED_TYPE_SCHEMA USING VACUUM VALID VALIDATOR VALUES
85
86
  VARIABLE VERBOSE VERSION VIEW VOLATILE WHEN WHENEVER WHERE
86
- WITH WITHOUT WORK WRITE YEAR ZONE
87
+ WITH WITHOUT WORK WRITE ZONE
87
88
  )
88
89
  end
89
90
 
91
+ def self.keywords_type
92
+ # sources:
93
+ # https://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
94
+ # https://dev.mysql.com/doc/refman/5.7/en/date-and-time-type-overview.html
95
+ # https://dev.mysql.com/doc/refman/5.7/en/string-type-overview.html
96
+ @keywords_type ||= Set.new(%w(
97
+ ZEROFILL UNSIGNED SIGNED SERIAL BIT TINYINT BOOL BOOLEAN SMALLINT
98
+ MEDIUMINT INT INTEGER BIGINT DECIMAL DEC NUMERIC FIXED FLOAT DOUBLE
99
+ PRECISION REAL
100
+ DATE DATETIME TIMESTAMP TIME YEAR
101
+ NATIONAL CHAR CHARACTER NCHAR BYTE
102
+ VARCHAR VARYING BINARY VARBINARY TINYBLOB TINYTEXT BLOB TEXT
103
+ MEDIUMBLOB MEDIUMTEXT LONGBLOB LONGTEXT ENUM
104
+ ))
105
+ end
106
+
90
107
  state :root do
91
- rule /\s+/m, Text
92
- rule /--.*/, Comment::Single
108
+ rule %r/\s+/m, Text
109
+ rule %r/--.*/, Comment::Single
93
110
  rule %r(/\*), Comment::Multiline, :multiline_comments
94
- rule /\d+/, Num::Integer
95
- rule /'/, Str::Single, :single_string
96
- rule /"/, Name::Variable, :double_string
97
- rule /`/, Name::Variable, :backtick
111
+ rule %r/\d+/, Num::Integer
112
+ rule %r/'/, Str::Single, :single_string
113
+ # A double-quoted string refers to a database object in our default SQL
114
+ # dialect, which is apropriate for e.g. MS SQL and PostgreSQL.
115
+ rule %r/"/, Name::Variable, :double_string
116
+ rule %r/`/, Name::Variable, :backtick
98
117
 
99
- rule /\w[\w\d]*/ do |m|
100
- if self.class.keywords.include? m[0].upcase
118
+ rule %r/\w[\w\d]*/ do |m|
119
+ if self.class.keywords_type.include? m[0].upcase
120
+ token Name::Builtin
121
+ elsif self.class.keywords.include? m[0].upcase
101
122
  token Keyword
102
123
  else
103
124
  token Name
104
125
  end
105
126
  end
106
127
 
107
- rule %r([+*/<>=~!@#%^&|?^-]), Operator
108
- rule /[;:()\[\],.]/, Punctuation
128
+ rule %r([+*/<>=~!@#%&|?^-]), Operator
129
+ rule %r/[;:()\[\],.]/, Punctuation
109
130
  end
110
131
 
111
132
  state :multiline_comments do
@@ -116,24 +137,24 @@ module Rouge
116
137
  end
117
138
 
118
139
  state :backtick do
119
- rule /\\./, Str::Escape
120
- rule /``/, Str::Escape
121
- rule /`/, Name::Variable, :pop!
122
- rule /[^\\`]+/, Name::Variable
140
+ rule %r/\\./, Str::Escape
141
+ rule %r/``/, Str::Escape
142
+ rule %r/`/, Name::Variable, :pop!
143
+ rule %r/[^\\`]+/, Name::Variable
123
144
  end
124
145
 
125
146
  state :single_string do
126
- rule /\\./, Str::Escape
127
- rule /''/, Str::Escape
128
- rule /'/, Str::Single, :pop!
129
- rule /[^\\']+/, Str::Single
147
+ rule %r/\\./, Str::Escape
148
+ rule %r/''/, Str::Escape
149
+ rule %r/'/, Str::Single, :pop!
150
+ rule %r/[^\\']+/, Str::Single
130
151
  end
131
152
 
132
153
  state :double_string do
133
- rule /\\./, Str::Escape
134
- rule /""/, Str::Escape
135
- rule /"/, Name::Variable, :pop!
136
- rule /[^\\"]+/, Name::Variable
154
+ rule %r/\\./, Str::Escape
155
+ rule %r/""/, Str::Escape
156
+ rule %r/"/, Name::Variable, :pop!
157
+ rule %r/[^\\"]+/, Name::Variable
137
158
  end
138
159
  end
139
160
  end