X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=idl%2Fparser_proc.y;fp=idl%2Fparser_proc.y;h=47de1532d3bd9af88d6c2cecce00411e6d2b8992;hp=3ad10fbc0ceca038fbb77f3c574a4559217de0f6;hb=9e0411db099e71409f0ee8a8f464aa34ac65c778;hpb=69008ba2a7733358974c8985caa2e5bcb1182fe1 diff --git a/idl/parser_proc.y b/idl/parser_proc.y index 3ad10fb..47de153 100644 --- a/idl/parser_proc.y +++ b/idl/parser_proc.y @@ -4,6 +4,8 @@ #include #include +#include "parser.h" + static void syntax_error(const char *fn, size_t ln, const char *msg, ...) { fprintf(stderr, "WARNING: Syntax error on line %zu in '%s'%s", ln, fn, msg ? ": ": "\n"); if (msg) { @@ -20,10 +22,10 @@ %token_prefix PSI_T_ %token_type {PSI_Token *} %token_destructor {free($$);} -%extra_argument {PSI_Lexer *L} +%extra_argument {PSI_Parser *P} /* TOKEN is defined inside syntax_error */ %syntax_error { - syntax_error(L->fn, L->line, "Unexpected token '%s'.\n", TOKEN->text); + syntax_error(P->fn, P->line, "Unexpected token '%s'.\n", TOKEN->text); } file ::= blocks. @@ -33,23 +35,23 @@ blocks ::= blocks block. block ::= COMMENT. block ::= LIB(T) QUOTED_STRING(libname) EOS. { - if (L->lib) { - syntax_error(L->fn, T->line, "Extra 'lib %s' statement has no effect.\n", libname->text); + if (P->lib) { + syntax_error(P->fn, T->line, "Extra 'lib %s' statement has no effect.\n", libname->text); } else { - L->lib = strndup(libname->text + 1, libname->size - 2); + P->lib = strndup(libname->text + 1, libname->size - 2); } free(libname); free(T); } block ::= decl(decl). { - L->decls = add_decl(L->decls, decl); + P->decls = add_decl(P->decls, decl); } block ::= impl(impl). { - L->impls = add_impl(L->impls, impl); + P->impls = add_impl(P->impls, impl); } block ::= decl_typedef(def). { - L->defs = add_decl_typedef(L->defs, def); + P->defs = add_decl_typedef(P->defs, def); } %type decl_typedef {decl_typedef*}