pike.git / src / language.y

version» Context lines:

pike.git/src/language.y:55:    */      %token F_MAX_OPCODE   %token F_ADD_EQ   %token F_AND_EQ   %token F_APPLY   %token F_ARG_LIST   %token F_ARRAY_ID   %token F_ARROW   %token F_BREAK - %token F_CALL_OTHER +    %token F_CASE   %token F_COLON_COLON   %token F_COMMA   %token F_CONTINUE   %token F_DEFAULT   %token F_DIV_EQ   %token F_DO   %token F_DOT_DOT   %token F_DOT_DOT_DOT   %token F_EFUN
pike.git/src/language.y:161:   static void pop_locals();   void free_all_local_names();   void add_local_name(struct lpc_string *,struct lpc_string *);      /*    * The names and types of arguments and auto variables.    */   struct locals *local_variables;      static int varargs; - static struct lpc_string *current_type; +    static INT32 current_modifiers;      void fix_comp_stack(int sp)   {    if(comp_stackp>sp)    {    yyerror("Compiler stack fixed.");    comp_stackp=sp;    }else if(comp_stackp<sp){    fatal("Compiler stack frame underflow.");
pike.git/src/language.y:201:   %type <number> optional_stars modifier_list   %type <string> F_IDENTIFIER F_STRING string_constant low_string   %type <string> type_or_error optional_identifier cast simple_type   %type <string> optional_rename_inherit      %type <number> F_ARRAY_ID F_BREAK F_CASE F_CATCH F_CONTINUE F_DEFAULT F_DO   %type <number> F_EFUN F_ELSE F_FLOAT_ID F_FOR F_FOREACH F_FUNCTION_ID F_GAUGE   %type <number> F_IF F_INHERIT F_INLINE F_INT_ID F_LAMBDA F_LIST_ID F_MAPPING_ID   %type <number> F_MIXED_ID F_NO_MASK F_OBJECT_ID F_PRIVATE F_PROGRAM_ID   %type <number> F_PROTECTED F_PUBLIC F_RETURN F_SSCANF F_STATIC - %type <number> F_STRING_ID F_SWITCH F_VARARGS F_VOID_ID F_WHILE F_CALL_OTHER + %type <number> F_STRING_ID F_SWITCH F_VARARGS F_VOID_ID F_WHILE      /* The following symbos return type information */      %type <n> string expr01 expr00 comma_expr   %type <n> expr2 expr1 expr3 expr0 expr4 catch lvalue_list   %type <n> lambda for_expr block assoc_pair new_local_name   %type <n> expr_list2 m_expr_list m_expr_list2 statement gauge sscanf   %type <n> for do cond optional_else_part while statements - %type <n> local_name_list call_other expr_list3 + %type <n> local_name_list   %type <n> unused2 foreach unused switch case return expr_list default   %type <n> continue break block_or_semi   %%      all: program;      program: program def optional_semi_colon    | /* empty */ ;      optional_semi_colon: /* empty */
pike.git/src/language.y:248:    simple_do_inherit($3,$1,$4);    };      block_or_semi: block { $$ = mknode(F_ARG_LIST,$1,mknode(F_RETURN,mkintnode(0),0)); }    | ';' { $$ = NULL;}    ;         type_or_error: simple_type    { -  if(current_type) free_string(current_type); -  current_type=$1; +  if(local_variables->current_type) free_string(local_variables->current_type); +  local_variables->current_type=$1;    }    | /* empty */    {    yyerror("Missing type.");    copy_shared_string($$, mixed_type_string);    }         def: modifiers type_or_error optional_stars F_IDENTIFIER '(' arguments ')'    {    int e;    /* construct the function type */ -  push_finished_type(current_type); +  push_finished_type(local_variables->current_type);    while($3--) push_type(T_ARRAY);    e=$6-1;    if(varargs)    {    push_finished_type(local_variables->variable[e].type);    e--;    varargs=0;    pop_type_stack();    }else{    push_type(T_VOID);
pike.git/src/language.y:462:    ;            name_list: new_name    | name_list ',' new_name;      new_name: optional_stars F_IDENTIFIER    {    struct lpc_string *type; -  push_finished_type(current_type); +  push_finished_type(local_variables->current_type);    while($1--) push_type(T_ARRAY);    type=pop_type();    define_variable($2, type, current_modifiers);    free_string(type);    free_string($2);    }    | optional_stars F_IDENTIFIER '='    {    struct lpc_string *type; -  push_finished_type(current_type); +  push_finished_type(local_variables->current_type);    while($1--) push_type(T_ARRAY);    type=pop_type();    $<number>$=define_variable($2, type, current_modifiers);    free_string(type);    }    expr0    {    init_node=mknode(F_ARG_LIST,init_node,    mkcastnode(void_type_string, mknode(F_ASSIGN,$5,mkidentifiernode($<number>4))));    free_string($2);    } ;         new_local_name: optional_stars F_IDENTIFIER    { -  push_finished_type(current_type); +  push_finished_type(local_variables->current_type);    while($1--) push_type(T_ARRAY);    add_local_name($2, pop_type());    $$=mkcastnode(void_type_string,    mknode(F_ASSIGN,mkintnode(0),    mklocalnode(islocal($2))));    }    | optional_stars F_IDENTIFIER '=' expr0    { -  push_finished_type(current_type); +  push_finished_type(local_variables->current_type);    while($1--) push_type(T_ARRAY);    add_local_name($2, pop_type());    $$=mkcastnode(void_type_string,    mknode(F_ASSIGN,$4,    mklocalnode(islocal($2))));       };         block:'{'
pike.git/src/language.y:544:   statements: { $$=0; }    | statements statement    {    $$=mknode(F_ARG_LIST,$1,mkcastnode(void_type_string,$2));    }    ;      statement: unused2 ';' { $$=$1; }    | simple_type    { -  if(current_type) free_string(current_type); -  current_type=$1; +  if(local_variables->current_type) free_string(local_variables->current_type); +  local_variables->current_type=$1;    } local_name_list ';' { $$=$3; }    | cond    | while    | do    | for    | switch    | case    | default    | return ';'    | block {}
pike.git/src/language.y:833:    | expr4 F_INC { $$=mknode(F_POST_INC,$1,0); }    | expr4 F_DEC { $$=mknode(F_POST_DEC,$1,0); }    ;      expr4: string    | F_NUMBER { $$=mkintnode($1); }    | F_FLOAT { $$=mkfloatnode($1); }    | catch    | gauge    | sscanf -  | call_other +     | lambda    | F_IDENTIFIER    {    int i;    struct efun *f;    if((i=islocal($1))>=0)    {    $$=mklocalnode(i);    }else if((i=isidentifier($1))>=0){    $$=mkidentifiernode(i);
pike.git/src/language.y:926:    if(!$$)    {    $$=mkintnode(0);    }else{    if($$->token==F_ARG_LIST) $$=mkefuncallnode("aggregate",$$);    }    free_string($2);    }    ;    - expr_list3: { $$=0; } -  | ',' expr_list { $$=$2; } -  ; -  - call_other: F_CALL_OTHER '(' expr0 ',' expr0 expr_list3 ')' -  { -  $$=mkapplynode(mknode(F_INDEX, -  mkcastnode(object_type_string,$3), -  $5),$6); -  } -  +    gauge: F_GAUGE '(' unused ')'    {    $$=mknode(F_NEGATE,    mknode(F_SUBTRACT,    mknode(F_INDEX,mkefuncallnode("rusage",0),    mkintnode(GAUGE_RUSAGE_INDEX)),    mknode(F_ARG_LIST,$3,    mknode(F_INDEX,mkefuncallnode("rusage",0),    mkintnode(GAUGE_RUSAGE_INDEX)))),0);    } ;
pike.git/src/language.y:1004:    sp++;    sp->type = T_INT;    sp->u.integer = current_line;    sp++;    sp->type = T_STRING;    sp->u.string = make_shared_string(str);    sp++;    SAFE_APPLY_MASTER("compile_error",3);    pop_stack();    }else{ -  (void)fprintf(stderr, "%s:%ld: %s\n", current_file->str,current_line,str); +  (void)fprintf(stderr, "%s:%ld: %s\n", +  current_file->str, +  (long)current_line, +  str);    fflush(stderr);    }   }      /* argument must be a shared string (no need to free it) */   void add_local_name(struct lpc_string *str,    struct lpc_string *type)   {    if (local_variables->current_number_of_locals == MAX_LOCAL)    {
pike.git/src/language.y:1089:    for(d=0;d<INHERIT_FROM_INT(p,e)->inherit_level;d++) fprintf(stderr," ");    fprintf(stderr,"%s;\n", ID_FROM_INT(p,e)->name->str);    }   }   #endif         static void push_locals()   {    struct locals *l; -  push_explicit((int)current_type); -  current_type=0; +     l=ALLOC_STRUCT(locals); -  +  l->current_type=0;    l->next=local_variables;    local_variables=l;    local_variables->current_number_of_locals=0;   }      static void pop_locals()   {    struct locals *l;    free_all_local_names();    l=local_variables->next; -  +  if(local_variables->current_type) +  free_string(local_variables->current_type);    free((char *)local_variables);       local_variables=l;    /* insert check if ( local->next == parent locals ) here */ -  if(current_type) free_string(current_type); -  current_type=(struct lpc_string *)pop_address(); +    }