Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using until operator without consuming the last token
Using until operator without consuming the last token [message #1635382] Wed, 25 February 2015 19:27 Go to next message
Luis De Bello is currently offline Luis De BelloFriend
Messages: 95
Registered: January 2015
Member
Hi guys,

I am using the until token but I would like to get a different behaviour , my terminal is the following

terminal UNQUOTED_STRING:
!('$'|'&'|'*'|'#'|'{'|'}'|'['|']'|'%'|'^'|'='|'('|')'|'`'|'@'|' '|'\t') -> ('.'|'@('|')'|':'|','|'\r'|'\n'|']'|'}');

The idea is to consume unquoted string with spaces however the until operator consume the last token and I want to avoid that.

Do you know a way of doing this or any idea about how to solve this?

Regards,
Luis
Re: Using until operator without consuming the last token [message #1636421 is a reply to message #1635382] Thu, 26 February 2015 07:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13885
Registered: July 2009
Senior Member
HI,

i cannot answer this question but did you ever consider to use a "handmade" custom / external lexer?

Regards
Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 26 February 2015 07:17]

Report message to a moderator

Re: Using until operator without consuming the last token [message #1636848 is a reply to message #1636421] Thu, 26 February 2015 12:03 Go to previous messageGo to next message
Luis De Bello is currently offline Luis De BelloFriend
Messages: 95
Registered: January 2015
Member
Hi Christian,

Currently I am using Xtext to generate the lexer and parser and then I am doing some "hacks" in order to achieve the grammar that I want, anyway I always try to use text before customise my lexer.

Reards,
Luis
Re: Using until operator without consuming the last token [message #1636944 is a reply to message #1636848] Thu, 26 February 2015 13:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13885
Registered: July 2009
Senior Member
another question: does it have to be a terminal? maybe a Dataype Rule + A rule for alpabetic chars that are not in ID may help as well

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Using until operator without consuming the last token [message #1647600 is a reply to message #1636944] Tue, 03 March 2015 14:12 Go to previous message
Luis De Bello is currently offline Luis De BelloFriend
Messages: 95
Registered: January 2015
Member
Hi Christian,

I was able to solve my problem changing my terminal

Original version:
terminal UNQUOTED_STRING:
!('$'|'&'|'*'|'#'|'{'|'}'|'['|']'|'%'|'^'|'='|'('|')'|'`'|'@'|' '|'\t') -> ('.'|'@('|')'|':'|','|'\r'|'\n'|']'|'}');

New version:
terminal UNQUOTED_STRING:
!('$'|'&'|'*'|'#'|'{'|'}'|'['|']'|'%'|'^'|'='|'('|')'|'`'|'@'|' '|'\t') !('.'|'@('|')'|':'|','|'\r'|'\n'|']'|'}')*;
Previous Topic:Supporting unquoted string with spaces
Next Topic:SAXParseException on running Maven build for test that builds an Xtext model
Goto Forum:
  


Current Time: Sun Apr 18 22:25:38 GMT 2021

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

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

Back to the top