runtime(progress): Add single-line comment syntax
Progress OpenEdge 11.6 added a new C-like single-line comment syntax; such
comments begin with `//` and proceed to the end of the line.
Add a new syntax group `ProgressLineComment` to implement highlighting for this
syntax. Rename the existing group from `ProgressComment` to
`ProgressBlockComment`, and introduce a cluster named `ProgressComment` to
encapsulate both.
closes: #15339
Signed-off-by: Daniel Smith <daniel@rdnlsmith.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/syntax/progress.vim b/runtime/syntax/progress.vim
index 2227fbe..4b8f612 100644
--- a/runtime/syntax/progress.vim
+++ b/runtime/syntax/progress.vim
@@ -9,8 +9,7 @@
" Chris Ruprecht <chrisSPAXY@ruprecht.org>
" Mikhail Kuperblum <mikhailSPAXY@whasup.com>
" John Florian <jflorianSPAXY@voyager.net>
-" Version: 13
-" Last Change: Nov 11 2012
+" Last Change: Jul 23 2024
" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -117,8 +116,10 @@
" If you don't like white space on the end of lines, uncomment this:
" syn match ProgressSpaceError "\s\+$"
-syn region ProgressComment start="/\*" end="\*/" contains=ProgressComment,ProgressTodo,ProgressDebug,@Spell
-syn region ProgressInclude start="^[ ]*[{]" end="[}]" contains=ProgressPreProc,ProgressOperator,ProgressString,ProgressComment
+syn region ProgressBlockComment start="/\*" end="\*/" contains=ProgressBlockComment,ProgressTodo,ProgressDebug,@Spell
+syn match ProgressLineComment "//.*$" contains=ProgressTodo,ProgressDebug,@Spell
+syn cluster ProgressComment contains=ProgressBlockComment,ProgressLineComment
+syn region ProgressInclude start="^[ ]*[{]" end="[}]" contains=ProgressPreProc,ProgressOperator,ProgressString,@ProgressComment
syn region ProgressPreProc start="&" end="\>" contained
" This next line works reasonably well.
@@ -282,6 +283,8 @@
hi def link ProgressByte Number
hi def link ProgressCase Repeat
hi def link ProgressComment Comment
+hi def link ProgressBlockComment ProgressComment
+hi def link ProgressLineComment ProgressComment
hi def link ProgressConditional Conditional
hi def link ProgressDebug Debug
hi def link ProgressDo Repeat
diff --git a/runtime/syntax/testdir/dumps/progress_comments_01.dump b/runtime/syntax/testdir/dumps/progress_comments_01.dump
index 6ccebc2..11dc103 100644
--- a/runtime/syntax/testdir/dumps/progress_comments_01.dump
+++ b/runtime/syntax/testdir/dumps/progress_comments_01.dump
@@ -16,5 +16,5 @@
@75
|d+0#af5f00255&|i|s|p|l|a|y| +0#0000000&|c|u|s|t|o|m|e|r|_|n|a|m|e|.+0#af5f00255&| +0#0000000&@52
@75
-|~+0#4040ff13&| @73
-| +0#0000000&@56|1|9|,|1| @9|B|o|t|
+|/+0#0000e05&@1| |T|h|i|s| |i|s| |t|h|e| |s|i|n|g|l|e|-|l|i|n|e| |c|o|m@1|e|n|t| |s|y|n|t|a|x|.| +0#0000000&@32
+@57|1|9|,|1| @9|5|0|%|
diff --git a/runtime/syntax/testdir/dumps/progress_comments_02.dump b/runtime/syntax/testdir/dumps/progress_comments_02.dump
new file mode 100644
index 0000000..1967476
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/progress_comments_02.dump
@@ -0,0 +1,20 @@
+|/+0#0000e05#ffffff0@1| |T|h|i|s| |i|s| |t|h|e| |s|i|n|g|l|e|-|l|i|n|e| |c|o|m@1|e|n|t| |s|y|n|t|a|x|.| +0#0000000&@32
+@75
+|/+0#0000e05&@1|N|o| |s|p|a|c|e| |i|s| |r|e|q|u|i|r|e|d| |a|f|t|e|r| |t|h|e| |s|l|a|s|h|e|s|.| |A|l|s|o|,| |a| |/|*| |h|e|r|e| |d|o|e|s| |n|o|t| |b|e|g|i|n| |a| +0#0000000&
+|/+0#0000e05&@1|n|e|w| |b|l|o|c|k| |c|o|m@1|e|n|t|.| +0#0000000&@54
+@75
+>f+0#af5f00255&|o|r| +0#0000000&|e+0#af5f00255&|a|c|h| +0#0000000&|s|u|p@1|l|i|e|r| |n+0#af5f00255&|o|-|l|o|c|k|:| +0#0000000&@48
+@4|/+0#0000e05&|*| |H|o|w|e|v|e|r|,| |a| |b|l|o|c|k| |c|o|m@1|e|n|t| |c|a|n| |e|n|d| |i|n|s|i|d|e| |(|w|h|a|t| |l|o@1|k|s| |l|i|k|e|)| |a| +0#0000000&@8
+| +0#0000e05&@6|s|i|n|g|l|e|-|l|i|n|e| |c|o|m@1|e|n|t|,| |b|e|c|a|u|s|e| |t|h|e| |s|l|a|s|h|e|s| |a|r|e| |j|u|s|t| |t|e|x|t| |a|s| |f|a|r| |a|s| |t|h|e
+| @6|/@1| |b|l|o|c|k| |c|o|m@1|e|n|t| |i|s| |c|o|n|c|e|r|n|e|d|.| |*|/| +0#0000000&@34
+@4|d+0#af5f00255&|i|s|p|l|a|y| +0#0000000&|s|u|p@1|l|i|e|r|.+0#af5f00255&| +0#0000000&@53
+@75
+@4|/+0#0000e05&@1| |T+0#0000001#ffff4012|O|D|O|:+0#0000e05#ffffff0| |O|b|s|e|r|v|e| |t|h|a|t| |t+0#0000001#ffff4012|o|d|o| +0#0000e05#ffffff0|h|i|g|h|l|i|g|h|t|i|n|g| |w|o|r|k|s| |i|n| |l|i|n|e| |c|o|m@1|e|n|t|s| |t|o@1|.| +0#0000000&@3
+|e+0#af5f00255&|n|d|.| +0#0000000&@70
+@75
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|3|7|,|1| @9|B|o|t|
diff --git a/runtime/syntax/testdir/input/progress_comments.p b/runtime/syntax/testdir/input/progress_comments.p
index fc3f1cf..dd831fe 100644
--- a/runtime/syntax/testdir/input/progress_comments.p
+++ b/runtime/syntax/testdir/input/progress_comments.p
@@ -29,3 +29,17 @@
display customer_name.
+// This is the single-line comment syntax.
+
+//No space is required after the slashes. Also, a /* here does not begin a
+//new block comment.
+
+for each supplier no-lock:
+ /* However, a block comment can end inside (what looks like) a
+ single-line comment, because the slashes are just text as far as the
+ // block comment is concerned. */
+ display supplier.
+
+ // TODO: Observe that todo highlighting works in line comments too.
+end.
+