From 3b396ef51c9e9671639f16797de3b3f79bdf0530 Mon Sep 17 00:00:00 2001 From: wippysnib Date: Sat, 2 Mar 2019 04:09:06 -0600 Subject: [PATCH] Added new SAS keywords (#1784) This adds the SAS keywords libname, set, output, and options to the language definition. --- components/prism-sas.js | 2 +- components/prism-sas.min.js | 2 +- tests/languages/sas/keyword_feature.test | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/components/prism-sas.js b/components/prism-sas.js index cbaa034eec..607995c820 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 0ad62f2c51..b6ea705c9a 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 697a4120ec..90f86929aa 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.