ebnf2 is not supported for CrossReference [message #655193] |
Fri, 18 February 2011 15:41 |
Rafael Angarita Messages: 94 Registered: November 2010 |
Member |
|
|
Hello everybody, I am getting this error when I run the workflow for my languages:
ebnf2 is not supported for CrossReference
ebnf2 is not supported for CrossReference
warning(200): ../org.xtext.example.test.ui/src-gen/org/xtext/example/test/ui/contentassist/antlr/internal/InternalMyDslB.g:121:1: Decision can match input such as "EOF" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
warning(201): ../org.xtext.example.test.ui/src-gen/org/xtext/example/test/ui/contentassist/antlr/internal/InternalMyDslB.g:121:1: The following alternatives are unreachable: 2
This is my example grammar:
grammar org.xtext.example.test.MyDslA with org.eclipse.xtext.common.Terminals
generate myDslA "http://www.xtext.org/example/test/MyDslA"
Domain:
'Name' ':' name=ID
;
grammar org.xtext.example.test.MyDslC with org.eclipse.xtext.common.Terminals
generate myDslC "http://www.xtext.org/example/test/MyDslC"
CObject:
'Name' ':' name=ID
;
and,
grammar org.xtext.example.test.MyDslB with org.eclipse.xtext.common.Terminals
import "platform:/resource/org.xtext.example.test/src-gen/org/xtext/example/test/MyDslA.ecore" as mydsla
import "platform:/resource/org.xtext.example.test/src-gen/org/xtext/example/test/MyDslC.ecore" as mydslc
generate myDslB "http://www.xtext.org/example/test/MyDslB"
Attribute:
'Name :' name=ID
'AorC : ' aorc=AorC
;
AorC:
name=([mydsla::Domain]|[mydslc::CObject])
;
As you can see, I must have a property which can be one of the two types: MyDslA or MyDslC, but I am getting the error showed before.
However, even if I fix this, there is going to be another problem: I should let the user name MyDslA and MyDslC objects however he wants, so there is the possibility of two of this objects having the same name. So I think the grammar would not know which object should choose if there is a MyDslA object with the same name of a MyDslC object.
I would appreciate any help or advise for helping me to solve this case.
Thank you very much!!!
|
|
|
|
Re: ebnf2 is not supported for CrossReference [message #655327 is a reply to message #655193] |
Sat, 19 February 2011 12:23 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi Rafael,
your grammar could be rewritten as
AorC: name=[mydsla::Domain] | name=[mydslc:CObject]
However, it is ambiguous in either case since the cross refernce will be
represented as an ID in the actual syntax which leads to AorC: ID | ID;
which cannot be resolved. You'll have to introduce a common super type
for Domain and CObject or use EObject and customized scoping rules
instead. Please note that a property "name" should probably be a string
and not a Domain or CObject.
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 18.02.11 16:41, schrieb Rafael Angarita:
> Hello everybody, I am getting this error when I run the workflow for my
> languages:
>
>
> ebnf2 is not supported for CrossReference
> ebnf2 is not supported for CrossReference
> warning(200):
> ../org.xtext.example.test.ui/src-gen/org/xtext/example/test/ ui/contentassist/antlr/internal/InternalMyDslB.g:121:1:
> Decision can match input such as "EOF" using multiple alternatives: 1, 2
> As a result, alternative(s) 2 were disabled for that input
> warning(201):
> ../org.xtext.example.test.ui/src-gen/org/xtext/example/test/ ui/contentassist/antlr/internal/InternalMyDslB.g:121:1:
> The following alternatives are unreachable: 2
>
>
> This is my example grammar:
>
>
> grammar org.xtext.example.test.MyDslA with
> org.eclipse.xtext.common.Terminals
>
> generate myDslA "http://www.xtext.org/example/test/MyDslA"
>
>
> Domain:
> 'Name' ':' name=ID
> ;
>
>
>
> grammar org.xtext.example.test.MyDslC with
> org.eclipse.xtext.common.Terminals
>
> generate myDslC "http://www.xtext.org/example/test/MyDslC"
>
>
> CObject:
> 'Name' ':' name=ID
> ;
>
>
>
> and,
>
>
> grammar org.xtext.example.test.MyDslB with
> org.eclipse.xtext.common.Terminals
> import
> " platform:/resource/org.xtext.example.test/src-gen/org/xtext/ example/test/MyDslA.ecore "
> as mydsla
> import
> " platform:/resource/org.xtext.example.test/src-gen/org/xtext/ example/test/MyDslC.ecore "
> as mydslc
> generate myDslB "http://www.xtext.org/example/test/MyDslB"
>
>
> Attribute:
> 'Name :' name=ID
> 'AorC : ' aorc=AorC
> ;
>
> AorC:
> name=([mydsla::Domain]|[mydslc::CObject])
> ;
>
>
> As you can see, I must have a property which can be one of the two
> types: MyDslA or MyDslC, but I am getting the error showed before.
>
> However, even if I fix this, there is going to be another problem: I
> should let the user name MyDslA and MyDslC objects however he wants, so
> there is the possibility of two of this objects having the same name. So
> I think the grammar would not know which object should choose if there
> is a MyDslA object with the same name of a MyDslC object.
>
> I would appreciate any help or advise for helping me to solve this case.
>
> Thank you very much!!!
>
>
>
>
>
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04018 seconds