Skip to content

Commit

Permalink
Merge branch 'master' of github.com:barrettotte/vscode-ibmi-languages
Browse files Browse the repository at this point in the history
  • Loading branch information
barrettotte committed Apr 13, 2023
2 parents 92a2942 + 28d8f23 commit ffcd23f
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 19 deletions.
102 changes: 84 additions & 18 deletions syntaxes/rpgle.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"freeidentifiers": {
"patterns": [
{
"name": "rpgle.free.definition.identifier",
"name": "variable.other.rpgle.free.definition.identifier",
"begin": "[a-zA-Z_][a-zA-Z0-9_]*",
"end": "(?=\n)",
"patterns": [
Expand Down Expand Up @@ -249,6 +249,9 @@
{
"include": "#freedefkeywords"
},
{
"include": "#freeidentifiers"
},
{
"include": "#rpglecommon"
}
Expand Down Expand Up @@ -277,7 +280,7 @@
"end": "(?i)(?=((\\/END-FREE\\b)))",
"patterns": [
{
"name": "keyword.other.rpgle.precompiler",
"name": "keyword.control.rpgle.precompiler",
"match": "(?i)^.*(\\/FREE\\b)"
},
{
Expand All @@ -292,7 +295,7 @@
]
},
{
"name": "keyword.other.rpgle.precompiler",
"name": "keyword.control.rpgle.precompiler",
"match": "^.*(\\/END-FREE\\b)"
}
]
Expand Down Expand Up @@ -716,8 +719,12 @@
"precompiler": {
"patterns": [
{
"name": "keyword.other.rpgle.fixed.precompiler.title",
"begin": "(?i)(?<=^.{5})(H|\\s)[\\/](TITLE)",
"name": "rpgle.fixed.precompiler.title",
"begin": "(?i)(?<=^.{5})(H|F|D|I|C|O|P|\\s)(\\/TITLE)",
"beginCaptures": {
"1": { "name": "keyword.other.rpgle.fixed.precompiler.title" },
"2": { "name": "keyword.control.rpgle.fixed.precompiler.title" }
},
"end": "\n",
"patterns": [
{
Expand All @@ -726,9 +733,12 @@
}
]
},
{
"name": "keyword.other.rpgle.fixed.precompiler.title",
"begin": "(?i)^(\\s)*(C)?(\\s)*[\\/](TITLE)",
{
"name": "rpgle.free.precompiler.title",
"begin": "(?i)^\\s*(\\/TITLE)",
"beginCaptures": {
"1": { "name": "keyword.control.rpgle.free.precompiler.title" }
},
"end": "\n",
"patterns": [
{
Expand All @@ -738,9 +748,13 @@
]
},
{
"name": "keyword.other.rpgle.fixed.precompiler.include",
"begin": "(?i)^(\\s)*([C|D])?(\\s)*[\\/](INCLUDE|COPY|EJECT)\\s",
"name": "rpgle.fixed.precompiler.include",
"begin": "(?i)(?<=^.{5})(H|F|D|I|C|O|P|\\s)(\\/(INCLUDE|COPY))\\s",
"end": "\n",
"beginCaptures": {
"1": { "name": "keyword.other.rpgle.fixed.precompiler.include" },
"2": { "name": "keyword.control.rpgle.fixed.precompiler.include" }
},
"patterns": [
{
"name": "string.other.rpgle.precompiler.include",
Expand All @@ -754,12 +768,41 @@
]
},
{
"name": "rpgle.precompiler.conditional",
"name": "rpgle.free.precompiler.include",
"begin": "(?i)^\\s*(\\/(INCLUDE|COPY))\\s+(\\S+)(.*)",
"end": "\n",
"beginCaptures": {
"1": { "name": "keyword.control.rpgle.free.precompiler.include" },
"3": { "name": "string.other.rpgle.precompiler.include" },
"4": { "name": "comment.other.rpgle.precompiler.include" }
}
},
{
"name": "rpgle.fixed.precompiler.conditional",
"begin": "(?i)(?<=^.{5})(H|F|D|I|C|O|P|\\s)(\\/(ELSEIF|IF))\\b(NOT|UNDEFINED|DEFINED)\\b(.*)",
"beginCaptures": {
"1": { "name": "keyword.other.rpgle.fixed.precompiler.conditional" },
"2": { "name": "keyword.control.rpgle.fixed.precompiler.conditional" },
"3": { "name": "keyword.other.rpgle.fixed.precompiler.defcheck" }
},
"end": "(?i)(?=^.{5})(H|F|D|I|C|O|P|\\s)(\\/ENDIF))",
"endCaptures": {
"1": { "name": "keyword.other.rpgle.fixed.precompiler.conditional" },
"2": { "name": "keyword.control.rpgle.fixed.precompiler.conditional" }
},
"patterns": [
{
"include": "#fixedformat"
}
]
},
{
"name": "rpgle.free.precompiler.conditional",
"begin": "(?i)(?=(^[\\s]*\\/IF))",
"end": "(?i)(?=(^[\\s]*\\/ENDIF))",
"patterns": [
{
"name": "keyword.other.rpgle.precompiler.if",
"name": "keyword.control.rpgle.precompiler.if",
"match": "(?i)^[\\s]*\\/(ELSEIF|IF)"
},
{
Expand All @@ -780,7 +823,7 @@
"end": "\n",
"patterns": [
{
"name": "keyword.other.rpgle.precompiler.charcount",
"name": "keyword.control.rpgle.precompiler.charcount",
"match": "(?i)^[\\s]*\\/CHARCOUNT"
},
{
Expand All @@ -790,11 +833,30 @@
]
},
{
"name": "keyword.other.rpgle.fixed.precompiler.misc",
"match": "(?i)^[\\s]*[\\/](UNDEFINE|TITLE|SPACE|INCLUDE|FREE|EOF|ENDIF|END-FREE|ELSE|EJECT|DEFINE|COPY|CHARCOUNT)\\b",
"name": "rpgle.fixed.precompiler.misc",
"begin": "(?i)(?<=^.{5})(H|F|D|I|C|O|P|\\s)(\\/(UNDEFINE|SPACE|FREE|EOF|END-FREE|ELSE|EJECT|DEFINE|CHARCOUNT))\\b",
"beginCaptures": {
"1": { "name": "keyword.other.rpgle.fixed.precompiler.misc" },
"2": { "name": "keyword.control.rpgle.fixed.precompiler.misc" }
},
"end": "\n",
"patterns": [
{
"name": "keyword.control.rpgle.precompiler",
"match": ".*"
}
]
},
{
"name": "rpgle.free.precompiler.misc",
"begin": "(?i)^[\\s]*(\\/(UNDEFINE|TITLE|SPACE|INCLUDE|FREE|EOF|ENDIF|END-FREE|ELSE|EJECT|DEFINE|COPY|CHARCOUNT))\\b",
"beginCaptures": {
"1": { "name": "keyword.control.rpgle.free.precompiler.misc" }
},
"end": "\n",
"patterns": [
{
"name": "keyword.other.rpgle.precompiler",
"name": "keyword.control.rpgle.precompiler",
"match": ".*"
}
]
Expand All @@ -803,12 +865,16 @@
},
"keywords": {
"patterns": [
{
"name": "keyword.operator.rpgle",
"match": "\\*{1,2}(=)?|=|<>|((<|>|\\+|\\-|\\/)(=)?)"
},
{
"name": "keyword.other.rpgle",
"match": ":|\\.|\\,|\\*{1,2}(=)?|=|<>|((<|>|\\+|\\-|\\/)(=)?)|((\\b(?i)(TO|BY|DOWNTO|AND|IN|OR|NOT)\\b))"
"match": ":|\\.|\\,|((\\b(?i)(TO|BY|DOWNTO|IN|AND|OR|NOT)\\b))"
},
{
"name": "keyword.other.rpgle.bif",
"name": "support.function.rpgle.bif",
"match": "[%](?i)(YEARS|XML|XLATE|XFOOT|UPPER|UNSH|UNS|UCS2|TRIMR|TRIML|TRIM|TLOOKUPLT|TLOOKUPLE|TLOOKUPGT|TLOOKUPGE|TLOOKUP|TIMESTAMP|TIME|THIS|TARGET|SUBST|SUBDT|SUBARR|STR|STATUS|SQRT|SPLIT|SIZE|SHTDN|SECONDS|SCANRPL|SCANR|SCAN|REPLACE|REM|REALLOC|RANGE|PROC|PASSED|PARSER|PARMNUM|PARMS|PADDR|OPEN|OMITTED|OCCUR|NULLIND|MSG|MSECONDS|MONTHS|MINUTES|MINARR|MIN|MAXARR|MAX|LOWER|LOOKUPLT|LOOKUPLE|LOOKUPGT|LOOKUPGE|LOOKUP|LIST|LEN|KDS|INTH|INT|HOURS|HANDLER|GRAPH|FOUND|FLOAT|FIELDS|ERROR|EQUAL|EOF|ELEM|EDITW|EDITFLT|EDITC|DIV|DIFF|DECPOS|DECH|DEC|DAYS|DATE|DATA|CONCATARR|CONCAT|CHECKR|CHECK|CHARCOUNT|CHAR|BITXOR|BITOR|BITNOT|BITAND|ALLOC|ADDR|ABS)"
}
]
Expand Down
35 changes: 35 additions & 0 deletions tests/general/test-fixed.rpgle
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,38 @@
PMYPROC E p spec - end procedure
*
/EJECT

* Test /TITLE for all line line types

H/title title text
F/title title text
I/title title text
D/title title text
C/title title text
O/title title text
P/title title text
/title title text

* Test /EJECT for all line line types

H/eject
F/eject
I/eject
D/eject
C/eject
O/eject
P/eject
/eject

* Test /IF and /ENDIF

H/if defined something
H DECFMT('J')
H/endif

* Test /COPY and /INCLUDE

H/copy lib/file.member
H/include lib/file.member


13 changes: 12 additions & 1 deletion tests/general/test-free.rpgle
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,17 @@ END-DS address;


**free
/copy mpkcorsrc,pr_f3gtrtd
/copy mpkcorsrc,pr_f3gtrtd // comment
dcl-s RLBERRCNT packed(3); // issue #19
dcl-s i like(RLBERRCNT);

/charcount STDCHARSIZE

for x = 1 to 10 by 5;
endfor;

for y in %list( 'a' : 'b' : 'c');
endfor;

if (a < b) and (c > d);
endif;

0 comments on commit ffcd23f

Please sign in to comment.