package tm-grammars

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file tm_grammar_sas.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
let lang_id = "sas"
let json = {json|{
  "displayName": "SAS",
  "fileTypes": [
    "sas"
  ],
  "foldingStartMarker": "(?i:(proc|data|%macro).*;$)",
  "foldingStopMarker": "(?i:(run|quit|%mend)\\s?);",
  "name": "sas",
  "patterns": [
    {
      "include": "#starComment"
    },
    {
      "include": "#blockComment"
    },
    {
      "include": "#macro"
    },
    {
      "include": "#constant"
    },
    {
      "include": "#quote"
    },
    {
      "include": "#operator"
    },
    {
      "begin": "\\b(?i:(data))\\s+",
      "beginCaptures": {
        "1": {
          "name": "keyword.other.sas"
        }
      },
      "end": "(;)",
      "patterns": [
        {
          "include": "#blockComment"
        },
        {
          "include": "#dataSet"
        },
        {
          "captures": {
            "1": {
              "name": "keyword.other.sas"
            },
            "2": {
              "name": "keyword.other.sas"
            }
          },
          "match": "(?i:(stack|pgm|view|source)\\s?=\\s?|(debug|nesting|nolist))"
        }
      ]
    },
    {
      "begin": "\\b(?i:(set|update|modify|merge))\\s+",
      "beginCaptures": {
        "1": {
          "name": "support.function.sas"
        },
        "2": {
          "name": "entity.name.class.sas"
        },
        "3": {
          "name": "entity.name.class.sas"
        }
      },
      "end": "(;)",
      "patterns": [
        {
          "include": "#blockComment"
        },
        {
          "include": "#dataSet"
        }
      ]
    },
    {
      "match": "(?i:\\b(if|while|until|for|do|end|then|else|run|quit|cancel|options)\\b)",
      "name": "keyword.control.sas"
    },
    {
      "captures": {
        "1": {
          "name": "support.class.sas"
        },
        "3": {
          "name": "entity.name.function.sas"
        }
      },
      "match": "(?i:(%(bquote|do|else|end|eval|global|goto|if|inc|include|index|input|length|let|list|local|lowcase|macro|mend|nrbquote|nrquote|nrstr|put|qscan|qsysfunc|quote|run|scan|str|substr|syscall|sysevalf|sysexec|sysfunc|sysrc|then|to|unquote|upcase|until|while|window))\\b)\\s*(\\w*)",
      "name": "keyword.other.sas"
    },
    {
      "begin": "(?i:\\b(proc\\s*(sql))\\b)",
      "beginCaptures": {
        "1": {
          "name": "support.function.sas"
        },
        "2": {
          "name": "support.class.sas"
        }
      },
      "end": "(?i:\\b(quit)\\s*;)",
      "endCaptures": {
        "1": {
          "name": "keyword.control.sas"
        }
      },
      "name": "meta.sql.sas",
      "patterns": [
        {
          "include": "#starComment"
        },
        {
          "include": "#blockComment"
        },
        {
          "include": "source.sql"
        }
      ]
    },
    {
      "match": "(?i:\\b(by|label|format)\\b)",
      "name": "keyword.datastep.sas"
    },
    {
      "captures": {
        "1": {
          "name": "support.function.sas"
        },
        "2": {
          "name": "support.class.sas"
        }
      },
      "match": "(?i:\\b(proc (\\w+))\\b)",
      "name": "meta.function-call.sas"
    },
    {
      "match": "(?i:\\b(_(?:n_|error_))\\b)",
      "name": "variable.language.sas"
    },
    {
      "captures": {
        "1": {
          "name": "support.class.sas"
        }
      },
      "match": "\\b(?i:(_all_|_character_|_cmd_|_freq_|_i_|_infile_|_last_|_msg_|_null_|_numeric_|_temporary_|_type_|abort|abs|addr|adjrsq|airy|alpha|alter|altlog|altprint|and|arcos|array|arsin|as|atan|attrc|attrib|attrn|authserver|autoexec|awscontrol|awsdef|awsmenu|awsmenumerge|awstitle|backward|band|base|betainv|between|blocksize|blshift|bnot|bor|brshift|bufno|bufsize|bxor|by|byerr|byline|byte|calculated|call|cards4??|case|catcache|cbufno|cdf|ceil|center|cexist|change|chisq|cinv|class|cleanup|close|cnonct|cntllev|coalesce|codegen|col|collate|collin|column|comamid|comaux1|comaux2|comdef|compbl|compound|compress|config|continue|convert|cosh??|cpuid|create|cross|crosstab|css|curobs|cv|daccdb|daccdbsl|daccsl|daccsyd|dacctab|dairy|datalines4??|date|datejul|datepart|datetime|day|dbcslang|dbcstype|dclose|ddm|delete|delimiter|depdb|depdbsl|depsl|depsyd|deptab|dequote|descending|descript|design=|device|dflang|dhms|dif|digamma|dim|dinfo|display|distinct|dkricond|dkrocond|dlm|dnum|do|dopen|doptname|doptnum|dread|drop|dropnote|dsname|dsnferr|echo|else|emaildlg|emailid|emailpw|emailserver|emailsys|encrypt|end|endsas|engine|eof|eov|erfc??|error|errorcheck|errors|exist|exp|fappend|fclose|fcol|fdelete|feedback|fetch|fetchobs|fexist|fget|file|fileclose|fileexist|filefmt|filename|fileref|filevar|finfo|finv|fipnamel??|fipstate|first|firstobs|floor|fmterr|fmtsearch|fnonct|fnote|font|fontalias|footnote[1-9]?|fopen|foptname|foptnum|force|formatted|formchar|formdelim|formdlim|forward|fpoint|fpos|fput|fread|frewind|frlen|from|fsep|full|fullstimer|fuzz|fwrite|gaminv|gamma|getoption|getvarc|getvarn|go|goto|group|gwindow|hbar|hbound|helpenv|helploc|hms|honorappearance|hosthelp|hostprint|hour|hpct|html|hvar|ibessel|ibr|id|if|indexc??|indexw|infile|informat|initcmd|initstmt|inner|inputc??|inputn|inr|insert|int|intck|intnx|into|intrr|invaliddata|irr|is|jbessel|join|juldate|keep|kentb|kurtosis|label|lag|last|lbound|leave|left|length|levels|lgamma|lib|libname|library|libref|line|linesize|link|list|log|log10|log2|logpdf|logpmf|logsdf|lostcard|lowcase|lrecl|ls|macro|macrogen|maps|mautosource|max|maxdec|maxr|mdy|mean|measures|median|memtype|merge|merror|min|minute|missing|missover|mlogic|mode??|model|modify|month|mopen|mort|mprint|mrecall|msglevel|msymtabmax|mvarsize|myy|n|nest|netpv|news??|nmiss|no|nobatch|nobs|nocaps|nocardimage|nocenter|nocharcode|nocmdmac|nocol|nocum|nodate|nodbcs|nodetails|nodmr|nodms|nodmsbatch|nodup|nodupkey|noduplicates|noechoauto|noequals|noerrorabend|noexitwindows|nofullstimer|noicon|noimplmac|noint|nolist|noloadlist|nomiss|nomlogic|nomprint|nomrecall|nomsgcase|nomstored|nomultenvappl|nonotes|nonumber|noobs|noovp|nopad|nopercent|noprint|noprintinit|normal|norow|norsasuser|nosetinit|nosource2??|nosplash|nosymbolgen|notes??|notitles??|notsorted|noverbose|noxsync|noxwait|npv|null|number|numkeys|nummousekeys|nway|obs|ods|on|open|option|order|ordinal|otherwise|out|outer|outp=|output|over|ovp|p([15]|10|25|50|75|90|95|99)|pad2??|page|pageno|pagesize|paired|parm|parmcards|path|pathdll|pathname|pdf|peekc??|pfkey|pmf|point|poisson|poke|position|printer|probbeta|probbnml|probchi|probf|probgam|probhypr|probit|probnegb|probnorm|probsig|probt|procleave|project|prt|propcase|prxmatch|prxparse|prxchange|prxposn|ps|putc??|putn|pw|pwreq|qtr|quote|r|ranbin|rancau|ranexp|rangam|range|ranks|rannor|ranpoi|rantbl|rantri|ranuni|read|recfm|register|regr|remote|remove|rename|repeat|replace|resolve|retain|return|reuse|reverse|rewind|right|round|rsquare|rtf|rtrace|rtraceloc|s2??|samploc|sasautos|sascontrol|sasfrscr|sashelp|sasmsg|sasmstore|sasscript|sasuser|saving|scan|sdf|second|select|selection|separated|seq|serror|set|setcomm|setot|sign|simple|sinh??|siteinfo|skewness|skip|sle|sls|sortedby|sortpgm|sortseq|sortsize|soundex|source2|spedis|splashlocation|split|spool|sqrt|start|std|stderr|stdin|stfips|stimer|stnamel??|stop|stopover|strip|subgroup|subpopn|substr|sum|sumwgt|symbol|symbolgen|symget|symput|sysget|sysin|sysleave|sysmsg|sysparm|sysprint|sysprintfont|sysprod|sysrc|system|t|tables??|tanh??|tapeclose|tbufsize|terminal|test|then|time|timepart|tinv|title[1-9]?|tnonct|to|today|tol|tooldef|totper|transformout|translate|trantab|tranwrd|trigamma|trimn??|trunc|truncover|type|unformatted|uniform|union|until|upcase|update|user|usericon|uss|validate|value|var|varfmt|varinfmt|varlabel|varlen|varname|varnum|varrayx??|vartype|verify|vformatd??|vformatdx|vformatnx??|vformatwx??|vformatx|vinarrayx??|vinformatd??|vinformatdx|vinformatnx??|vinformatwx??|vinformatx|vlabelx??|vlengthx??|vnamex??|vnferr|vtypex??|weekday|weight|when|where|while|wincharset|window|work|workinit|workterm|write|wsumx??|x|xsync|xwait|year|yearcutoff|yes|yyq|zipfips|zipnamel??|zipstate))\\b",
      "name": "support.function.sas"
    }
  ],
  "repository": {
    "blockComment": {
      "patterns": [
        {
          "begin": "/\\*",
          "end": "\\*/",
          "name": "comment.block.slashstar.sas"
        }
      ]
    },
    "constant": {
      "patterns": [
        {
          "match": "(?<![\\&}])\\b[0-9]*\\.?[0-9]+([DEde][-+]?[0-9]+)?\\b",
          "name": "constant.numeric.sas"
        },
        {
          "match": "(')([^']+)(')(dt|[dt])",
          "name": "constant.numeric.quote.single.sas"
        },
        {
          "match": "(\")([^\"]+)(\")(dt|[dt])",
          "name": "constant.numeric.quote.double.sas"
        }
      ]
    },
    "dataSet": {
      "patterns": [
        {
          "begin": "((\\w+)\\.)?(\\w+)\\s?\\(",
          "beginCaptures": {
            "2": {
              "name": "entity.name.class.libref.sas"
            },
            "3": {
              "name": "entity.name.class.dsname.sas"
            }
          },
          "end": "\\)",
          "patterns": [
            {
              "include": "#dataSetOptions"
            },
            {
              "include": "#blockComment"
            },
            {
              "include": "#macro"
            },
            {
              "include": "#constant"
            },
            {
              "include": "#quote"
            },
            {
              "include": "#operator"
            }
          ]
        },
        {
          "captures": {
            "2": {
              "name": "entity.name.class.libref.sas"
            },
            "3": {
              "name": "entity.name.class.dsname.sas"
            }
          },
          "match": "\\b((\\w+)\\.)?(\\w+)\\b"
        }
      ]
    },
    "dataSetOptions": {
      "patterns": [
        {
          "match": "(?<=[()\\s])(?i:ALTER|BUFNO|BUFSIZE|CNTLLEV|COMPRESS|DLDMGACTION|ENCRYPT|ENCRYPTKEY|EXTENDOBSCOUNTER|GENMAX|GENNUM|INDEX|LABEL|OBSBUF|OUTREP|PW|PWREQ|READ|REPEMPTY|REPLACE|REUSE|ROLE|SORTEDBY|SPILL|TOBSNO|TYPE|WRITE|FILECLOSE|FIRSTOBS|IN|OBS|POINTOBS|WHERE|WHEREUP|IDXNAME|IDXWHERE|DROP|KEEP|RENAME)\\s?=",
          "name": "keyword.other.sas"
        }
      ]
    },
    "macro": {
      "patterns": [
        {
          "match": "(&+(?i:[_a-z]([0-9_a-z]+)?)(\\.+)?)\\b",
          "name": "variable.other.macro.sas"
        }
      ]
    },
    "operator": {
      "patterns": [
        {
          "match": "([-*+/^])",
          "name": "keyword.operator.arithmetic.sas"
        },
        {
          "match": "\\b(?i:(eq|ne|gt|lt|ge|le|in|not|&|and|or|min|max))\\b",
          "name": "keyword.operator.comparison.sas"
        },
        {
          "match": "([<>^~¬]?=(:)?|[!<>|¦¬]|^|~|<>|><|\\|\\|)",
          "name": "keyword.operator.sas"
        }
      ]
    },
    "quote": {
      "patterns": [
        {
          "begin": "(?<!%)(')",
          "end": "(')([bx])?",
          "name": "string.quoted.single.sas"
        },
        {
          "begin": "(\")",
          "end": "(\")([bx])?",
          "name": "string.quoted.double.sas"
        }
      ]
    },
    "starComment": {
      "patterns": [
        {
          "include": "#blockcomment"
        },
        {
          "begin": "(?<=;)[%\\s]*\\*",
          "end": ";",
          "name": "comment.line.inline.star.sas"
        },
        {
          "begin": "^[%\\s]*\\*",
          "end": ";",
          "name": "comment.line.start.sas"
        }
      ]
    }
  },
  "scopeName": "source.sas"
}|json}