Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Issue with whitespace characters(Issue with whitespace characters)
Issue with whitespace characters [message #693362] Wed, 06 July 2011 10:24 Go to next message
Nithin Joshua is currently offline Nithin JoshuaFriend
Messages: 3
Registered: July 2011
Junior Member
Hi,

I want to recognize a grammar of this sort
repeatpostparam `ID - Statement 1
postparam `ID - Statement 2
record `ID - Statement 3
Condition is that only one statement can be in one line and a statement cannot be in 2 lines.

I am using eclipse xtext 1.0.0.

My Grammar is like this
grammar nithin.custom.Ndsl with org.eclipse.xtext.common.Terminals
hidden(WHITESPACE)

Model :
(input+=INPUT)*
;
INPUT:
INPUT_PARAMS
;
INPUT_PARAMS :
ret=RETURN |
RECORD_PARAMS
;
RECORD_PARAMS:
'record' '`' name=ID ret=RETURN
;
terminal RETURN:
('\r'? '\n')
;
terminal WHITESPACE:
(' '|'\t')+
;
Grammar is not able to recognize starting whitespaces:
[space]record `ID[return] and
record `ID[space][return].

Please help me
Thanks in advance


Re: Issue with whitespace characters [message #693438 is a reply to message #693362] Wed, 06 July 2011 13:25 Go to previous message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
You are using the common terminals which already have a rule for WS that
overlap with your new terminals.

- henrik

On 7/6/11 12:24 PM, Nithin Joshua wrote:
> Hi,
>
> I want to recognize a grammar of this sort
> repeatpostparam `ID - Statement 1
> postparam `ID - Statement 2
> record `ID - Statement 3
> Condition is that only one statement can be in one line and a statement
> cannot be in 2 lines.
>
> I am using eclipse xtext 1.0.0.
>
> My Grammar is like this
> grammar nithin.custom.Ndsl with org.eclipse.xtext.common.Terminals
> hidden(WHITESPACE)
>
> Model :
> (input+=INPUT)*
> ;
> INPUT:
> INPUT_PARAMS
> ;
> INPUT_PARAMS :
> ret=RETURN |
> RECORD_PARAMS
> ; RECORD_PARAMS:
> 'record' '`' name=ID ret=RETURN
> ;
> terminal RETURN:
> ('\r'? '\n')
> ;
> terminal WHITESPACE:
> (' '|'\t')+
> ;
> Grammar is not able to recognize starting whitespaces:
> [space]record `ID[return] and
> record `ID[space][return].
>
> Please help me
> Thanks in advance
>
>
Previous Topic:Integration of GMF with Xpand
Next Topic:IFoldingRegion
Goto Forum:
  


Current Time: Thu Oct 29 20:48:58 GMT 2020

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

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

Back to the top