Hi Scott,

> Le 3 juin 2021 à 00:13, Scott Lorberbaum <ugasco...@gmail.com> a écrit :
> 
> My namespace is ucc;
> I've named the parser uccParser;
> 
> 
> This function below I find in the generated ucc.tab.cpp file
>  void
>  uccParser::error (const syntax_error& yyexc)
>  {
>    error (yyexc.location, yyexc.what ());
>  }
> unfortunately the ucc.tab.hpp file that is generated does not include a
> definition of this function inside the class it creates.

You are in charge of defining the error reporting function, just like
you are in charge of defining yylex.

Most people use a simple definition:

void
yy::parser::error (const location_type& l, const std::string& m)
{
  std::cerr << l << ": " << m << '\n';
}

Please see the documentation.  For instance
https://www.gnu.org/software/bison/manual/html_node/A-Simple-C_002b_002b-Example.html

Cheers!

Reply via email to