Branch: Tag:

2000-07-12

2000-07-12 16:10:13 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Added TOK_VARIANT.

Rev: src/language.yacc:1.202

84:   %token TOK_STRING_ID   %token TOK_SUB_EQ   %token TOK_TYPEOF + %token TOK_VARIANT   %token TOK_VOID_ID   %token TOK_WHILE   %token TOK_XOR_EQ
109:   /* This is the grammar definition of Pike. */      #include "global.h" - RCSID("$Id: language.yacc,v 1.201 2000/07/12 12:38:41 grubba Exp $"); + RCSID("$Id: language.yacc,v 1.202 2000/07/12 16:10:13 grubba Exp $");   #ifdef HAVE_MEMORY_H   #include <memory.h>   #endif
628:    }    push_type(T_FUNCTION);    +  if ($1 & ID_VARIANT) { +  /* FIXME: Lookup the type of any existing variant */ +  /* Or the types. */ +  } +     {    struct pike_string *s=compiler_pop_type();    $<n>$=mkstrnode(s);
672:    {    my_yyerror("Missing name for argument %d.",e);    } else { +  if ($1 & ID_VARIANT) { +  /* FIXME: Generate code that checks the arguments. */ +  /* If there is a bad argument, call the fallback, and return. */ +  } else {    /* FIXME: Should probably use some other flag. */    if ((runtime_options & RUNTIME_CHECK_TYPES) &&    (Pike_compiler->compiler_pass == 2) &&
695:    }    }    } +  }       if (check_args) {    /* Prepend the arg checking code. */
846:    | TOK_PUBLIC { $$ = ID_PUBLIC; }    | TOK_PROTECTED { $$ = ID_PROTECTED; }    | TOK_INLINE { $$ = ID_INLINE; } +  | TOK_VARIANT { $$ = ID_VARIANT; }    ;      magic_identifiers1:
859:    | TOK_PROTECTED { $$ = "protected"; }    | TOK_INLINE { $$ = "inline"; }    | TOK_OPTIONAL { $$ = "optional"; } +  | TOK_VARIANT { $$ = "variant"; }    ;      magic_identifiers2:
2949:    { yyerror("public is a reserved word."); }    | TOK_OPTIONAL    { yyerror("optional is a reserved word."); } +  | TOK_VARIANT +  { yyerror("variant is a reserved word."); }    | TOK_STATIC    { yyerror("static is a reserved word."); }    | TOK_EXTERN