Commit c22f9931 authored by Max Khon's avatar Max Khon Committed by Vasil Velichkov

Bison 3 no longer supports YYPARSE_PARAM and YYPARSE_PARAM_TYPE.

parent ad8ee0c8
%parse-param { void **param }
%{ %{
#include <stdlib.h> #include <stdlib.h>
...@@ -9,8 +11,6 @@ ...@@ -9,8 +11,6 @@
#include "asn1parser.h" #include "asn1parser.h"
#define YYPARSE_PARAM param
#define YYPARSE_PARAM_TYPE void **
#define YYERROR_VERBOSE #define YYERROR_VERBOSE
#define YYDEBUG 1 #define YYDEBUG 1
#define YYFPRINTF prefixed_fprintf #define YYFPRINTF prefixed_fprintf
...@@ -38,8 +38,7 @@ prefixed_fprintf(FILE *f, const char *fmt, ...) { ...@@ -38,8 +38,7 @@ prefixed_fprintf(FILE *f, const char *fmt, ...) {
} }
int yylex(void); int yylex(void);
static int yyerror(const char *msg); int yyerror(void **param, const char *msg);
#ifdef YYBYACC #ifdef YYBYACC
int yyparse(void **param); /* byacc does not produce a prototype */ int yyparse(void **param); /* byacc does not produce a prototype */
#endif #endif
...@@ -70,7 +69,7 @@ static asn1p_module_t *currentModule; ...@@ -70,7 +69,7 @@ static asn1p_module_t *currentModule;
#define checkmem(ptr) do { \ #define checkmem(ptr) do { \
if(!(ptr)) \ if(!(ptr)) \
return yyerror("Memory failure"); \ return yyerror(param, "Memory failure"); \
} while(0) } while(0)
#define CONSTRAINT_INSERT(root, constr_type, arg1, arg2) do { \ #define CONSTRAINT_INSERT(root, constr_type, arg1, arg2) do { \
...@@ -660,7 +659,7 @@ Assignment: ...@@ -660,7 +659,7 @@ Assignment:
* Erroneous attemps * Erroneous attemps
*/ */
| BasicString { | BasicString {
return yyerror( return yyerror(param,
"Attempt to redefine a standard basic string type, " "Attempt to redefine a standard basic string type, "
"please comment out or remove this type redefinition."); "please comment out or remove this type redefinition.");
} }
...@@ -678,7 +677,7 @@ optImports: ...@@ -678,7 +677,7 @@ optImports:
ImportsDefinition: ImportsDefinition:
TOK_IMPORTS optImportsBundleSet ';' { TOK_IMPORTS optImportsBundleSet ';' {
if(!saved_aid && 0) if(!saved_aid && 0)
return yyerror("Unterminated IMPORTS FROM, " return yyerror(param, "Unterminated IMPORTS FROM, "
"expected semicolon ';'"); "expected semicolon ';'");
saved_aid = 0; saved_aid = 0;
$$ = $2; $$ = $2;
...@@ -687,7 +686,7 @@ ImportsDefinition: ...@@ -687,7 +686,7 @@ ImportsDefinition:
* Some error cases. * Some error cases.
*/ */
| TOK_IMPORTS TOK_FROM /* ... */ { | TOK_IMPORTS TOK_FROM /* ... */ {
return yyerror("Empty IMPORTS list"); return yyerror(param, "Empty IMPORTS list");
} }
; ;
...@@ -2313,11 +2312,11 @@ Enumerations: ...@@ -2313,11 +2312,11 @@ Enumerations:
asn1p_expr_t *first_memb = TQ_FIRST(&($$->members)); asn1p_expr_t *first_memb = TQ_FIRST(&($$->members));
if(first_memb) { if(first_memb) {
if(first_memb->expr_type == A1TC_EXTENSIBLE) { if(first_memb->expr_type == A1TC_EXTENSIBLE) {
return yyerror( return yyerror(param,
"The ENUMERATION cannot start with extension (...)."); "The ENUMERATION cannot start with extension (...).");
} }
} else { } else {
return yyerror( return yyerror(param,
"The ENUMERATION list cannot be empty."); "The ENUMERATION list cannot be empty.");
} }
} }
...@@ -2625,8 +2624,9 @@ _fixup_anonymous_identifier(asn1p_expr_t *expr) { ...@@ -2625,8 +2624,9 @@ _fixup_anonymous_identifier(asn1p_expr_t *expr) {
expr->Identifier); expr->Identifier);
} }
static int int
yyerror(const char *msg) { yyerror(void **param, const char *msg) {
(void)param;
extern char *asn1p_text; extern char *asn1p_text;
fprintf(stderr, fprintf(stderr,
"ASN.1 grammar parse error " "ASN.1 grammar parse error "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment