X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fparser_proc.y;h=c619e5542f4485237cc235266b7676cba5f0f7be;hp=d99c96d482bb956966915960d6508631b621b622;hb=9c72f6584bd95dd6e9c7dcb314a6583f7130362f;hpb=3bca631112f4865510ea91c85e8c820c4465fc14 diff --git a/src/parser_proc.y b/src/parser_proc.y index d99c96d..c619e55 100644 --- a/src/parser_proc.y +++ b/src/parser_proc.y @@ -14,7 +14,7 @@ %extra_argument {PSI_Parser *P} /* TOKEN is defined inside syntax_error */ %syntax_error { - PSI_ParserSyntaxError(P, P->fn, P->line, "Unexpected token '%s'.\n", TOKEN->text); + PSI_ParserSyntaxError(P, P->fn, P->line, "Unexpected token '%s'", TOKEN->text); } file ::= blocks. @@ -25,7 +25,7 @@ block ::= COMMENT. block ::= LIB(T) QUOTED_STRING(libname) EOS. { if (P->lib) { - PSI_ParserSyntaxError(P, P->fn, T->line, "Extra 'lib %s' statement has no effect.\n", libname->text); + PSI_ParserSyntaxError(P, P->fn, T->line, "Extra 'lib %s' statement has no effect", libname->text); } else { P->lib = strndup(libname->text + 1, libname->size - 2); } @@ -96,10 +96,22 @@ decl_type(type_) ::= VOID(T). { type_ = init_decl_type(T->type, T->text); free(T); } +decl_type(type_) ::= CHAR(T). { + type_ = init_decl_type(T->type, T->text); + free(T); +} +decl_type(type_) ::= SHORT(T). { + type_ = init_decl_type(T->type, T->text); + free(T); +} decl_type(type_) ::= INT(T). { type_ = init_decl_type(T->type, T->text); free(T); } +decl_type(type_) ::= LONG(T). { + type_ = init_decl_type(T->type, T->text); + free(T); +} decl_type(type_) ::= FLOAT(T). { type_ = init_decl_type(T->type, T->text); free(T); @@ -231,6 +243,9 @@ let_stmt(let) ::= LET decl_var(var) EQUALS let_value(val) EOS. { let_value(val) ::= let_func(func) LPAREN impl_var(var) RPAREN. { val = init_let_value(func, var, 0); } +let_value(val) ::= REFERENCE let_func(func) LPAREN impl_var(var) RPAREN. { + val = init_let_value(func, var, 1); +} let_value(val) ::= REFERENCE NULL. { val = init_let_value(NULL, NULL, 1); }