From e5d2a949f0e5cd5f1ddaece41a03f65ac1e3836e Mon Sep 17 00:00:00 2001 From: François Pottier Date: Fri, 23 Oct 2015 12:59:47 +0200 Subject: Removed the two uses of $syntaxerror in a semantic action. For the first one, this is fine; the error is caught by a type check later on. For the second one, it is temporary. More thought is needed about the syntax of K&R functions anyway, as Jacques-Henri and I discovered that it is currently broken (it mis-interprets some function definitions). --- cparser/pre_parser.mly | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'cparser/pre_parser.mly') diff --git a/cparser/pre_parser.mly b/cparser/pre_parser.mly index f3bfb9e8..96cf0de7 100644 --- a/cparser/pre_parser.mly +++ b/cparser/pre_parser.mly @@ -870,14 +870,19 @@ function_definition_begin: | declaration_specifiers(declaration(external_declaration)) ilist(pointer1) x=direct_declarator { match x with - | (_, None) -> $syntaxerror + | (_, None) -> !open_context() + (* this case does not make sense, but we let it pass anyway; + this error will be caught later on by a type check *) | (i, Some restore_fun) -> restore_fun () } | declaration_specifiers(declaration(external_declaration)) ilist(pointer1) x=direct_declarator LPAREN params=identifier_list RPAREN open_context declaration_list { match x with - | (_, Some _) -> $syntaxerror + | (i, Some _) -> declare_varname i + (* this case does not make sense; the syntax of K&R + declarators is broken anyway, Jacques-Henri should + propose a fix soon *) | (i, None) -> declare_varname i; List.iter declare_varname params -- cgit