Improved ParseHelper suggestion [message #891878] |
Tue, 26 June 2012 12:12 |
Vlad Dumitrescu 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
|
|
|
Powered by
FUDForum. Page generated in 0.03023 seconds