mirror of
https://github.com/cheat/cheat.git
synced 2024-11-24 06:51:36 +01:00
191 lines
7.8 KiB
XML
191 lines
7.8 KiB
XML
|
<lexer>
|
||
|
<config>
|
||
|
<name>SAS</name>
|
||
|
<alias>sas</alias>
|
||
|
<filename>*.SAS</filename>
|
||
|
<filename>*.sas</filename>
|
||
|
<mime_type>text/x-sas</mime_type>
|
||
|
<mime_type>text/sas</mime_type>
|
||
|
<mime_type>application/x-sas</mime_type>
|
||
|
<case_insensitive>true</case_insensitive>
|
||
|
</config>
|
||
|
<rules>
|
||
|
<state name="validvar">
|
||
|
<rule pattern="[a-z_]\w{0,31}\.?">
|
||
|
<token type="NameVariable"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="cards-datalines">
|
||
|
<rule pattern="^\s*(datalines|cards)\s*;\s*$">
|
||
|
<token type="Keyword"/>
|
||
|
<push state="data"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="proc-data">
|
||
|
<rule pattern="(^|;)\s*(proc \w+|data|run|quit)[\s;]">
|
||
|
<token type="KeywordReserved"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="string_dquote">
|
||
|
<rule pattern=""">
|
||
|
<token type="LiteralString"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\\\|\\"|\\\n">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="&">
|
||
|
<token type="NameVariable"/>
|
||
|
<push state="validvar"/>
|
||
|
</rule>
|
||
|
<rule pattern="[^$&"\\]+">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
<rule pattern="[$"\\]">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="general">
|
||
|
<rule>
|
||
|
<include state="keywords"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="vars-strings"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="special"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="numbers"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="vars-strings">
|
||
|
<rule pattern="&[a-z_]\w{0,31}\.?">
|
||
|
<token type="NameVariable"/>
|
||
|
</rule>
|
||
|
<rule pattern="%[a-z_]\w{0,31}">
|
||
|
<token type="NameFunction"/>
|
||
|
</rule>
|
||
|
<rule pattern="\'">
|
||
|
<token type="LiteralString"/>
|
||
|
<push state="string_squote"/>
|
||
|
</rule>
|
||
|
<rule pattern=""">
|
||
|
<token type="LiteralString"/>
|
||
|
<push state="string_dquote"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="root">
|
||
|
<rule>
|
||
|
<include state="comments"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="proc-data"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="cards-datalines"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="logs"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="general"/>
|
||
|
</rule>
|
||
|
<rule pattern=".">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\\n">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
<rule pattern="\n">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="data">
|
||
|
<rule pattern="(.|\n)*^\s*;\s*$">
|
||
|
<token type="Other"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="logs">
|
||
|
<rule pattern="\n?^\s*%?put ">
|
||
|
<token type="Keyword"/>
|
||
|
<push state="log-messages"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="keywords">
|
||
|
<rule pattern="\b(datalines4|datalines|delimiter|startsas|redirect|lostcard|continue|informat|filename|footnote|catname|options|libname|systask|display|waitsas|missing|replace|delete|window|endsas|update|format|attrib|length|infile|select|return|retain|rename|remove|output|cards4|modify|leave|title|merge|delim|input|cards|abort|where|label|array|error|call|page|stop|keep|file|drop|link|skip|list|goto|put|out|set|by|dm|in|x)\b">
|
||
|
<token type="Keyword"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(references|distinct|describe|validate|restrict|cascade|msgtype|message|primary|foreign|delete|update|create|unique|having|modify|insert|select|group|check|table|alter|order|reset|index|where|into|from|view|null|like|drop|add|not|key|and|set|on|in|or|as)\b">
|
||
|
<token type="Keyword"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(while|until|then|else|end|if|do)\b">
|
||
|
<token type="Keyword"/>
|
||
|
</rule>
|
||
|
<rule pattern="%(sysevalf|nrbquote|qsysfunc|qlowcase|compstor|nrquote|display|qupcase|datatyp|qcmpres|unquote|syscall|sysfunc|sysrput|sysprod|syslput|sysexec|lowcase|qsubstr|sysget|length|keydef|global|superq|substr|verify|bquote|cmpres|upcase|window|label|qleft|while|qtrim|quote|nrstr|until|sysrc|input|macro|local|qscan|index|else|scan|mend|eval|trim|then|goto|left|put|let|end|str|do|to|if)\b">
|
||
|
<token type="NameBuiltin"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(vinformatnx|vinformatwx|vinformatdx|vinformatw|vinformatd|vinformatx|vinformatn|vinformat|translate|vinarrayx|vformatwx|vformatnx|vformatdx|getoption|fileexist|fetchobs|vlengthx|filename|fipstate|kurtosis|vinarray|vformatx|pathname|foptname|compound|compress|vformatw|hosthelp|vformatn|zipnamel|vformatd|probbeta|daccdbsl|zipstate|trigamma|probbnml|probhypr|probnegb|probnorm|datepart|datetime|varlabel|varinfmt|dropnote|skewness|doptname|timepart|fipnamel|dequote|tranwrd|sysprod|digamma|stnamel|soundex|depdbsl|reverse|daccsyd|doptnum|resolve|uniform|datejul|varname|varrayx|probgam|probchi|fappend|dacctab|vformat|poisson|collate|brshift|ordinal|fdelete|blshift|betainv|fileref|lowcase|libname|fipname|vlabelx|vlength|weekday|juldate|jbessel|ibessel|zipfips|foptnum|zipname|getvarn|getvarc|frewind|vartype|depsyd|stderr|stfips|fwrite|gaminv|second|substr|vtypex|symget|hbound|vnamex|fpoint|saving|fnonct|rewind|indexc|indexw|repeat|inputc|inputn|ranuni|stname|rantbl|ranpoi|rannor|sysget|rangam|ranexp|vlabel|lbound|cexist|length|lgamma|rancau|libref|cnonct|ranbin|compbl|logpdf|logpmf|logsdf|sysmsg|curobs|daccdb|verify|daccsl|minute|system|tnonct|dsname|varray|varnum|probit|spedis|normal|varlen|dclose|varfmt|fexist|deptab|upcase|rantri|fclose|nmiss|point|trimn|depsl|trunc|peekc|depdb|probf|exist|fetch|netpv|today|mopen|probt|month|dairy|sysrc|finfo|quote|log10|close|floor|dinfo|range|fnote|attrn|intrr|intnx|intck|attrc|input|dread|dopen|index|right|round|vname|vtype|fread|gamma|arsin|arcos|fopen|frlen|fget|sinh|sqrt|addr|airy|sign|fsep|year|fuzz|dnum|scan|rank|fput|fpos|putn|putc|hour|tanh|atan|dhms|tinv|band|bnot|erfc|fcol|poke|trim|byte|ceil|peek|left|cinv|finv|open|log2|mean|note|date|cosh|mort|time|bxor|bor|mdy|std|max|css|sin|cos|npv|log|var|uss|pdf|pmf|cdf|abs|hms|day|erf|put|lag|irr|int|sum|tan|min|dif|qtr|sdf|dim|yyq|exp|mod|cv|n)\(">
|
||
|
<token type="NameBuiltin"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="numbers">
|
||
|
<rule pattern="\b[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+|\.)(E[+-]?[0-9]+)?i?\b">
|
||
|
<token type="LiteralNumber"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="special">
|
||
|
<rule pattern="(null|missing|_all_|_automatic_|_character_|_n_|_infile_|_name_|_null_|_numeric_|_user_|_webout_)">
|
||
|
<token type="KeywordConstant"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="log-messages">
|
||
|
<rule pattern="NOTE(:|-).*">
|
||
|
<token type="Generic"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="WARNING(:|-).*">
|
||
|
<token type="GenericEmph"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="ERROR(:|-).*">
|
||
|
<token type="GenericError"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="general"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="comments">
|
||
|
<rule pattern="^\s*\*.*?;">
|
||
|
<token type="Comment"/>
|
||
|
</rule>
|
||
|
<rule pattern="/\*.*?\*/">
|
||
|
<token type="Comment"/>
|
||
|
</rule>
|
||
|
<rule pattern="^\s*\*(.|\n)*?;">
|
||
|
<token type="CommentMultiline"/>
|
||
|
</rule>
|
||
|
<rule pattern="/[*](.|\n)*?[*]/">
|
||
|
<token type="CommentMultiline"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="string_squote">
|
||
|
<rule pattern="'">
|
||
|
<token type="LiteralString"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\\\|\\"|\\\n">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="[^$\'\\]+">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
<rule pattern="[$\'\\]">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
</rules>
|
||
|
</lexer>
|