Skip to content

Commit 475a590

Browse files
authoredMay 18, 2020
SAS: Improved comments in proc groovy and proc lua (#2392)
1 parent 9782cfe commit 475a590

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed
 

‎components/prism-sas.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@
101101
pattern: /(?:action)/i,
102102
alias: 'keyword'
103103
},
104+
'comment': comment,
104105
'function': func,
105106
'arg-value': args['arg-value'],
106107
'operator': args.operator,
107-
'comment': comment,
108108
'argument': args.arg,
109109
'number': number,
110110
'numeric-constant': numericConstant,
@@ -154,15 +154,17 @@
154154
},
155155

156156
'proc-groovy': {
157-
pattern: /(^proc\s+groovy(?:\s+[\w|=]+)?;)(?:\s*submit)[\s\S]+?(?=^(?:proc\s+\w+|quit|run|data);|(?![\s\S]))/im,
157+
pattern: /(^proc\s+groovy(?:\s+[\w|=]+)?;)[\s\S]+?(?=^(?:proc\s+\w+|quit|run|data);|(?![\s\S]))/im,
158158
lookbehind: true,
159159
inside: {
160+
'comment': comment,
160161
'groovy': {
161162
pattern: RegExp(/(^[ \t]*submit(?:\s+(?:load|parseonly|norun))?)(?:<str>|[^"'])+?(?=endsubmit;)/.source.replace(/<str>/g, function () { return stringPattern; }), 'im'),
162163
lookbehind: true,
163164
alias: 'language-groovy',
164165
inside: Prism.languages.groovy
165166
},
167+
'keyword': keywords,
166168
'submit-statement': submitStatement,
167169
'global-statements': globalStatements,
168170
'number': number,
@@ -173,15 +175,17 @@
173175
},
174176

175177
'proc-lua': {
176-
pattern: /(^proc\s+lua(?:\s+[\w|=]+)?;)(?:\s*submit)[\s\S]+?(?=^(?:proc\s+\w+|quit|run|data);|(?![\s\S]))/im,
178+
pattern: /(^proc\s+lua(?:\s+[\w|=]+)?;)[\s\S]+?(?=^(?:proc\s+\w+|quit|run|data);|(?![\s\S]))/im,
177179
lookbehind: true,
178180
inside: {
181+
'comment': comment,
179182
'lua': {
180183
pattern: RegExp(/(^[ \t]*submit(?:\s+(?:load|parseonly|norun))?)(?:<str>|[^"'])+?(?=endsubmit;)/.source.replace(/<str>/g, function () { return stringPattern; }), 'im'),
181184
lookbehind: true,
182185
alias: 'language-lua',
183186
inside: Prism.languages.lua
184187
},
188+
'keyword': keywords,
185189
'submit-statement': submitStatement,
186190
'global-statements': globalStatements,
187191
'number': number,
@@ -195,6 +199,7 @@
195199
pattern: /(^proc\s+cas(?:\s+[\w|=]+)?;)[\s\S]+?(?=^(?:proc\s+\w+|quit|data);|(?![\s\S]))/im,
196200
lookbehind: true,
197201
inside: {
202+
'comment': comment,
198203
'statement-var': {
199204
pattern: /((?:^|\s)=?)saveresult\s+[^;]+/im,
200205
lookbehind: true,
@@ -217,7 +222,6 @@
217222
'step': step,
218223
'keyword': keywords,
219224
'function': func,
220-
'comment': comment,
221225
'format': format,
222226
'altformat': altformat,
223227
'global-statements': globalStatements,

‎components/prism-sas.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tests/languages/groovy+sas/groovy_inclusion.test

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
proc groovy classpath=cp;
2+
/* Testing a comment */
23
submit parseonly;
34
class Speaker {
45
def say( word ) {
@@ -26,6 +27,7 @@ quit;
2627
],
2728
[
2829
"proc-groovy", [
30+
["comment", "/* Testing a comment */"],
2931
["submit-statement", "submit parseonly"],
3032
[
3133
"groovy", [
@@ -60,9 +62,12 @@ quit;
6062
["punctuation", ";"]
6163
]
6264
],
63-
["keyword", "eval"],
64-
["string", "\"s = new Speaker(); s.say( \"\"Hi\"\" )\""],
65-
["punctuation", ";"],
65+
["proc-groovy",[
66+
["keyword", "eval"],
67+
["string", "\"s = new Speaker(); s.say( \"\"Hi\"\" )\""],
68+
["punctuation", ";"]
69+
]
70+
],
6671
["step", "quit"],
6772
["punctuation", ";"]
6873
]

‎tests/languages/lua+sas/lua_inclusion.test

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
proc lua;
2+
/* Testing a comment */
23
submit;
34
array = { 1, 2, 3, 4, 5 }
45
sum = sas.sumx(array)
@@ -13,6 +14,7 @@ run;
1314
["punctuation", ";"],
1415
[
1516
"proc-lua", [
17+
["comment", "/* Testing a comment */"],
1618
["submit-statement", "submit"],
1719
[
1820
"lua", [

‎tests/languages/sas/proccas_feature.test

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ run;
66
quit;
77

88
proc cas;
9+
/* Testing a comment */
910
session casauto;
1011
output log;
1112
table.loadTable / path="iris.sashdat";
@@ -61,6 +62,7 @@ quit;
6162
["punctuation", ";"],
6263
["proc-cas",
6364
[
65+
["comment", "/* Testing a comment */"],
6466
["keyword", "session"],
6567
" casauto",
6668
["punctuation", ";"],

0 commit comments

Comments
 (0)
Please sign in to comment.