|
|
|
Re: Alternative Cross reference not working as expected [message #1005397 is a reply to message #1005386] |
Fri, 25 January 2013 08:56 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
HI,
>> TableOrSourceReference:
>> TableReference | =>SingleSourceReference
The parser willways parse this as SingleSourceReference (both are parsed
as ID thus the predicate always succeeds if the first path in the
alternative would succeed) since it does not know anything about cross
references. You'll have to rework your language in order to make a
proper decision.
Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 25.01.13 09:20, schrieb Ian Warwick:
> Hi All,
>
> I have a grammar that uses an alternative reference, I have pulled out
> the parts in question below
> https://github.com/robotoworks/mechanoid/blob/master/plugins/com.robotoworks.mechanoid.sqlite/src/com/robotoworks/mechanoid/sqlite/SqliteModel.xtext):
>
>
>
> SingleSource:
> {SingleSourceTable} tableReference=TableReference ('as' name=ID)? |
> {SingleSourceSelectStatement} '(' selectStatement=SelectStatement
> ')' ('as' name=ID)? |
> {SingleSourceJoin} '(' joinSource=JoinSource ')'
> ;
>
> TableOrSourceReference:
> TableReference | =>SingleSourceReference
> ;
>
> TableReference:
> table=[CreateTableStatement|ID]
> ;
>
> SingleSourceReference:
> source=[SingleSource|ID]
> ;
>
>
> ResultColumn:
> {ResultColumnAll} (reference=TableOrSourceReference '.')? '*' |
> {ResultColumnExpression} expression=SqlExpression ('as' name=ID)?
> ;
>
>
> The problem is when I use the grammar, it gives me proposals for both
> TableReference and SingleSourceReference for ResultColumn completion,
> but when I choose the path SingleSourceReference it gives me an error:
> Couldn't resolve reference to CreateTableStatement 'j':-
>
>
> select j.* from table3 as j
>
>
> But j should not be a CreateTableStatement reference, it should be a
> SingleSourceTable via the SingleSourceReference.
>
> However its ok if I use the table reference:-
>
>
> select table3.* from table3 as j
>
>
> Not sure what I am doing wrong here, any advice would be greatly
> appreciated!
|
|
|
|
Powered by
FUDForum. Page generated in 0.03439 seconds