pike.git / src / language.yacc

version» Context lines:

pike.git/src/language.yacc:105:   %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.251 2001/06/30 01:32:42 mast Exp $"); + RCSID("$Id: language.yacc,v 1.252 2001/06/30 02:34:39 mast 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:536:    {    yyerror("Missing ';'.");    yyerror("Unexpected end of file.");    }    | modifiers TOK_CONSTANT error '}' { yyerror("Missing ';'."); }    ;      block_or_semi: block    {    $$ = check_node_hash(mknode(F_COMMA_EXPR,$1,mknode(F_RETURN,mkintnode(0),0))); +  if ($1) $$->line_number = $1->line_number;    }    | ';' { $$ = NULL; }    | TOK_LEX_EOF { yyerror("Expected ';'."); $$ = NULL; }    | error { $$ = NULL; }    ;         type_or_error: simple_type    {   #ifdef PIKE_DEBUG
pike.git/src/language.yacc:813:    mkefuncallnode("query_num_arg", NULL),    mkintnode(num_required_args)),    mknode(':',    mkefuncallnode("throw",    mkefuncallnode("aggregate",    mkstrnode(bad_arg_str))),    NULL));    free_string(bad_arg_str);    }    +  { +  int l = $10->line_number; +  char *f = $10->current_file;    if (check_args) {    /* Prepend the arg checking code. */    $10 = mknode(F_COMMA_EXPR, mknode(F_POP_VALUE, check_args, NULL), $10);    } -  +  lex.current_line = l; +  lex.current_file = f; +  }       f=dooptcode(check_node_hash($4)->u.sval.u.string,    check_node_hash($10),    check_node_hash($<n>9)->u.sval.u.type,    $1);       i = ID_FROM_INT(Pike_compiler->new_program, f);    i->opt_flags = Pike_compiler->compiler_frame->opt_flags;       if ($1 & ID_VARIANT) {
pike.git/src/language.yacc:1599:    }    {    /* Trick to store more than one number on compiler stack - Hubbe */    $<number>$=Pike_compiler->compiler_frame->last_block_level;       if($<number>$ == -1) /* if 'first block' */    Pike_compiler->compiler_frame->last_block_level=0; /* all variables */    else    Pike_compiler->compiler_frame->last_block_level=$<number>2;    } +  { +  $<number>$=lex.current_line; +  }    statements end_block    {    unuse_modules(Pike_compiler->num_used_modules - $<number>1);    pop_local_variables($<number>2);    Pike_compiler->compiler_frame->last_block_level=$<number>3; -  $$=$4; +  if ($5) $5->line_number = $<number>4; +  $$=$5;    }    ;      end_block: '}'    | TOK_LEX_EOF    {    yyerror("Missing '}'.");    yyerror("Unexpected end of file.");    }    ;