Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

minor changes to better handle comments in proc #2392

Merged
merged 1 commit into from
May 18, 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
12 changes: 8 additions & 4 deletions components/prism-sas.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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