Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to get position of parsed token in input grammar
How to get position of parsed token in input grammar [message #804186] Wed, 22 February 2012 09:52 Go to next message
FJ  Stöver is currently offline FJ StöverFriend
Messages: 25
Registered: July 2011
Location: Aachen, Germany
Junior Member
After successful parsing I get the IParseResult object; then I would like to get the start index of a parsed token in the original input stream. (I have to output the string in front of my token). Is that possible?
Re: How to get position of parsed token in input grammar [message #804215 is a reply to message #804186] Wed, 22 February 2012 10:17 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Franz,

please use NodeModelUtils to obtain the node for a given semantic
element (or fetch the node from the parseresult directly) and use
#getOffset or #getTotalOffset depending on your usecase. The Javadoc
should be clear but if there are still questions left, feel free to ask.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 22.02.12 10:52, schrieb Franz-Josef t:
> After successful parsing I get the IParseResult object; then I would
> like to get the start index of a parsed token in the original input
> stream. (I have to output the string in front of my token). Is that
> possible?
Previous Topic:Cross-references with ambiguous use of period '.'
Next Topic:toEnumerationType not working
Goto Forum:
  


Current Time: Sat Apr 27 05:15:42 GMT 2024

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

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

Back to the top