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