xtext - Why does the error method return an error? -
i want validate input corresponding following grammar snippet:
declaration: name = id "=" brcon=bracketcontent ; bracketcontent: deccon=deccontent (comp+=comparator content+=deccontent)* ; deccontent: (neg=("!"|"not"))? singlecontent=varcontent (op+=operator nextcon+=varcontent)* ;
my validation looks that:
@check def checknocycleinhierarchy(declaration dec) { if(dec.deccon.singlecontent.reference == null) { return } var names = newarraylist var con = dec.deccon.singlecontent while(con.reference != null) { con = getthatreference(con).singlecontent if(names.contains(getparentname(con))) { val errormsg = "cycle in hierarchy!" error(errormsg, sqfpackage.einstance.bracketcontent_deccon, cycle_in_hierarchy) return } names.add(getparentname(con)) } }
but when test validation testcaseit returns me error message:
expected error 'raven.sqf.cycleinhierarchy' on declaration @ [-1:-1] got error (org.eclipse.emf.ecore.impl.eclassimpl@5a7fe64f (name: declaration) (instanceclassname: null) (abstract: false, interface: false).0) 'error executing evalidator', offset null, length null error (org.eclipse.emf.ecore.impl.eclassimpl@5a7fe64f (name: declaration) (instanceclassname: null) (abstract: false, interface: false).0) 'error executing evalidator', offset null, length null
i can't figure out what's wrong hope of might have idea.
greetings krzmbrzl
you test utility tells validator did not produce expected validation error ("cycleinhierarchy"). instead, validator produced error "error executing evalidator". means exception has been thrown when validator executed.
Comments
Post a Comment