Fingolfin
Fingolfin

Reputation: 5533

How to use yyerror to tell more about parsing errors

So I've written all the grammar I want and everything works smoothly. I am making absolutely no actions when a grammar is encountered.

This is the definition of my yyerror function

int yyerror (const char *s)
{                                                     
    printf("parser error %s \n ",s);
    return 0;
}

Well, I've read somewhere that I need to add %error-verbose if I want to get more information about the errors my parser encountered; when I tried to add it I got this error message

error: unrecognized: %error_verbose

Take into account that I am using Flex, Bison and have connected them with VS2010
EDIT: Even though the error mentions error_verbose, I made sure that I am passing error-verbose, with dash instead of an underscore.

Upvotes: 2

Views: 7164

Answers (2)

Fingolfin
Fingolfin

Reputation: 5533

Weirdly enough, when I tried the %error-verbose on the latest bison version in Linux, it worked just fine but didn't work with the Windows version.
Not sure if it's a bug in the version I am using on Windows or it's just not supported feature.

Upvotes: 0

Ernest Friedman-Hill
Ernest Friedman-Hill

Reputation: 81724

It's %error-verbose, with a dash, but your error message shows an underscore instead.

Upvotes: 1

Related Questions