Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using Xtext reserved wording withing DSL
Using Xtext reserved wording withing DSL [message #1792933] Thu, 26 July 2018 07:22 Go to next message
Christoff Erasmus is currently offline Christoff ErasmusFriend
Messages: 32
Registered: December 2016
Member
Hello.

Hoping for some advice please.

Currently I am trying to write rules to deal with "Compiler Directives" as defined here.

The basic layout is:
Quote:

'/' directive (directive_options)?


My one of my initial attempts:
>>Insert Screenshot of Grammar Snippet<<<
Quote:

CompilerDirectiveTITLE:
'/TITLE' name=ID
;
CompilerDirectiveEJECT:
{CompilerDirectiveEJECT}
'/EJECT'
;
CompilerDirectiveDEFINE:
'/DEFINE' name=ID
;
CompilerDirectiveUNDEFINE:
'/UNDEFINE' name=ID
;
CompilerDirectiveEOF:
{CompilerDirectiveEOF}
'/EOF'
;


The issue::
When trying to specify the "EOF" directive, the grammer does not compile.
>>>Insert Screenshot of EOF directive<<<
CompilerDirectiveEOF:
	{CompilerDirectiveEOF}
	'/EOF'
;


>>>Insert Screenshot of MWE2 Error<<<
Parser.g:104:3: The following alternatives can never be matched: 2


Request:
Is it possible to have '/EOF' in the DSL?

EDIT:
Seems that Images are not being uploaded. Replaced with code snippet.

[Updated on: Thu, 26 July 2018 07:32]

Report message to a moderator

Re: Using Xtext reserved wording withing DSL [message #1792935 is a reply to message #1792933] Thu, 26 July 2018 07:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12229
Registered: July 2009
Senior Member
hi, please provide a minimal grammar and testmodel showing your problem

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Using Xtext reserved wording withing DSL [message #1792936 is a reply to message #1792935] Thu, 26 July 2018 07:34 Go to previous messageGo to next message
Christoff Erasmus is currently offline Christoff ErasmusFriend
Messages: 32
Registered: December 2016
Member
Christian Dietrich wrote on Thu, 26 July 2018 07:27
hi, please provide a minimal grammar and testmodel showing your problem


Done, please refer to the first post.
Edits made, as screenshots did not upload during initial post.
Re: Using Xtext reserved wording withing DSL [message #1792938 is a reply to message #1792936] Thu, 26 July 2018 07:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12229
Registered: July 2009
Senior Member
i want i minimal grammar i can simply c&p & run.

the grammar

CompilerDirectiveEOF:
	{CompilerDirectiveEOF}
	'/EOF'
;

works fine


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Using Xtext reserved wording withing DSL [message #1792946 is a reply to message #1792938] Thu, 26 July 2018 09:28 Go to previous messageGo to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 236
Registered: June 2013
Senior Member
isn't it just that (according to the PNG: "CompilerDirectiveEOF hidden():")

there is a hidden() which is not mentioned in this conversation so far?
Re: Using Xtext reserved wording withing DSL [message #1792958 is a reply to message #1792946] Thu, 26 July 2018 13:46 Go to previous messageGo to next message
Christoff Erasmus is currently offline Christoff ErasmusFriend
Messages: 32
Registered: December 2016
Member
Thanks for the responses.

It seems that the problem is related to making the DSL case insensitive. By adding the "ignoreCase = true" to the parseGenerator.

		language = StandardLanguage {
			name = "org.xtext.example.directivedsl.DirectiveDSL"
			fileExtensions = "dirdsl"

			serializer = {
				generateStub = false
			}
			validator = {
				// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
			}
			junitSupport = {
				junitVersion = "5"
			}
			parserGenerator = {
//				debugGrammar = true
				options = {
					ignoreCase = true
				}
			}
//			scopeProvider = {
//				ignoreCase = true
//			}
		}



I created a temp GitHub repo for the language.
To for easier C&C (or Clone) and running.
Quote:

https://github.com/zs6jce/example-DirectiveDSL
Re: Using Xtext reserved wording withing DSL [message #1792962 is a reply to message #1792958] Thu, 26 July 2018 14:43 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12229
Registered: July 2009
Senior Member
created https://github.com/eclipse/xtext-core/issues/804

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Whitespace without newlines
Next Topic:Access all Resources in Eclipse(Xtext) Project
Goto Forum:
  


Current Time: Wed Sep 19 03:49:10 GMT 2018

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

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

Back to the top