From f5fd5373d2df83b049ccca2fdebfe8efc5e749be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Mon, 29 Mar 1999 22:17:21 +0200 Subject: [PATCH] Added implicit range start and end to opt_int_range. Rev: src/language.yacc:1.115 --- src/language.yacc | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/language.yacc b/src/language.yacc index b150e9c2a3..c832fce373 100644 --- a/src/language.yacc +++ b/src/language.yacc @@ -181,7 +181,7 @@ /* This is the grammar definition of Pike. */ #include "global.h" -RCSID("$Id: language.yacc,v 1.114 1999/03/11 13:44:30 hubbe Exp $"); +RCSID("$Id: language.yacc,v 1.115 1999/03/29 20:17:21 grubba Exp $"); #ifdef HAVE_MEMORY_H #include <memory.h> #endif @@ -298,6 +298,8 @@ int yylex(YYSTYPE *yylval); %type <number> modifier %type <number> modifier_list %type <number> modifiers +%type <number> number_or_maxint +%type <number> number_or_minint %type <number> optional_dot_dot_dot %type <number> optional_stars @@ -839,9 +841,28 @@ type3: F_INT_ID opt_int_range { push_type(T_INT); } | F_FUNCTION_ID opt_function_type { push_type(T_FUNCTION); } ; -opt_int_range: { push_type_int(MAX_INT32); push_type_int(MIN_INT32); } - | '(' F_NUMBER F_DOT_DOT F_NUMBER ')' +number_or_maxint: /* Empty */ { + $$ = MAX_INT32; + } + | F_NUMBER + ; + +number_or_minint: /* Empty */ + { + $$ = MIN_INT32; + } + | F_NUMBER + ; + +opt_int_range: /* Empty */ + { + push_type_int(MAX_INT32); + push_type_int(MIN_INT32); + } + | '(' number_or_minint F_DOT_DOT number_or_maxint ')' + { + /* FIXME: Check that $4 is >= $2. */ push_type_int($4); push_type_int($2); } -- GitLab