I have this kind of a grammar,
locationPath returns [CustomParser xpathParser]
:^(LOCATION_PATH relativeLocationPath {**Want to throw a exception if this condition matches**})
|^(LOCATION_PATH absoluteLocationPath {$xpathParser=$absoluteLocationPath.xpathParser;})
;
What is the way to do it? I tried with this one
locationPath returns [CustomParser xpathParser]
:^(LOCATION_PATH relativeLocationPath {throw new Exception})
|^(LOCATION_PATH absoluteLocationPath {$xpathParser=$absoluteLocationPath.xpathParser;})
But with this one the generated code gives compile Error. Because that method loactionapth doesn't have throws clues at method signature.