Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » ParseHelper accepts illegal input
ParseHelper accepts illegal input [message #1742997] Fri, 09 September 2016 08:56 Go to next message
Klaus Schulz is currently offline Klaus SchulzFriend
Messages: 2
Registered: September 2016
Junior Member
I have a simple grammar like this:

generate ruledsl ""

	rules += Rule*;
	rule = 'Rule' '{' subrule += Subrule*  '}'

Subrule: fieldA=ID opName=Operator fieldB=INT;
	'<' | '<=' | '=' | '>=' | '>' 

If I test this language with the generated Eclipse PlugIn, everything is fine.

However, I want to unit test my DSL and therefore I tried this:
class RuledslParsingTest{

	ParseHelper<Model> parseHelper

	def void loadModel() {
		val result = parseHelper.parse('''
			Rule {
				field1 > 5
				field3 = test5

Why does the parseHelper accept this illegal input? 'test5' is clearly not a legal value for fieldB?

[Updated on: Fri, 09 September 2016 21:16]

Report message to a moderator

Re: ParseHelper accepts illegal input [message #1743039 is a reply to message #1742997] Fri, 09 September 2016 19:51 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13879
Registered: July 2009
Senior Member
You an ask the result for its eResource and the Resource for its errors to get parse errors. you may have a look at ValidationTestHelper as well.

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:Hiding Toggle Mark Occurrences icon in the coolbar
Next Topic:Help with grammar
Goto Forum:

Current Time: Mon Apr 12 11:59:05 GMT 2021

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

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

Back to the top