Added new SAS keywords (#1784) This adds the SAS keywords libname, set, output, and options to the language definition.
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
diff --git a/components/prism-sas.js b/components/prism-sas.js
index cbaa034..607995c 100644
--- a/components/prism-sas.js
+++ b/components/prism-sas.js
@@ -26,7 +26,7 @@ Prism.languages.sas = {
pattern: /(["'])(?:\1\1|(?!\1)[\s\S])*\1/,
greedy: true
},
- 'keyword': /\b(?:data|else|format|if|input|proc\s\w+|quit|run|then)\b/i,
+ 'keyword': /\b(?:data|else|format|if|input|proc\s\w+|quit|run|then|libname|set|output|options)\b/i,
// Decimal (1.2e23), hexadecimal (0c1x)
'number': /\b(?:[\da-f]+x|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,
'operator': /\*\*?|\|\|?|!!?|¦¦?|<[>=]?|>[<=]?|[-+\/=&]|[~¬^]=?|\b(?:eq|ne|gt|lt|ge|le|in|not)\b/i,
diff --git a/components/prism-sas.min.js b/components/prism-sas.min.js
index 0ad62f2..b6ea705 100644
--- a/components/prism-sas.min.js
+++ b/components/prism-sas.min.js
@@ -1 +1 @@
-Prism.languages.sas={datalines:{pattern:/^\s*(?:(?:data)?lines|cards);[\s\S]+?(?:\r?\n|\r);/im,alias:"string",inside:{keyword:{pattern:/^(\s*)(?:(?:data)?lines|cards)/i,lookbehind:!0},punctuation:/;/}},comment:[{pattern:/(^\s*|;\s*)\*.*;/m,lookbehind:!0},/\/\*[\s\S]+?\*\//],datetime:{pattern:/'[^']+'(?:dt?|t)\b/i,alias:"number"},string:{pattern:/(["'])(?:\1\1|(?!\1)[\s\S])*\1/,greedy:!0},keyword:/\b(?:data|else|format|if|input|proc\s\w+|quit|run|then)\b/i,number:/\b(?:[\da-f]+x|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,operator:/\*\*?|\|\|?|!!?|¦¦?|<[>=]?|>[<=]?|[-+\/=&]|[~¬^]=?|\b(?:eq|ne|gt|lt|ge|le|in|not)\b/i,punctuation:/[$%@.(){}\[\];,\\]/};
\ No newline at end of file
+Prism.languages.sas={datalines:{pattern:/^\s*(?:(?:data)?lines|cards);[\s\S]+?(?:\r?\n|\r);/im,alias:"string",inside:{keyword:{pattern:/^(\s*)(?:(?:data)?lines|cards)/i,lookbehind:!0},punctuation:/;/}},comment:[{pattern:/(^\s*|;\s*)\*.*;/m,lookbehind:!0},/\/\*[\s\S]+?\*\//],datetime:{pattern:/'[^']+'(?:dt?|t)\b/i,alias:"number"},string:{pattern:/(["'])(?:\1\1|(?!\1)[\s\S])*\1/,greedy:!0},keyword:/\b(?:data|else|format|if|input|proc\s\w+|quit|run|then|libname|set|output|options)\b/i,number:/\b(?:[\da-f]+x|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,operator:/\*\*?|\|\|?|!!?|¦¦?|<[>=]?|>[<=]?|[-+\/=&]|[~¬^]=?|\b(?:eq|ne|gt|lt|ge|le|in|not)\b/i,punctuation:/[$%@.(){}\[\];,\\]/};
diff --git a/tests/languages/sas/keyword_feature.test b/tests/languages/sas/keyword_feature.test
index 697a412..90f8692 100644
--- a/tests/languages/sas/keyword_feature.test
+++ b/tests/languages/sas/keyword_feature.test
@@ -1,13 +1,15 @@
data else format if
input proc run then
+libname set output options
----------------------------------------------------
[
["keyword", "data"], ["keyword", "else"], ["keyword", "format"], ["keyword", "if"],
- ["keyword", "input"], ["keyword", "proc run"], ["keyword", "then"]
+ ["keyword", "input"], ["keyword", "proc run"], ["keyword", "then"], ["keyword", "libname"],
+ ["keyword", "set"], ["keyword", "output"], ["keyword", "options"]
]
----------------------------------------------------
-Checks for all keywords.
\ No newline at end of file
+Checks for all keywords.