Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » RPGLE - Keyword Parsing
RPGLE - Keyword Parsing [message #1792662] Fri, 20 July 2018 15:51 Go to next message
Christoff Erasmus is currently offline Christoff ErasmusFriend
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.

index.php/fa/33473/0/

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

Re: RPGLE - Keyword Parsing [message #1792664 is a reply to message #1792662] Fri, 20 July 2018 15:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12237
Registered: July 2009
Senior Member
did you consider to introduce datatyperules instead of rulecalls in assignments

.... someAttr=THINGY .....;

THINGY: 'A'|'B'|INT;

and it is not possible to assign primitives and objects to the same thing

=>

objectChild=SomeRulesThatProducesAnEObject | attrChild=INT


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: RPGLE - Keyword Parsing [message #1792682 is a reply to message #1792664] Sat, 21 July 2018 09:23 Go to previous messageGo to next message
Christoff Erasmus is currently offline Christoff ErasmusFriend
Messages: 32
Registered: December 2016
Member
Thanks for the feedback.

The changes allowed the grammar to "compile", updated code snippet.
index.php/fa/33476/0/

But... prompting in the ecplise runtime workspace is not working. As I would expect (or hoped).
When trying to prompt for the "yellow" highlighting Nothing happens.
index.php/fa/33477/0/

Request
1) Did I do the update to ControlDSL.xtext correctly?

2) Is the prompting and "issue" or is it the expected behavior, and it should be handled via code?

Thanks.

[Updated on: Sat, 21 July 2018 09:24]

Report message to a moderator

Re: RPGLE - Keyword Parsing [message #1792684 is a reply to message #1792682] Sat, 21 July 2018 09:47 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12237
Registered: July 2009
Senior Member
no i am not going to work with your actual grammar. i am just giving hints. if you question is about content assist:
you need to implement content assist for datatype rules yourself by overriding the complete_XXXX method in the proposal provider


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Help with recursive grammar
Next Topic:ClassNotFoundException org.eclipse.xtext.ui.guice.AbstractGuiceAwareExecutableExtensionFactory
Goto Forum:
  


Current Time: Sun Sep 23 12:50:52 GMT 2018

Powered by FUDForum. Page generated in 0.01791 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top