Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Single quote ambiguity
Single quote ambiguity [message #756450] Sun, 13 November 2011 13:22 Go to next message
Mahmoud Moneeb is currently offline Mahmoud MoneebFriend
Messages: 15
Registered: October 2011
Junior Member

I want to declare a grammar rule:

Test_rule: ID '\'' ID ';'

But it's not working because of the terminal STRING.

I want to ask how can get the two rules working properly !

Best regards,
Re: Single quote ambiguity [message #756461 is a reply to message #756450] Sun, 13 November 2011 16:42 Go to previous message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member

do you need single quotes anywhere else in the grammar? If you do not use them as String delimiters, simply copy the STRING rule from the default terminal grammar and eliminate the single quote alternative.

If you need single quotes for the string terminal, you will have a harder time. As terminal rules are considered during lexing (chopping the documents into tokens without any context information) and data type rules (like your Test_rule) are considered during parsing. Usually it is not a good idea to introduce too many terminal rules as that increases the risk of overlapping terminals with all its consequences. If white spaces are not allowed in Test_rule (i.e. ab ' cd is invalid; currently white spaces would be allowed) it might work simply to turn Testrule into a terminal.

Previous Topic:How to write Language Intellesense
Next Topic:Passing Arguments
Goto Forum:

Current Time: Sat Mar 06 03:25:13 GMT 2021

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

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

Back to the top