lib: replace YYPARSE_PARAM and YYLEX_PARAM
In the Bison source calib_yacc.y, replace the use of YYPARSE_PARAM and YYLEX_PARAM C macros with the %parse-param and %lex-param declarations. I still need a C macro in combination with %lex-param for it to work, so I'm not sure I'm doing it right! Also correct the %pure_parser declaration which should be %pure-parser (i.e. the underscore should be a dash). This has a knock-on effect for the yyerror() function, which now needs an extra parameter.
This commit is contained in:
parent
e8cefc0a0d
commit
c689eff475
2 changed files with 11 additions and 6 deletions
|
@ -30,8 +30,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#define YYERROR_VERBOSE
|
||||
#define YYPARSE_PARAM parse_arg
|
||||
#define YYLEX_PARAM priv(YYPARSE_PARAM)->yyscanner
|
||||
#define LEX_PARAM parse_arg->yyscanner
|
||||
|
||||
#include "calib_yacc.h"
|
||||
#include "calib_lex.h"
|
||||
|
@ -42,7 +41,7 @@ enum polynomial_direction
|
|||
POLYNOMIAL_FROM_PHYS
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct calib_yyparse_private
|
||||
{
|
||||
yyscan_t yyscanner;
|
||||
comedi_calibration_t *parsed_file;
|
||||
|
@ -50,7 +49,7 @@ typedef struct
|
|||
int cal_index;
|
||||
unsigned num_coefficients;
|
||||
comedi_polynomial_t polynomial;
|
||||
} calib_yyparse_private_t;
|
||||
};
|
||||
|
||||
YY_DECL;
|
||||
|
||||
|
@ -336,14 +335,18 @@ static void fill_inverse_linear_polynomials(comedi_calibration_t *calibration)
|
|||
}
|
||||
}
|
||||
|
||||
static void yyerror(const char *s)
|
||||
static void yyerror(calib_yyparse_private_t *parse_arg, const char *s)
|
||||
{
|
||||
fprintf(stderr, "%s\n", s);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%pure_parser
|
||||
%pure-parser
|
||||
|
||||
%parse-param {calib_yyparse_private_t *parse_arg}
|
||||
|
||||
%lex-param {LEX_PARAM}
|
||||
|
||||
%union
|
||||
{
|
||||
|
|
|
@ -85,6 +85,8 @@ void internal_error(int error_number);
|
|||
typedef struct subdevice_struct subdevice;
|
||||
typedef struct device_struct device;
|
||||
|
||||
typedef struct calib_yyparse_private calib_yyparse_private_t;
|
||||
|
||||
struct comedi_t_struct{
|
||||
int magic;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue