Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Macro string functions #2463

Merged
merged 9 commits into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions components/prism-sas.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
alias: 'number'
};

var macroVariable = {
pattern: /&[a-z_][a-z_0-9]*/i
};

var macroKeyword = {
pattern: /((?:^|\s|=|\())%(?:ABORT|BY|CMS|COPY|DISPLAY|DO|ELSE|END|EVAL|GLOBAL|GO|GOTO|IF|INC|INCLUDE|INDEX|INPUT|KTRIM|LENGTH|LET|LIST|LOCAL|PUT|QKTRIM|QSCAN|QSUBSTR|QSYSFUNC|QUPCASE|RETURN|RUN|SCAN|SUBSTR|SUPERQ|SYMDEL|SYMGLOBL|SYMLOCAL|SYMEXIST|SYSCALL|SYSEVALF|SYSEXEC|SYSFUNC|SYSGET|SYSRPUT|THEN|TO|TSO|UNQUOTE|UNTIL|UPCASE|WHILE|WINDOW)\b/i,
lookbehind: true,
alias: 'keyword'
};

var step = {
pattern: /(^|\s+)(?:proc\s+\w+|quit|run|data(?!\=))\b/i,
alias: 'keyword',
Expand Down Expand Up @@ -41,10 +51,7 @@
lookbehind: true
},
'operator': /=/,
'macro-variable': {
pattern: /&[^\.]*\./i,
alias: 'string'
},
'macro-variable': macroVariable,
'arg': {
pattern: /[A-Z]+/i,
alias: 'keyword'
Expand Down Expand Up @@ -237,6 +244,9 @@
lookbehind: true,
inside: args
},
/*Special keywords within macros*/
'macro-keyword': macroKeyword,
'macro-variable': macroVariable,
'macro-string-functions': {
pattern: /((?:^|\s|=))%(?:NRBQUOTE|NRQUOTE|NRSTR|BQUOTE|QUOTE|STR)\(.*?(?:[^%]\))/i,
lookbehind: true,
Expand All @@ -245,19 +255,14 @@
pattern: /%(?:NRBQUOTE|NRQUOTE|NRSTR|BQUOTE|QUOTE|STR)/i,
alias: 'keyword'
},
'string': {
pattern: /(\()[^)]+/,
lookbehind: true
'macro-keyword': macroKeyword,
'macro-variable': macroVariable,
'escaped-char': {
pattern: /%['"()<>=¬^~;,#]/i,
},
'punctuation': punctuation
}
},
/*Special keywords within macros*/
'macro-keyword': {
pattern: /((?:^|\s)=?)%(?:ABORT|BQUOTE|BY|CMS|COPY|DISPLAY|DO|ELSE|END|EVAL|GLOBAL|GO|GOTO|IF|INC|INCLUDE|INDEX|INPUT|KTRIM|LENGTH|LET|LIST|LOCAL|NRBQUOTE|NRQUOTE|NRSTR|PUT|QKTRIM|QSCAN|QSUBSTR|QSYSFUNC|QUOTE|QUPCASE|RETURN|RUN|SCAN|STR|SUBSTR|SUPERQ|SYMDEL|SYMGLOBL|SYMLOCAL|SYMEXIST|SYSCALL|SYSEVALF|SYSEXEC|SYSFUNC|SYSGET|SYSRPUT|THEN|TO|TSO|UNQUOTE|UNTIL|UPCASE|WHILE|WINDOW)\b/i,
lookbehind: true,
alias: 'keyword'
},
'macro-declaration': {
pattern: /^%macro[^;]+(?=;)/im,
inside: {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-sas.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading