Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Parameterised Terminals?
Parameterised Terminals? [message #1019467] Fri, 15 March 2013 18:53 Go to next message
Paul Noffke is currently offline Paul NoffkeFriend
Messages: 3
Registered: March 2013
Junior Member
I'm developing a templating language similar to "Template Language" in the 7 languages part of the Xtext docs. I'm using curly braces instead of french quotes to enter "expression mode", which works well in most situations.

But, because {} are integral to JSON, I'm needing to allow the user to select a different pair of characters when editing these files.

And so my question is:

1. Is there anyway of parametering my grammar to use the user's preference instead of:

terminal TEXT : '}' (!'{')* (EOF|'{');

2. Or is it possible to configure the document partitioner to apply different Xtext grammars to the different regions within the document.

Any assistance appreciated.

Regards
Paul
Re: Parameterised Terminals? [message #1021300 is a reply to message #1019467] Tue, 19 March 2013 20:46 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Couldn't you jsut add an alternative pair of terminals and let the user
just choose between the two without any further preferences?

Sven

Am 3/18/13 7:12 PM, schrieb Paul Noffke:
> I'm developing a templating language similar to "Template Language" in
> the 7 languages part of the Xtext docs. I'm using curly braces instead
> of french quotes to enter "expression mode", which works well in most
> situations.
>
> But, because {} are integral to JSON, I'm needing to allow the user to
> select a different pair of characters when editing these files.
>
> And so my question is:
>
> 1. Is there anyway of parametering my grammar to use the user's
> preference instead of:
>
> terminal TEXT : '}' (!'{')* (EOF|'{');
>
> 2. Or is it possible to configure the document partitioner to apply
> different Xtext grammars to the different regions within the document.
>
> Any assistance appreciated.
>
> Regards
> Paul


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: Parameterised Terminals? [message #1021562 is a reply to message #1021300] Wed, 20 March 2013 10:15 Go to previous message
Paul Noffke is currently offline Paul NoffkeFriend
Messages: 3
Registered: March 2013
Junior Member
Hmmm, so if I added percents (%%) as the alternative, then I don't think this JSON would parse correctly:

{ field1: %expression1%, field2: "value" }

Problem being that it would enter expression mode when it encountered the 1st {. Or am I missing something?

Regards
Paul
Previous Topic:Query the model of a Document
Next Topic:How to build a symbol table to be used within ScopeProvider and Validator?
Goto Forum:
  


Current Time: Wed Aug 05 19:59:23 GMT 2020

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

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

Back to the top