From cbae7e57c09c2b8e98f7d96735aa4fabe5a736ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Thu, 30 Mar 2000 20:59:32 +0200 Subject: [PATCH] Fixed obscure compiler bug (see InfoKOM 185482). Rev: src/language.yacc:1.172 --- src/language.yacc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/language.yacc b/src/language.yacc index 964394c464..69c3138a5a 100644 --- a/src/language.yacc +++ b/src/language.yacc @@ -188,7 +188,7 @@ /* This is the grammar definition of Pike. */ #include "global.h" -RCSID("$Id: language.yacc,v 1.171 2000/03/30 08:43:07 hubbe Exp $"); +RCSID("$Id: language.yacc,v 1.172 2000/03/30 18:59:32 grubba Exp $"); #ifdef HAVE_MEMORY_H #include <memory.h> #endif @@ -308,7 +308,10 @@ int yylex(YYSTYPE *yylval); %type <number> modifier %type <number> modifier_list %type <number> modifiers +%type <number> function_type_list +%type <number> function_type_list2 %type <number> optional_dot_dot_dot +%type <number> optional_comma %type <number> optional_stars %type <str> magic_identifiers @@ -1236,6 +1239,10 @@ opt_function_type: '(' { if ($4) { + if (!$3) { + /* FIXME: Should this be a syntax error or not? */ + push_type(T_MIXED); + } push_type(T_MANY); type_stack_reverse(); }else{ @@ -1264,11 +1271,11 @@ opt_function_type: '(' } ; -function_type_list: /* Empty */ optional_comma - | function_type_list2 optional_comma +function_type_list: /* Empty */ optional_comma { $$=0; } + | function_type_list2 optional_comma { $$=!$2; } ; -function_type_list2: type7 +function_type_list2: type7 { $$=1; } | function_type_list2 ',' { type_stack_reverse(); @@ -2146,7 +2153,7 @@ assign: F_AND_EQ { $$=F_AND_EQ; } | F_DIV_EQ { $$=F_DIV_EQ; } ; -optional_comma: | ',' ; +optional_comma: { $$=0; } | ',' { $$=1; }; expr_list: { $$=0; } | expr_list2 optional_comma -- GitLab