pike.git / src / language.yacc

version» Context lines:

pike.git/src/language.yacc:1:   /* -*- c -*-   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: language.yacc,v 1.354 2005/01/27 09:17:38 grubba Exp $ + || $Id: language.yacc,v 1.355 2005/02/18 13:48:47 grubba Exp $   */      %pure_parser      %token TOK_ARROW      /*    * Basic value pushing    */   %token TOK_CONSTANT TOK_FLOAT TOK_STRING
pike.git/src/language.yacc:300:   %type <n> cond   %type <n> continue   %type <n> default   %type <n> do   %type <n> safe_expr0   %type <n> expr00   %type <n> expr01   %type <n> expr1   %type <n> expr2   %type <n> expr3 expr0 + %type <n> apply   %type <n> expr4   %type <n> expr_list   %type <n> expr_list2   %type <n> for   %type <n> for_expr   %type <n> foreach   %type <n> gauge   %type <n> idents   %type <n> idents2   %type <n> labeled_statement
pike.git/src/language.yacc:1828:    ;         statements: { $$=0; }    | statements statement    {    $$ = mknode(F_COMMA_EXPR, $1, mkcastnode(void_type_string, $2));    }    ;    - statement_with_semicolon: unused2 optional_block -  { -  if($2) -  { -  $$=recursive_add_call_arg($1,$2); -  }else{ -  $$=$1; -  } -  } - ; + statement_with_semicolon: unused2 ';' ;      normal_label_statement: statement_with_semicolon    | import { $$=0; }    | cond    | return    | local_constant { $$=0; }    | block    | break expected_semicolon    | continue expected_semicolon    | error ';' { reset_type_stack(); $$=0; yyerrok; }
pike.git/src/language.yacc:3110:    * require using ugly implicit variables or extending    * the syntax, and if you extend the syntax you might    * as well use lambda() instead.    * -Hubbe    *    * We might want to allow having more than block after    * a function ( ie. func(args) {} {} {} {} )    * -Hubbe    */    - optional_block: ';' /* EMPTY */ { $$=0; } + optional_block: /* EMPTY */ { $$=0; }    | '{' line_number_info push_compiler_frame0    {    debug_malloc_touch(Pike_compiler->compiler_frame->current_return_type);    if(Pike_compiler->compiler_frame->current_return_type)    free_type(Pike_compiler->compiler_frame->current_return_type);    copy_pike_type(Pike_compiler->compiler_frame->current_return_type,    any_type_string);       /* block code */    $<number>1=Pike_compiler->num_used_modules;    $<number>$=Pike_compiler->compiler_frame->current_number_of_locals;    } -  statements end_block expected_semicolon +  statements end_block    {    struct pike_type *type;    char buf[40];    int f/*, e */;    struct pike_string *name;    struct pike_string *save_file = lex.current_file;    int save_line = lex.current_line;    lex.current_file = $2->current_file;    lex.current_line = $2->line_number;   
pike.git/src/language.yacc:3194:       lex.current_line = save_line;    lex.current_file = save_file;    free_node ($2);    free_string(name);    free_type(type);    pop_compiler_frame();    }    ;    - expr4: string -  | TOK_NUMBER -  | TOK_FLOAT { $$=mkfloatnode((FLOAT_TYPE)$1); } -  | catch -  | gauge -  | typeof -  | sscanf -  | lambda -  | class -  | enum -  | idents2 -  | expr4 open_paren_with_line_info expr_list ')' + apply: +  expr4 open_paren_with_line_info expr_list ')' optional_block    { -  $$=mkapplynode($1,$3); +  $$ = mkapplynode($1, mknode(F_ARG_LIST, $3, $5));    COPY_LINE_NUMBER_INFO($$, $2);    free_node ($2);    } -  | expr4 open_paren_with_line_info error ')' +  | expr4 open_paren_with_line_info error ')' optional_block    { -  $$=mkapplynode($1, NULL); +  $$=mkapplynode($1, $5);    free_node ($2);    yyerrok;    }    | expr4 open_paren_with_line_info error TOK_LEX_EOF    {    yyerror("Missing ')'.");    yyerror("Unexpected end of file.");    $$=mkapplynode($1, NULL);    free_node ($2);    }
pike.git/src/language.yacc:3236:    yyerror("Missing ')'.");    $$=mkapplynode($1, NULL);    free_node ($2);    }    | expr4 open_paren_with_line_info error '}'    {    yyerror("Missing ')'.");    $$=mkapplynode($1, NULL);    free_node ($2);    } +  ; +  + expr4: string +  | TOK_NUMBER +  | TOK_FLOAT { $$=mkfloatnode((FLOAT_TYPE)$1); } +  | catch +  | gauge +  | typeof +  | sscanf +  | lambda +  | class +  | enum +  | idents2 +  | apply    | expr4 open_bracket_with_line_info '*' ']'    {    $$=mknode(F_AUTO_MAP_MARKER, $1, 0);    COPY_LINE_NUMBER_INFO($$, $2);    free_node ($2);    }    | expr4 open_bracket_with_line_info expr0 ']'    {    $$=mknode(F_INDEX,$1,$3);    COPY_LINE_NUMBER_INFO($$, $2);