IrishCrf
IrishCrf

Reputation: 115

"the decision cannot distinguish between alternative(s) 1,2 for input..."

I'm currently modifying Natty and creating some rules for my own date format. Natty makes use of ANTLR v3.5.2

When I compile the code I'm getting this error:

com\joestelmach\natty\generated\DateParser.g:295:46: the decision cannot distinguish between alternative(s) 1,2 for input such as "WHITE_SPACE INT_10 TH WHITE_SPACE JANUARY COMMA WHITE_SPACE INT_00 INT_00 WHITE_SPACE INT_00 INT_00 EOF"

If I take a look the following rule is on line 295:

relaxed_day_of_week
  : (prefix WHITE_SPACE)? day_of_week COMMA? WHITE_SPACE? -> day_of_week
  ;

I looked at the ANTLR documentation and searched Stack Overflow as well and I can't find much information about this type of error. I'm assuming that it's due to some ambiguity in another rule that makes use of "relaxed_day_of_week"?

The rule that is calling the above rule is:

custom_date
  : relaxed_day_of_week WHITE_SPACE relaxed_day_of_month WHITE_SPACE relaxed_month (date_time_separator explicit_time_custom)? relaxed_year 
       -> ^(EXPLICIT_DATE relaxed_day_of_week relaxed_day_of_month relaxed_month relaxed_year (date_time_separator explicit_time_custom)?)
  ;

Can anyone explain the error for me and point me in the correct direction?

Thanks in advance

Upvotes: 0

Views: 49

Answers (0)

Related Questions