Re: [Flex-help] Diagnostic Message: unrecognized rule
flex is a tool for generating scanners
Brought to you by:
wlestes
From: slipbits <ho...@sl...> - 2023-06-08 21:01:31
|
Found the error. A missing rule closure, missing '}'. I found it by successively removing code/rules until the error disappeared. A decidedly crude approach. This effort would have been made somewhat easier if the start line became part of the error message. In that way I could start my search at the point where the rule was being evaluated. Given the end line is deceptive since the end line, in this case, is the end of the program. Not knowing the rule being evaluated when the error was found, means that I have to begin this search at the start of the rules section ('%%') and continue until the end of the rules section, (%%'). Is there any chance that a future version of the software could output the start line rather than the end line of all errors? thanks On 6/8/2023 9:58 AM, Arthur Schwarz wrote: > Flex v2.6.4 > Bison v3.8.2 > Win 7/11-x64 > > I am updating my Flex file from 2013 and integrating it with the > latest Bison. When I ran flex two 'unrecognized rule' errors were > generated. I've looked at the Flex 2.6.0 manual pg. 104 and 120 in the > FAQ to see what the error is and how to locate the point of error but > they don't appear to apply. > > ERASEME57, pg. 104 says "flex can’t accommodate an action on a > separate line". > > unnamed-faq-90: pg. 120 says "You can’t use the ’/’ operator inside > parentheses". > > Neither of these two conditions seem to apply in my case. The error > message does provide a line number where the error was detected but > gives a line number at the end of rule processing, "slip.lex:464: > unrecognized rule". > > Is there any way of finding what 'rule' caused the error. I can't seem > to find what's wrong. > > My code begins on the same line as the rule, so ERASEME57 does not apply. > > The rules containing a '/' are not within a parenthesis, so > unnamed-faq-90 does not seem to apply. The rules are: > FOLLOW [,;:\(\)<>/{}|[:cntrl:]| ] > NAMEEND ([[:graph:]_\$]{-}[,;:\(\)<>/{}]) > "/*" { DEBUG(lexerDebugFlag, > printf("Lex: %3d:%4d /* BEGIN COMMENT %s\n", lineno, col, yytext);) > col++; > BEGIN(COMMENT); } > "//" { DEBUG(lexerDebugFlag, > printf("Lex: %3d:%4d EOL COMMENT %s\n", lineno, col, yytext);) col++; > BEGIN(EOLCOMMENT); } > .*"*/" { DEBUG(lexerDebugFlag, > printf("Lex: %3d:%4d END COMMENT `%s`\n", lineno, col, yytext);) > BEGIN(INITIAL); } > > I'm stuck. Are there other issues associated with the "unrecognized > rule" message? > > Thanks > |