Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Keywords getting noticed where they shouldn't
Keywords getting noticed where they shouldn't [message #1699566] Thu, 25 June 2015 07:47 Go to next message
Anton Bergman is currently offline Anton BergmanFriend
Messages: 34
Registered: June 2015
Member
So I have this grammar:

http://pastebin.com/z7VNwLJA

My problem is that when I for example want to write

 Bob -> Alice : create a new relation


when running my DSL,

It somehow picks up on the "create" keyword from the

ParticipantCreation:
        'create' ID
;
rule.

How would I go about preventing this?

Thanks!

[Updated on: Thu, 25 June 2015 07:47]

Report message to a moderator

Re: Keywords getting noticed where they shouldn't [message #1699575 is a reply to message #1699566] Thu, 25 June 2015 08:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
am not sure if i understand your problem. where is your crossRef

yyy=[YYY] is short for yyy=[YYY|ID]
ID does not allow keywords.

introduce a datatyperule

MyID: ID | "keyword";
yyy=[YYY|MyID]

or

zzz=MyID


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Keywords getting noticed where they shouldn't [message #1699579 is a reply to message #1699575] Thu, 25 June 2015 08:38 Go to previous messageGo to next message
Anton Bergman is currently offline Anton BergmanFriend
Messages: 34
Registered: June 2015
Member
I might have used the wrong vocabulary. What I ment was this:

I want to be able to write
Alice -> Bob : 

Followed by any number of characters. As such:
Alice -> Bob : any number of characters


But as soon as I put a word that is being used in any other rule, like 'create' from the

ParticipantCreation:
	'create' ID
;
rule or 'hide' from the

Hidefootbox:
	'hide' 'footbox'
;
rule, I am getting an error from my editor, like so:

This works:
http://i.imgur.com/vqcbb2m.png

While this does not:

http://i.imgur.com/7MaYHdn.png

Re: Keywords getting noticed where they shouldn't [message #1699604 is a reply to message #1699579] Thu, 25 June 2015 10:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
and where is the grammar for this has create in it

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Keywords getting noticed where they shouldn't [message #1699611 is a reply to message #1699604] Thu, 25 June 2015 10:56 Go to previous messageGo to next message
Anton Bergman is currently offline Anton BergmanFriend
Messages: 34
Registered: June 2015
Member
Oh right, forgot to update the pastebin. Doh!

This is the updated one: http://pastebin.com/3KXNgBJ6

With the rule

Arrow:
        name+=ID SEQUENCE name+=ID (':' (ID)*)?
;


and related terminal:
terminal SEQUENCE : '->'
Re: Keywords getting noticed where they shouldn't [message #1699613 is a reply to message #1699611] Thu, 25 June 2015 11:00 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
as said

Arrow:
name+=ID SEQUENCE name+=MyID (':' (name+=MyID)*)?
;


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 25 June 2015 11:00]

Report message to a moderator

Previous Topic:How to pass a function as a parameter in Xtend?
Next Topic:import declaration does not work
Goto Forum:
  


Current Time: Tue Mar 19 14:05:56 GMT 2024

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

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

Back to the top