Updating a legacy bison/yacc grammar file (HELP!)

Aryeh Friedman <[email protected]>
Newsgroups gmane.comp.parsers.bison.general
Message-ID <CAGBxaXkE3bG7TahdmOE3_89Z7jATy2JK4mCJvpMWArHR5XO+Yg@mail.gmail.com>
In attempting to update a previously working (pre-3.6) set of .y's I am now
getting an error that makes no sense to me (I am not the original author)
and all attempts to fix it fail.

If I do nothing I get the following error in code that was added by bison
when generating the parser (I can't find any reference to the string
literals in the .y's I am attempting to update):


fmtgen/parse.yacc.cc:1735:19: error: called object type 'parse_tokentype'
is not a function or function pointer
      parse_error (parse__("syntax error"));
      ~~~~~~~~~~~ ^
fmtgen/parse.yacc.cc:1846:15: error: called object type 'parse_tokentype'
is not a function or function pointer
  parse_error (parse__("memory exhausted"));
  ~~~~~~~~~~~ ^
2 errors generated.

If I change the definition of parse_error as follows in lex.h:

#define parse_error yyerror   // I have a working yyerror (I think since
other calls to it work)

I get:

mtgen/parse.yacc.cc:140:5: error: redefinition of 'parse_error'
    parse_error = 256,                 /* error  */
    ^
./fmtgen/lex.h:115:21: note: expanded from macro 'parse_error'
#define parse_error parse_error
                    ^
./fmtgen/lex.h:48:6: note: previous definition is here
void parse_error(const char *fmt, ...)                  ATTR_PRINTF(1, 2);
     ^
fmtgen/parse.yacc.cc:1333:23: error: comparison between pointer and integer
('int' and 'void (*)(const char *, ...)')
  else if (parse_char == parse_error)
           ~~~~~~~~~~ ^  ~~~~~~~~~~~

-- 
Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.