1

I want to write a rule for the following

INTEGER X;
IF GIBBERISH THEN
    X = 10;
ELSE
    X = 15;
END;

In the above program I want to write a terminal rule for any character in GIBBERISH like code('Xfr) or ADEF==DCF+1 something like that.

I wrote a terminal rule

// GIBBERISH
terminal GIBBERISH: (.)* ;

And I got this error

The following token definitions can never be matched because prior tokens match the same 
input: RULE_ID,RULE_INT,RULE_STRING,RULE_ML_COMMENT,RULE_WS,RULE_ANY_OTHER

I also understand why this error message is being showed but anyways I want to override this.

mrprofessor
  • 101
  • 1
  • 10

1 Answers1

0

Just not extend your grammar from Terminals rule. Remove extend string from grammar head and all these terminals will be removed.