lex - Stop program execution when there is error -


i like stop execution of program when facing error. how when using lex? can call normal c exit like:

exit( status ); 

or there more neat way lex?

you can - but:

  • just printing message standard error , exiting lex does—when encounters fatal error, e.g., buffer allocation problems. see example yy_fatal_error, used purpose. can overridden, e.g., error recovery routine.
  • a typical lexer not exit error: returns state information parser decides whether state legal.

if lexer serves parser, exiting lexer make sense.

further reading:


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -