mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
Add variadic functions.
Already extending QuakePascal, and many basics aren't there yet :P
This commit is contained in:
parent
02b3dde83b
commit
9ce9b70484
2 changed files with 14 additions and 1 deletions
|
@ -82,6 +82,7 @@ ADDOP [\-+]
|
|||
MULOP [*/]
|
||||
ASSIGNOP :=
|
||||
RANGE \.\.
|
||||
ELLIPSIS \.\.\.
|
||||
FRAMEID {ID}(\.{ID})*
|
||||
|
||||
%x GRAB_FRAME GRAB_OTHER COMMENT
|
||||
|
@ -153,6 +154,7 @@ FRAMEID {ID}(\.{ID})*
|
|||
{ASSIGNOP} return ASSIGNOP;
|
||||
|
||||
{RANGE} return RANGE;
|
||||
{ELLIPSIS} return ELLIPSIS;
|
||||
|
||||
[!(){}.&|^~\[\];,#%?:] return yytext[0];
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ int yylex (void);
|
|||
%token <float_val> FLOAT_VAL
|
||||
|
||||
%token PROGRAM VAR ARRAY OF FUNCTION PROCEDURE PBEGIN END IF THEN ELSE
|
||||
%token WHILE DO RANGE ASSIGNOP NOT
|
||||
%token WHILE DO RANGE ASSIGNOP NOT ELLIPSIS
|
||||
|
||||
%type <type> standard_type type
|
||||
%type <expr> const num identifier_list statement_list statement
|
||||
|
@ -294,6 +294,17 @@ subprogram_head
|
|||
|
||||
arguments
|
||||
: '(' parameter_list ')' { $$ = $2; }
|
||||
| '(' parameter_list ';' ELLIPSIS ')'
|
||||
{
|
||||
param_t **p;
|
||||
|
||||
$$ = $2;
|
||||
p = &$$;
|
||||
for ( ; *p; p = &(*p)->next)
|
||||
;
|
||||
*p = new_param (0, 0, 0);
|
||||
}
|
||||
| '(' ELLIPSIS ')' { $$ = new_param (0, 0, 0); }
|
||||
| /* emtpy */ { $$ = 0; }
|
||||
;
|
||||
|
||||
|
|
Loading…
Reference in a new issue