I have a rule which expects a STRING from the user. Currently when the user gives a keyword that I have defined in my grammar, parser gives a segmentation fault.
For ex :
sampleClause: calc! strName {##->setType(SAMPLE_CLAUSE);};
strName : STRING;
calc: "CALC" | "calc";
If the user enters calc/CALC as strName, parser throws Seg Fault. I am not sure how to avoid this.
EDIT: I also want to know how to avoid the parser giving a segmentation fault. This crashes my application which I do not want. I want to exit gracefully in these situations instead of seg fault.
P.S: I need the solution in ANTLR 2, as there is a dependency.