Skip to content
Snippets Groups Projects
Commit f5fd5373 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Added implicit range start and end to opt_int_range.

Rev: src/language.yacc:1.115
parent 7f33ad3a
No related branches found
No related tags found
No related merge requests found
...@@ -181,7 +181,7 @@ ...@@ -181,7 +181,7 @@
/* This is the grammar definition of Pike. */ /* This is the grammar definition of Pike. */
#include "global.h" #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 #ifdef HAVE_MEMORY_H
#include <memory.h> #include <memory.h>
#endif #endif
...@@ -298,6 +298,8 @@ int yylex(YYSTYPE *yylval); ...@@ -298,6 +298,8 @@ int yylex(YYSTYPE *yylval);
%type <number> modifier %type <number> modifier
%type <number> modifier_list %type <number> modifier_list
%type <number> modifiers %type <number> modifiers
%type <number> number_or_maxint
%type <number> number_or_minint
%type <number> optional_dot_dot_dot %type <number> optional_dot_dot_dot
%type <number> optional_stars %type <number> optional_stars
...@@ -839,9 +841,28 @@ type3: F_INT_ID opt_int_range { push_type(T_INT); } ...@@ -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); } | F_FUNCTION_ID opt_function_type { push_type(T_FUNCTION); }
; ;
opt_int_range: { push_type_int(MAX_INT32); push_type_int(MIN_INT32); } number_or_maxint: /* Empty */
| '(' F_NUMBER F_DOT_DOT F_NUMBER ')'
{ {
$$ = 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($4);
push_type_int($2); push_type_int($2);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment