|
|
|
|
|
|
|
|
|
|
|
|
Re: a problem in syntactic predicate [message #722457 is a reply to message #721197] |
Mon, 05 September 2011 20:12 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi Lulu,
the reference documentation contains a section on syntactic predicates:
http://www.eclipse.org/Xtext/documentation/2_0_0/020-grammar-language.php#syntax
I'm afraid there is not more information available.
The predicate guards the element that is .. well .. predicated. That is,
if you use it for a group =>(e ';'), the parser will look for an e
followed by a ';', if you use it only for the =>e, the following ';'
will not be considered for the decision. Does that make sense to you?
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
On 01.09.11 09:18, lulu wrote:
> Hi, All,
> There has a problem while practice syntactic predicate.
>
> xtext grammar like this:
> ----- begin -------
> a:
> => e ';' | e '.'
> ;
>
> e: => '(' ID ')' ID //type cast
> | '(' ID ')' //nest expression
> | ID
> ;
>
> terminal ID: ('a'..'z')+;
> ----------- end ----------
>
> while run as eclipse application, it occur some mistake in .dsl file.
>
>
> But after I add brace in syntactic predicate. grammar show as follow:
> ----- begin -------
> a:
> => ( e ';' )
> | e '.'
> ;
>
> e: => ( '(' ID ')' ID ) //type cast
> | '(' ID ')' //nest expression
> | ID
> ;
>
> terminal ID: ('a'..'z')+;
> ----------- end ----------
>
> It is run correctly which can match follow pattern:
> test.
> (test).
> (test)test.
> test;
> (test);
> (test)test;
>
> I did not find any detail description in syntactic predicate about Xtext.
>
> Thanks.
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03869 seconds