help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Aryeh Friedman
Subject: Updating a legacy bison/yacc grammar file (HELP!)
Date: Sun, 14 Jun 2020 11:22:56 -0400

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]