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.343 2004/10/22 14:42:16 grubba Exp $ + || $Id: language.yacc,v 1.344 2004/10/22 23:23:20 nilsson Exp $   */      %pure_parser      %token TOK_ARROW      /*    * Basic value pushing    */   %token TOK_CONSTANT TOK_FLOAT TOK_STRING
pike.git/src/language.yacc:53:   %token TOK_EXTERN   %token TOK_FLOAT_ID   %token TOK_FOR   %token TOK_FUNCTION_ID   %token TOK_GAUGE   %token TOK_GLOBAL   %token TOK_IDENTIFIER   %token TOK_IF   %token TOK_IMPORT   %token TOK_INHERIT + %token TOK_FACET   %token TOK_INLINE   %token TOK_LOCAL_ID   %token TOK_FINAL_ID   %token TOK_INT_ID   %token TOK_LAMBDA   %token TOK_MULTISET_ID   %token TOK_MULTISET_END   %token TOK_MULTISET_START   %token TOK_LSH_EQ   %token TOK_MAPPING_ID
pike.git/src/language.yacc:201:   %type <fnum> TOK_FLOAT      %type <number> TOK_ARRAY_ID   %type <number> TOK_BREAK   %type <number> TOK_CASE   %type <number> TOK_CATCH   %type <number> TOK_CONTINUE   %type <number> TOK_DEFAULT   %type <number> TOK_DO   %type <number> TOK_ELSE + %type <number> TOK_FACET   %type <number> TOK_FLOAT_ID   %type <number> TOK_FOR   %type <number> TOK_FOREACH   %type <number> TOK_FUNCTION_ID   %type <number> TOK_GAUGE   %type <number> TOK_IF   %type <number> TOK_INHERIT   %type <number> TOK_INLINE   %type <number> TOK_INT_ID   %type <number> TOK_LAMBDA
pike.git/src/language.yacc:422:    {    STACK_LEVEL_START(0);       resolv_program($1);    free_node($1);       STACK_LEVEL_DONE(1);    }    ;    + facet: TOK_FACET TOK_IDENTIFIER ':' idents ';' +  { +  struct object *o; +  if (Pike_compiler->compiler_pass == 1) { +  if (Pike_compiler->new_program->facet_class == PROGRAM_IS_FACET_CLASS) { +  yyerror("A class can only belong to one facet"); +  } +  else { +  resolv_constant($4); +  if (Pike_sp[-1].type == T_OBJECT) { +  o = Pike_sp[-1].u.object; +  push_string($2->u.sval.u.string); +  push_int(Pike_compiler->new_program->id); +  push_int(Pike_compiler->new_program->facet_class); +  safe_apply_low3(o, find_identifier("add_facet_class",o->prog), 3, +  "Failed to add facet class to system"); +  if (Pike_sp[-1].type == T_INT && +  Pike_sp[-1].u.integer >= 0) { +  Pike_compiler->new_program->facet_class = PROGRAM_IS_FACET_CLASS; +  Pike_compiler->new_program->facet_index = Pike_sp[-1].u.integer; +  add_ref(Pike_compiler->new_program->facet_group = o); +  } +  else +  yyerror("Could not add facet class to system."); +  pop_n_elems(2); +  } +  else +  yyerror("Illegal facet group specifier."); +  free_node($4); +  } +  } +  } +  ; +  +    inherit_ref:    {    SET_FORCE_RESOLVE($<number>$);    }    low_program_ref    {    UNSET_FORCE_RESOLVE($<number>1);    $$ = $2;    }    ;
pike.git/src/language.yacc:444:    {    if (($1 & ID_EXTERN) && (Pike_compiler->compiler_pass == 1)) {    yywarning("Extern declared inherit.");    }    if($3 && !(Pike_compiler->new_program->flags & PROGRAM_PASS_1_DONE))    {    struct pike_string *s=Pike_sp[-1].u.string;    if($4) s=$4->u.sval.u.string;    compiler_do_inherit($3,$1,s);    } +  +  /* If this is a product class, check that all product classes in its +  * facet-group inherits from all facets */ +  if($3 && Pike_compiler->compiler_pass == 2) { +  if (Pike_compiler->new_program->facet_class==PROGRAM_IS_PRODUCT_CLASS){ +  if (!Pike_compiler->new_program->facet_group) +  yyerror("Invalid facet group."); +  apply(Pike_compiler->new_program->facet_group, +  "product_classes_checked", 0); +  if (Pike_sp[-1].type == T_INT && +  Pike_sp[-1].u.integer == 0) { +  pop_stack(); +  safe_apply_low3(Pike_compiler->new_program->facet_group, +  find_identifier +  ("check_product_classes", +  Pike_compiler->new_program->facet_group->prog), +  0, +  "Error in some product classes"); +  } +  } +  } +     if($4) free_node($4);    pop_stack();    if ($3) free_node($3);    }    | modifiers TOK_INHERIT inherit_ref error ';'    {    if ($3) free_node($3);    pop_stack();    yyerrok;    }
pike.git/src/language.yacc:921:    | modifiers type_or_error optional_stars bad_identifier    {    free_type(compiler_pop_type());    }    '(' arguments ')' block_or_semi    {    if ($9) free_node($9);    }    | modifiers type_or_error name_list ';' {}    | inheritance {} +  | facet {}    | import {}    | constant {}    | class { free_node($1); }    | enum { free_node($1); }    | typedef {}    | error TOK_LEX_EOF    {    reset_type_stack();    yyerror("Missing ';'.");    yyerror("Unexpected end of file");
pike.git/src/language.yacc:1074:    | TOK_ELSE { $$ = "else"; }    | TOK_FOREACH { $$ = "foreach"; }    | TOK_CATCH { $$ = "catch"; }    | TOK_GAUGE { $$ = "gauge"; }    | TOK_CLASS { $$ = "class"; }    | TOK_BREAK { $$ = "break"; }    | TOK_CASE { $$ = "case"; }    | TOK_CONSTANT { $$ = "constant"; }    | TOK_CONTINUE { $$ = "continue"; }    | TOK_DEFAULT { $$ = "default"; } +  | TOK_FACET { $$ = "facet"; }    | TOK_IMPORT { $$ = "import"; }    | TOK_INHERIT { $$ = "inherit"; }    | TOK_LAMBDA { $$ = "lambda"; }    | TOK_PREDEF { $$ = "predef"; }    | TOK_RETURN { $$ = "return"; }    | TOK_SSCANF { $$ = "sscanf"; }    | TOK_SWITCH { $$ = "switch"; }    | TOK_TYPEOF { $$ = "typeof"; }    | TOK_GLOBAL { $$ = "global"; }    ;
pike.git/src/language.yacc:3853:    | TOK_FINAL_ID    { yyerror("final is a reserved word.");}    | TOK_DO    { yyerror("do is a reserved word."); }    | TOK_ELSE    { yyerror("else without if."); }    | TOK_RETURN    { yyerror("return is a reserved word."); }    | TOK_IMPORT    { yyerror("import is a reserved word."); } +  | TOK_FACET +  { yyerror("facet is a reserved word."); }    | TOK_INHERIT    { yyerror("inherit is a reserved word."); }    | TOK_CATCH    { yyerror("catch is a reserved word."); }    | TOK_GAUGE    { yyerror("gauge is a reserved word."); }    | TOK_LAMBDA    { yyerror("lambda is a reserved word."); }    | TOK_SSCANF    { yyerror("sscanf is a reserved word."); }