pike.git / src / language.yacc

version» Context lines:

pike.git/src/language.yacc:103:   %left TOK_LSH TOK_RSH   %left '+' '-'   %left '*' '%' '/'   %right TOK_NOT '~'   %nonassoc TOK_INC TOK_DEC      %{   /* This is the grammar definition of Pike. */      #include "global.h" - RCSID("$Id: language.yacc,v 1.229 2001/02/25 14:42:55 grubba Exp $"); + RCSID("$Id: language.yacc,v 1.230 2001/02/26 22:44:08 grubba Exp $");   #ifdef HAVE_MEMORY_H   #include <memory.h>   #endif      #include "interpret.h"   #include "array.h"   #include "object.h"   #include "stralloc.h"   #include "las.h"   #include "interpret.h"
pike.git/src/language.yacc:1183:    | type3    ;      type3: TOK_INT_ID opt_int_range {}    | TOK_FLOAT_ID { push_type(T_FLOAT); }    | TOK_PROGRAM_ID { push_type(T_PROGRAM); }    | TOK_VOID_ID { push_type(T_VOID); }    | TOK_MIXED_ID { push_type(T_MIXED); }    | TOK_STRING_ID { push_type(T_STRING); }    | TOK_OBJECT_ID opt_object_type {} -  | TOK_MAPPING_ID opt_mapping_type { push_type(T_MAPPING); } +  | TOK_MAPPING_ID opt_mapping_type {}    | TOK_ARRAY_ID opt_array_type { push_type(T_ARRAY); }    | TOK_MULTISET_ID opt_array_type { push_type(T_MULTISET); } -  | TOK_FUNCTION_ID opt_function_type { push_type(T_FUNCTION); } +  | TOK_FUNCTION_ID opt_function_type {}    ;      type8: type3 | identifier_type ;      number_or_maxint: /* Empty */    {    $$ = mkintnode(MAX_INT32);    }    | TOK_NUMBER    | '-' TOK_NUMBER
pike.git/src/language.yacc:1287:    }    }    push_object_type(0, p?(p->id):0);    pop_n_elems(2);    }    ;      opt_function_type: '('    {    type_stack_mark(); + #ifndef USE_PIKE_TYPE    type_stack_mark(); -  + #endif /* !USE_PIKE_TYPE */    }    function_type_list optional_dot_dot_dot ':'    {    /* Add the many type if there is none. */    if ($4)    {    if (!$3) {    /* function_type_list ends with a comma, or is empty.    * FIXME: Should this be a syntax error or not?    */    if (Pike_compiler->compiler_pass == 1) {    yyerror("Missing type before ... .");    } -  + #ifndef USE_PIKE_TYPE    type_stack_reverse();    type_stack_mark(); -  + #endif /* !USE_PIKE_TYPE */    push_type(T_MIXED);    }    }else{ -  + #ifndef USE_PIKE_TYPE    type_stack_reverse();    type_stack_mark(); -  + #endif /* !USE_PIKE_TYPE */    push_type(T_VOID);    } -  + #ifndef USE_PIKE_TYPE    /* Rotate T_MANY into the proper position. */    push_type(T_MANY);    type_stack_reverse();    type_stack_mark(); -  + #endif /* !USE_PIKE_TYPE */    }    type7 ')'    { -  + #ifdef USE_PIKE_TYPE +  push_reverse_type(T_MANY); +  Pike_compiler->pike_type_mark_stackp--; +  while (*Pike_compiler->pike_type_mark_stackp < +  Pike_compiler->type_stackp) { +  push_reverse_type(T_FUNCTION); +  } + #else /* !USE_PIKE_TYPE */    type_stack_reverse();    type_stack_reverse(); -  +  push_type(T_FUNCTION); + #endif /* USE_PIKE_TYPE */    }    | /* empty */    {    push_type(T_MIXED);    push_type(T_VOID);    push_type(T_OR);       push_type(T_ZERO);    push_type(T_VOID);    push_type(T_OR);       push_type(T_MANY); -  + #ifndef USE_PIKE_TYPE +  push_type(T_FUNCTION); + #endif /* !USE_PIKE_TYPE */    }    ;      function_type_list: /* Empty */ optional_comma { $$=0; }    | function_type_list2 optional_comma { $$=!$2; }    ;      function_type_list2: type7 { $$=1; }    | function_type_list2 ','    { -  + #ifndef USE_PIKE_TYPE    type_stack_reverse();    type_stack_mark(); -  + #endif /* !USE_PIKE_TYPE */    }    type7    ;      opt_array_type: '(' type7 ')'    | { push_type(T_MIXED); }    ;      opt_mapping_type: '('    { -  + #ifndef USE_PIKE_TYPE    type_stack_mark();    type_stack_mark(); -  + #endif /* !USE_PIKE_TYPE */    }    type7 ':'    { -  + #ifndef USE_PIKE_TYPE    type_stack_reverse();    type_stack_mark(); -  + #endif /* !USE_PIKE_TYPE */    }    type7    { -  + #ifdef USE_PIKE_TYPE +  push_reverse_type(T_MAPPING); + #else /* !USE_PIKE_TYPE */    type_stack_reverse();    type_stack_reverse(); -  +  push_type(T_MAPPING); + #endif /* USE_PIKE_TYPE */    }    ')'    | /* empty */    {    push_type(T_MIXED);    push_type(T_MIXED); -  +  push_type(T_MAPPING);    }    ;            name_list: new_name    | name_list ',' new_name    ;      new_name: optional_stars TOK_IDENTIFIER