RPGLE - Keyword Parsing [message #1792662] |
Fri, 20 July 2018 15:51 |
Christoff Erasmus Messages: 32 Registered: December 2016 |
Member |
|
|
Hello.
Intention:
I would like to write a case insensitive grammar that is able to parse Control-Specification Keywords as defined by IBMs website.
BUT... I am having difficulties correctly defining the CCSID control option as defined by IBM. Refer screenshot.
Example Code to Parse
CTL-OPT
CCSID(*EXACT)
// *CHAR
CCSID( *char : *JOBRUN ) CCSID(*CHAR :*JOBRUNMIX)
CCSID(*CHAR:*UtF8)
CCSID(*CHAR:*Hex)
CCSID(*CHAR:1234)
;
// *GRAPH
CTL-OPT CCSID(*GRAPH:*JOBRUN);
CTL-OPT CCSID(*GRAPH:*SRC);
CCSID(*GRAPH:*HEX);
CTL-OPT CCSID(*GRAPH:*IGNORE);
CTL-OPT CCSID(*GRAPH:9876);
// *UCS2
CTL-OPT CCSID(*UCS2 : *UTF16);
CTL-OPT CCSID(*UCS2:1122);
GitHub - Repo:
My initial attempt at creating the grammar able to parse the code above is located at the example-ControlOptionDSL repository.
Request:
Please help update the grammar to be able parse the code snippet above. The issue is with the ControlOptionCCSID rule not being correctly defined. :(
Alternative Suggestion:
Alternative to way to define the Control Options might be to go with a super simple Generic Rule, and then do all the validation/suggestions manually.
Control:
'CTL-OPT' keywords+=(GenericKeyword)+ ';'
;
GenericKeyword:
name=ID ('('
params+=GenericKeywordParms (':' params+=GenericKeywordParms)*
')')?
;
GenericKeywordParms:
SPLAT_OPERATOR|STRING||ID|INT
;
terminal SPLAT_OPERATOR: ('*')('a'..'z'|'A'..'Z') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
Thanks. :)
[Updated on: Fri, 20 July 2018 15:53] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03020 seconds