| 1 |
{ |
| 2 |
"comment": "A work in progress--improves over the existing in that it populates symbols, and handles comments more gracefully.", |
| 3 |
"fileTypes": ["sas"], |
| 4 |
"foldingStartMarker": "(?i:(proc|data|%macro).*;$)", |
| 5 |
"foldingStopMarker": "(?i:(run|quit|%mend)\\s?);", |
| 6 |
"name": "sas", |
| 7 |
"patterns": [ |
| 8 |
{ |
| 9 |
"include": "#starComment" |
| 10 |
}, |
| 11 |
{ |
| 12 |
"include": "#blockComment" |
| 13 |
}, |
| 14 |
{ |
| 15 |
"include": "#macro" |
| 16 |
}, |
| 17 |
{ |
| 18 |
"include": "#constant" |
| 19 |
}, |
| 20 |
{ |
| 21 |
"include": "#quote" |
| 22 |
}, |
| 23 |
{ |
| 24 |
"include": "#operator" |
| 25 |
}, |
| 26 |
{ |
| 27 |
"begin": "\\b(?i:(data))\\s+", |
| 28 |
"beginCaptures": { |
| 29 |
"1": { |
| 30 |
"name": "keyword.other.sas" |
| 31 |
} |
| 32 |
}, |
| 33 |
"comment": "Begins a DATA step and provides names for any output SAS data sets, views, or programs.", |
| 34 |
"end": "(;)", |
| 35 |
"patterns": [ |
| 36 |
{ |
| 37 |
"include": "#blockComment" |
| 38 |
}, |
| 39 |
{ |
| 40 |
"include": "#dataSet" |
| 41 |
}, |
| 42 |
{ |
| 43 |
"captures": { |
| 44 |
"1": { |
| 45 |
"name": "keyword.other.sas" |
| 46 |
}, |
| 47 |
"2": { |
| 48 |
"name": "keyword.other.sas" |
| 49 |
} |
| 50 |
}, |
| 51 |
"match": "(?i:(?:(stack|pgm|view|source)\\s?=\\s?)|(debug|nesting|nolist))" |
| 52 |
} |
| 53 |
] |
| 54 |
}, |
| 55 |
{ |
| 56 |
"begin": "\\b(?i:(set|update|modify|merge))\\s+", |
| 57 |
"beginCaptures": { |
| 58 |
"1": { |
| 59 |
"name": "support.function.sas" |
| 60 |
}, |
| 61 |
"2": { |
| 62 |
"name": "entity.name.class.sas" |
| 63 |
}, |
| 64 |
"3": { |
| 65 |
"name": "entity.name.class.sas" |
| 66 |
} |
| 67 |
}, |
| 68 |
"comment": "DATA set File-Handling Statements for DATA step", |
| 69 |
"end": "(;)", |
| 70 |
"patterns": [ |
| 71 |
{ |
| 72 |
"include": "#blockComment" |
| 73 |
}, |
| 74 |
{ |
| 75 |
"include": "#dataSet" |
| 76 |
} |
| 77 |
] |
| 78 |
}, |
| 79 |
{ |
| 80 |
"match": "(?i:\\b(if|while|until|for|do|end|then|else|run|quit|cancel|options)\\b)", |
| 81 |
"name": "keyword.control.sas" |
| 82 |
}, |
| 83 |
{ |
| 84 |
"captures": { |
| 85 |
"1": { |
| 86 |
"name": "support.class.sas" |
| 87 |
}, |
| 88 |
"3": { |
| 89 |
"name": "entity.name.function.sas" |
| 90 |
} |
| 91 |
}, |
| 92 |
"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*)", |
| 93 |
"name": "keyword.other.sas" |
| 94 |
}, |
| 95 |
{ |
| 96 |
"begin": "(?i:\\b(proc\\s*(sql))\\b)", |
| 97 |
"beginCaptures": { |
| 98 |
"1": { |
| 99 |
"name": "support.function.sas" |
| 100 |
}, |
| 101 |
"2": { |
| 102 |
"name": "support.class.sas" |
| 103 |
} |
| 104 |
}, |
| 105 |
"comment": "Looks like for this to work there must be a *name* as well as the patterns/include bit.", |
| 106 |
"end": "(?i:\\b(quit)\\s*;)", |
| 107 |
"endCaptures": { |
| 108 |
"1": { |
| 109 |
"name": "keyword.control.sas" |
| 110 |
} |
| 111 |
}, |
| 112 |
"name": "meta.sql.sas", |
| 113 |
"patterns": [ |
| 114 |
{ |
| 115 |
"include": "#starComment" |
| 116 |
}, |
| 117 |
{ |
| 118 |
"include": "#blockComment" |
| 119 |
}, |
| 120 |
{ |
| 121 |
"include": "source.sql" |
| 122 |
} |
| 123 |
] |
| 124 |
}, |
| 125 |
{ |
| 126 |
"match": "(?i:\\b(by|label|format)\\b)", |
| 127 |
"name": "keyword.datastep.sas" |
| 128 |
}, |
| 129 |
{ |
| 130 |
"captures": { |
| 131 |
"1": { |
| 132 |
"name": "support.function.sas" |
| 133 |
}, |
| 134 |
"2": { |
| 135 |
"name": "support.class.sas" |
| 136 |
} |
| 137 |
}, |
| 138 |
"match": "(?i:\\b(proc (\\w+))\\b)", |
| 139 |
"name": "meta.function-call.sas" |
| 140 |
}, |
| 141 |
{ |
| 142 |
"match": "(?i:\\b(_n_|_error_)\\b)", |
| 143 |
"name": "variable.language.sas" |
| 144 |
}, |
| 145 |
{ |
| 146 |
"captures": { |
| 147 |
"1": { |
| 148 |
"name": "support.class.sas" |
| 149 |
} |
| 150 |
}, |
| 151 |
"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|cards|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|cos|cosh|cpuid|create|cross|crosstab|css|curobs|cv|daccdb|daccdbsl|daccsl|daccsyd|dacctab|dairy|datalines|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|erf|erfc|error|errorcheck|errors|exist|exp|fappend|fclose|fcol|fdelete|feedback|fetch|fetchobs|fexist|fget|file|fileclose|fileexist|filefmt|filename|fileref|filevar|finfo|finv|fipname|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|index|indexc|indexw|infile|informat|initcmd|initstmt|inner|input|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|mod|mode|model|modify|month|mopen|mort|mprint|mrecall|msglevel|msymtabmax|mvarsize|myy|n|nest|netpv|new|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|nosource|nosource2|nosplash|nosymbolgen|note|notes|notitle|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(1|5|10|25|50|75|90|95|99)|pad|pad2|page|pageno|pagesize|paired|parm|parmcards|path|pathdll|pathname|pdf|peek|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|put|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|s|s2|samploc|sasautos|sascontrol|sasfrscr|sashelp|sasmsg|sasmstore|sasscript|sasuser|saving|scan|sdf|second|select|selection|separated|seq|serror|set|setcomm|setot|sign|simple|sin|sinh|siteinfo|skewness|skip|sle|sls|sortedby|sortpgm|sortseq|sortsize|soundex|source2|spedis|splashlocation|split|spool|sqrt|start|std|stderr|stdin|stfips|stimer|stname|stnamel|stop|stopover|strip|subgroup|subpopn|substr|sum|sumwgt|symbol|symbolgen|symget|symput|sysget|sysin|sysleave|sysmsg|sysparm|sysprint|sysprintfont|sysprod|sysrc|system|t|table|tables|tan|tanh|tapeclose|tbufsize|terminal|test|then|time|timepart|tinv|title[1-9]?|tnonct|to|today|tol|tooldef|totper|transformout|translate|trantab|tranwrd|trigamma|trim|trimn|trunc|truncover|type|unformatted|uniform|union|until|upcase|update|user|usericon|uss|validate|value|var|varfmt|varinfmt|varlabel|varlen|varname|varnum|varray|varrayx|vartype|verify|vformat|vformatd|vformatdx|vformatn|vformatnx|vformatw|vformatwx|vformatx|vinarray|vinarrayx|vinformat|vinformatd|vinformatdx|vinformatn|vinformatnx|vinformatw|vinformatwx|vinformatx|vlabel|vlabelx|vlength|vlengthx|vname|vnamex|vnferr|vtype|vtypex|weekday|weight|when|where|while|wincharset|window|work|workinit|workterm|write|wsum|wsumx|x|xsync|xwait|year|yearcutoff|yes|yyq|zipfips|zipname|zipnamel|zipstate))\\b", |
| 152 |
"name": "support.function.sas" |
| 153 |
} |
| 154 |
], |
| 155 |
"repository": { |
| 156 |
"blockComment": { |
| 157 |
"patterns": [ |
| 158 |
{ |
| 159 |
"begin": "\\/\\*", |
| 160 |
"end": "\\*\\/", |
| 161 |
"name": "comment.block.slashstar.sas" |
| 162 |
} |
| 163 |
] |
| 164 |
}, |
| 165 |
"constant": { |
| 166 |
"patterns": [ |
| 167 |
{ |
| 168 |
"comment": "numeric constant", |
| 169 |
"match": "(?<![&\\}])\\b[0-9]*\\.?[0-9]+([eEdD][-+]?[0-9]+)?\\b", |
| 170 |
"name": "constant.numeric.sas" |
| 171 |
}, |
| 172 |
{ |
| 173 |
"comment": "single quote numeric-type constant", |
| 174 |
"match": "(')([^']+)(')(dt|[dt])", |
| 175 |
"name": "constant.numeric.quote.single.sas" |
| 176 |
}, |
| 177 |
{ |
| 178 |
"comment": "double quote numeric-type constant", |
| 179 |
"match": "(\")([^\"]+)(\")(dt|[dt])", |
| 180 |
"name": "constant.numeric.quote.double.sas" |
| 181 |
} |
| 182 |
] |
| 183 |
}, |
| 184 |
"dataSet": { |
| 185 |
"patterns": [ |
| 186 |
{ |
| 187 |
"begin": "((\\w+)\\.)?(\\w+)\\s?\\(", |
| 188 |
"beginCaptures": { |
| 189 |
"2": { |
| 190 |
"name": "entity.name.class.libref.sas" |
| 191 |
}, |
| 192 |
"3": { |
| 193 |
"name": "entity.name.class.dsname.sas" |
| 194 |
} |
| 195 |
}, |
| 196 |
"comment": "data set with options", |
| 197 |
"end": "\\)", |
| 198 |
"patterns": [ |
| 199 |
{ |
| 200 |
"include": "#dataSetOptions" |
| 201 |
}, |
| 202 |
{ |
| 203 |
"include": "#blockComment" |
| 204 |
}, |
| 205 |
{ |
| 206 |
"include": "#macro" |
| 207 |
}, |
| 208 |
{ |
| 209 |
"include": "#constant" |
| 210 |
}, |
| 211 |
{ |
| 212 |
"include": "#quote" |
| 213 |
}, |
| 214 |
{ |
| 215 |
"include": "#operator" |
| 216 |
} |
| 217 |
] |
| 218 |
}, |
| 219 |
{ |
| 220 |
"captures": { |
| 221 |
"2": { |
| 222 |
"name": "entity.name.class.libref.sas" |
| 223 |
}, |
| 224 |
"3": { |
| 225 |
"name": "entity.name.class.dsname.sas" |
| 226 |
} |
| 227 |
}, |
| 228 |
"comment": "data set without options", |
| 229 |
"match": "\\b((\\w+)\\.)?(\\w+)\\b" |
| 230 |
} |
| 231 |
] |
| 232 |
}, |
| 233 |
"dataSetOptions": { |
| 234 |
"patterns": [ |
| 235 |
{ |
| 236 |
"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?=", |
| 237 |
"name": "keyword.other.sas" |
| 238 |
} |
| 239 |
] |
| 240 |
}, |
| 241 |
"macro": { |
| 242 |
"patterns": [ |
| 243 |
{ |
| 244 |
"match": "(&+(?i:[a-z_]([a-z0-9_]+)?)(\\.+)?)\\b", |
| 245 |
"name": "variable.other.macro.sas" |
| 246 |
} |
| 247 |
] |
| 248 |
}, |
| 249 |
"operator": { |
| 250 |
"patterns": [ |
| 251 |
{ |
| 252 |
"match": "([\\+\\-\\*\\^\\/])", |
| 253 |
"name": "keyword.operator.arithmetic.sas" |
| 254 |
}, |
| 255 |
{ |
| 256 |
"match": "\\b(?i:(eq|ne|gt|lt|ge|le|in|not|&|and|or|min|max))\\b", |
| 257 |
"name": "keyword.operator.comparison.sas" |
| 258 |
}, |
| 259 |
{ |
| 260 |
"match": "([¬<>^~]?=(:)?|>|<|\\||!|¦|¬|^|~|<>|><|\\|\\|)", |
| 261 |
"name": "keyword.operator.sas" |
| 262 |
} |
| 263 |
] |
| 264 |
}, |
| 265 |
"quote": { |
| 266 |
"patterns": [ |
| 267 |
{ |
| 268 |
"begin": "(?<!%)(')", |
| 269 |
"comment": "single quoted string block", |
| 270 |
"end": "(')([bx])?", |
| 271 |
"name": "string.quoted.single.sas" |
| 272 |
}, |
| 273 |
{ |
| 274 |
"begin": "(\")", |
| 275 |
"comment": "double quoted string block", |
| 276 |
"end": "(\")([bx])?", |
| 277 |
"name": "string.quoted.double.sas" |
| 278 |
} |
| 279 |
] |
| 280 |
}, |
| 281 |
"starComment": { |
| 282 |
"patterns": [ |
| 283 |
{ |
| 284 |
"include": "#blockcomment" |
| 285 |
}, |
| 286 |
{ |
| 287 |
"begin": "(?<=;)[\\s%]*\\*", |
| 288 |
"end": ";", |
| 289 |
"name": "comment.line.inline.star.sas" |
| 290 |
}, |
| 291 |
{ |
| 292 |
"begin": "^[\\s%]*\\*", |
| 293 |
"end": ";", |
| 294 |
"name": "comment.line.start.sas" |
| 295 |
} |
| 296 |
] |
| 297 |
} |
| 298 |
}, |
| 299 |
"scopeName": "source.sas", |
| 300 |
"uuid": "7e721b1e-6265-4865-bc4b-308d49affba1" |
| 301 |
} |
| 302 |
|