sas function

Mode sas(
  1. Highlight hljs
)

Highlight.js language definition for sas.

Implementation

Mode sas(Highlight hljs) {
  final Mode mode0 = Mode();
  mode0.begin = r'\\[\s\S]';
  mode0.relevance = 0;
  return Mode(
    name: r'SAS',
    caseInsensitive: true,
    keywords: {
      r'literal': [
        r'null',
        r'missing',
        r'_all_',
        r'_automatic_',
        r'_character_',
        r'_infile_',
        r'_n_',
        r'_name_',
        r'_null_',
        r'_numeric_',
        r'_user_',
        r'_webout_',
      ],
      r'keyword': [
        r'do',
        r'if',
        r'then',
        r'else',
        r'end',
        r'until',
        r'while',
        r'abort',
        r'array',
        r'attrib',
        r'by',
        r'call',
        r'cards',
        r'cards4',
        r'catname',
        r'continue',
        r'datalines',
        r'datalines4',
        r'delete',
        r'delim',
        r'delimiter',
        r'display',
        r'dm',
        r'drop',
        r'endsas',
        r'error',
        r'file',
        r'filename',
        r'footnote',
        r'format',
        r'goto',
        r'in',
        r'infile',
        r'informat',
        r'input',
        r'keep',
        r'label',
        r'leave',
        r'length',
        r'libname',
        r'link',
        r'list',
        r'lostcard',
        r'merge',
        r'missing',
        r'modify',
        r'options',
        r'output',
        r'out',
        r'page',
        r'put',
        r'redirect',
        r'remove',
        r'rename',
        r'replace',
        r'retain',
        r'return',
        r'select',
        r'set',
        r'skip',
        r'startsas',
        r'stop',
        r'title',
        r'update',
        r'waitsas',
        r'where',
        r'window',
        r'x|0',
        r'systask',
        r'add',
        r'and',
        r'alter',
        r'as',
        r'cascade',
        r'check',
        r'create',
        r'delete',
        r'describe',
        r'distinct',
        r'drop',
        r'foreign',
        r'from',
        r'group',
        r'having',
        r'index',
        r'insert',
        r'into',
        r'in',
        r'key',
        r'like',
        r'message',
        r'modify',
        r'msgtype',
        r'not',
        r'null',
        r'on',
        r'or',
        r'order',
        r'primary',
        r'references',
        r'reset',
        r'restrict',
        r'select',
        r'set',
        r'table',
        r'unique',
        r'update',
        r'validate',
        r'view',
        r'where',
      ],
    },
    contains: [
      Mode(scope: r'keyword', begin: r'^\s*(proc [\w\d_]+|data|run|quit)[\s;]'),
      Mode(scope: r'variable', begin: r'&[a-zA-Z_&][a-zA-Z0-9_]*\.?'),
      Mode(
        begin: [r'^\s*', r'datalines;|cards;', r'(?:.*\n)+', r'^\s*;\s*$'],
        scope: {2: r'keyword', 3: r'string'},
      ),
      Mode(
        begin: [r'%mend|%macro', r'\s+', r'[a-zA-Z_&][a-zA-Z0-9_]*'],
        scope: {1: r'built_in', 3: r'title.function'},
      ),
      Mode(
        scope: r'built_in',
        begin:
            r'%(?:bquote|nrbquote|cmpres|qcmpres|compstor|datatyp|display|do|else|end|eval|global|goto|if|index|input|keydef|label|left|length|let|local|lowcase|macro|mend|nrbquote|nrquote|nrstr|put|qcmpres|qleft|qlowcase|qscan|qsubstr|qsysfunc|qtrim|quote|qupcase|scan|str|substr|superq|syscall|sysevalf|sysexec|sysfunc|sysget|syslput|sysprod|sysrc|sysrput|then|to|trim|unquote|until|upcase|verify|while|window)',
      ),
      Mode(scope: r'title.function', begin: r'%[a-zA-Z_][a-zA-Z_0-9]*'),
      Mode(
        scope: r'meta',
        begin:
            r'(?:abs|addr|airy|arcos|arsin|atan|attrc|attrn|band|betainv|blshift|bnot|bor|brshift|bxor|byte|cdf|ceil|cexist|cinv|close|cnonct|collate|compbl|compound|compress|cos|cosh|css|curobs|cv|daccdb|daccdbsl|daccsl|daccsyd|dacctab|dairy|date|datejul|datepart|datetime|day|dclose|depdb|depdbsl|depdbsl|depsl|depsl|depsyd|depsyd|deptab|deptab|dequote|dhms|dif|digamma|dim|dinfo|dnum|dopen|doptname|doptnum|dread|dropnote|dsname|erf|erfc|exist|exp|fappend|fclose|fcol|fdelete|fetch|fetchobs|fexist|fget|fileexist|filename|fileref|finfo|finv|fipname|fipnamel|fipstate|floor|fnonct|fnote|fopen|foptname|foptnum|fpoint|fpos|fput|fread|frewind|frlen|fsep|fuzz|fwrite|gaminv|gamma|getoption|getvarc|getvarn|hbound|hms|hosthelp|hour|ibessel|index|indexc|indexw|input|inputc|inputn|int|intck|intnx|intrr|irr|jbessel|juldate|kurtosis|lag|lbound|left|length|lgamma|libname|libref|log|log10|log2|logpdf|logpmf|logsdf|lowcase|max|mdy|mean|min|minute|mod|month|mopen|mort|n|netpv|nmiss|normal|note|npv|open|ordinal|pathname|pdf|peek|peekc|pmf|point|poisson|poke|probbeta|probbnml|probchi|probf|probgam|probhypr|probit|probnegb|probnorm|probt|put|putc|putn|qtr|quote|ranbin|rancau|ranexp|rangam|range|rank|rannor|ranpoi|rantbl|rantri|ranuni|repeat|resolve|reverse|rewind|right|round|saving|scan|sdf|second|sign|sin|sinh|skewness|soundex|spedis|sqrt|std|stderr|stfips|stname|stnamel|substr|sum|symget|sysget|sysmsg|sysprod|sysrc|system|tan|tanh|time|timepart|tinv|tnonct|today|translate|tranwrd|trigamma|trim|trimn|trunc|uniform|upcase|uss|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|vtype|vtypex|weekday|year|yyq|zipfips|zipname|zipnamel|zipstate)(?=\()',
      ),
      Mode(
        scope: r'string',
        variants: [
          Mode(
            scope: r'string',
            begin: r"'",
            end: r"'",
            illegal: r'\n',
            contains: [mode0],
          ),
          Mode(
            scope: r'string',
            begin: r'"',
            end: r'"',
            illegal: r'\n',
            contains: [mode0],
          ),
        ],
      ),
      Mode(
        scope: r'comment',
        begin: r'\*',
        end: r';',
        contains: [
          Mode(
            scope: r'doctag',
            begin: r'[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',
            end: r'(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):',
            excludeBegin: true,
            relevance: 0,
          ),
          Mode(
            begin:
                r"[ ]+((?:I|a|is|so|us|to|at|if|in|it|on|[A-Za-z]+['](d|ve|re|ll|t|s|n)|[A-Za-z]+[-][a-z]+|[A-Za-z][a-z]{2,})[.]?[:]?([.][ ]|[ ])){3}",
          ),
        ],
      ),
      Mode(
        scope: r'comment',
        begin: r'/\*',
        end: r'\*/',
        contains: [
          Mode(
            scope: r'doctag',
            begin: r'[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',
            end: r'(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):',
            excludeBegin: true,
            relevance: 0,
          ),
          Mode(
            begin:
                r"[ ]+((?:I|a|is|so|us|to|at|if|in|it|on|[A-Za-z]+['](d|ve|re|ll|t|s|n)|[A-Za-z]+[-][a-z]+|[A-Za-z][a-z]{2,})[.]?[:]?([.][ ]|[ ])){3}",
          ),
        ],
      ),
    ],
  );
}