Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Improved ParseHelper suggestion
Improved ParseHelper suggestion [message #891878] Tue, 26 June 2012 12:12
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
Hi,

I found it much easier to write unit tests with an wrapper around ParseHelper, where I can add markers in the source code and refer to the objects at that location.

In my simple implementation I can write
parser.parse("some §code here §and here")
where '§' is the marker, and the result is a pair (parsed code, list of marker offsets). Then a helper method helps retrieve the objects at each offset, with help from NodeModelUtils.findLeafNodeAtOffset.

I thought I'd mention it because it might be useful enough to include something like that in the Xtext junit support. I can of course provide code, but it's simple enough that getting through the IP validation process is overkill.

best regards,
Vlad
Previous Topic:Linking with custom bind algorithm
Next Topic:Grammar causing outofmemory error
Goto Forum:
  


Current Time: Thu Apr 25 13:52:06 GMT 2024

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

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

Back to the top