Skip to content

Commit

Permalink
SAS: Improved comments in proc groovy and proc lua (#2392)
Browse files Browse the repository at this point in the history
  • Loading branch information
cedporter committed May 18, 2020
1 parent 9782cfe commit 475a590
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
12 changes: 8 additions & 4 deletions components/prism-sas.js
Expand Up @@ -101,10 +101,10 @@
pattern: /(?:action)/i,
alias: 'keyword'
},
'comment': comment,
'function': func,
'arg-value': args['arg-value'],
'operator': args.operator,
'comment': comment,
'argument': args.arg,
'number': number,
'numeric-constant': numericConstant,
Expand Down Expand Up @@ -154,15 +154,17 @@
},

'proc-groovy': {
pattern: /(^proc\s+groovy(?:\s+[\w|=]+)?;)(?:\s*submit)[\s\S]+?(?=^(?:proc\s+\w+|quit|run|data);|(?![\s\S]))/im,
pattern: /(^proc\s+groovy(?:\s+[\w|=]+)?;)[\s\S]+?(?=^(?:proc\s+\w+|quit|run|data);|(?![\s\S]))/im,
lookbehind: true,
inside: {
'comment': comment,
'groovy': {
pattern: RegExp(/(^[ \t]*submit(?:\s+(?:load|parseonly|norun))?)(?:<str>|[^"'])+?(?=endsubmit;)/.source.replace(/<str>/g, function () { return stringPattern; }), 'im'),
lookbehind: true,
alias: 'language-groovy',
inside: Prism.languages.groovy
},
'keyword': keywords,
'submit-statement': submitStatement,
'global-statements': globalStatements,
'number': number,
Expand All @@ -173,15 +175,17 @@
},

'proc-lua': {
pattern: /(^proc\s+lua(?:\s+[\w|=]+)?;)(?:\s*submit)[\s\S]+?(?=^(?:proc\s+\w+|quit|run|data);|(?![\s\S]))/im,
pattern: /(^proc\s+lua(?:\s+[\w|=]+)?;)[\s\S]+?(?=^(?:proc\s+\w+|quit|run|data);|(?![\s\S]))/im,
lookbehind: true,
inside: {
'comment': comment,
'lua': {
pattern: RegExp(/(^[ \t]*submit(?:\s+(?:load|parseonly|norun))?)(?:<str>|[^"'])+?(?=endsubmit;)/.source.replace(/<str>/g, function () { return stringPattern; }), 'im'),
lookbehind: true,
alias: 'language-lua',
inside: Prism.languages.lua
},
'keyword': keywords,
'submit-statement': submitStatement,
'global-statements': globalStatements,
'number': number,
Expand All @@ -195,6 +199,7 @@
pattern: /(^proc\s+cas(?:\s+[\w|=]+)?;)[\s\S]+?(?=^(?:proc\s+\w+|quit|data);|(?![\s\S]))/im,
lookbehind: true,
inside: {
'comment': comment,
'statement-var': {
pattern: /((?:^|\s)=?)saveresult\s+[^;]+/im,
lookbehind: true,
Expand All @@ -217,7 +222,6 @@
'step': step,
'keyword': keywords,
'function': func,
'comment': comment,
'format': format,
'altformat': altformat,
'global-statements': globalStatements,
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.

11 changes: 8 additions & 3 deletions tests/languages/groovy+sas/groovy_inclusion.test
@@ -1,4 +1,5 @@
proc groovy classpath=cp;
/* Testing a comment */
submit parseonly;
class Speaker {
def say( word ) {
Expand Down Expand Up @@ -26,6 +27,7 @@ quit;
],
[
"proc-groovy", [
["comment", "/* Testing a comment */"],
["submit-statement", "submit parseonly"],
[
"groovy", [
Expand Down Expand Up @@ -60,9 +62,12 @@ quit;
["punctuation", ";"]
]
],
["keyword", "eval"],
["string", "\"s = new Speaker(); s.say( \"\"Hi\"\" )\""],
["punctuation", ";"],
["proc-groovy",[
["keyword", "eval"],
["string", "\"s = new Speaker(); s.say( \"\"Hi\"\" )\""],
["punctuation", ";"]
]
],
["step", "quit"],
["punctuation", ";"]
]
Expand Down
2 changes: 2 additions & 0 deletions tests/languages/lua+sas/lua_inclusion.test
@@ -1,4 +1,5 @@
proc lua;
/* Testing a comment */
submit;
array = { 1, 2, 3, 4, 5 }
sum = sas.sumx(array)
Expand All @@ -13,6 +14,7 @@ run;
["punctuation", ";"],
[
"proc-lua", [
["comment", "/* Testing a comment */"],
["submit-statement", "submit"],
[
"lua", [
Expand Down
2 changes: 2 additions & 0 deletions tests/languages/sas/proccas_feature.test
Expand Up @@ -6,6 +6,7 @@ run;
quit;

proc cas;
/* Testing a comment */
session casauto;
output log;
table.loadTable / path="iris.sashdat";
Expand Down Expand Up @@ -61,6 +62,7 @@ quit;
["punctuation", ";"],
["proc-cas",
[
["comment", "/* Testing a comment */"],
["keyword", "session"],
" casauto",
["punctuation", ";"],
Expand Down

0 comments on commit 475a590

Please sign in to comment.