Commit 3b396ef51c9e9671639f16797de3b3f79bdf0530

wippysnib 2019-03-02T04:09:06

Added new SAS keywords (#1784) This adds the SAS keywords libname, set, output, and options to the language definition.

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.