pike.git / src / language.yacc

version» Context lines:

pike.git/src/language.yacc:177:   %left F_LSH F_RSH   %left '+' '-'   %left '*' '%' '/'   %right F_NOT '~'   %nonassoc F_INC F_DEC      %{   /* This is the grammar definition of Pike. */      #include "global.h" - RCSID("$Id: language.yacc,v 1.148 1999/12/16 21:28:34 grubba Exp $"); + RCSID("$Id: language.yacc,v 1.149 1999/12/17 19:47:19 hubbe 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:231:   #endif /* !__cplusplus */   #endif /* !__GNUC__ */      %}      %union   {    int number;    FLOAT_TYPE fnum;    struct node_s *n; +  char *str;   }      %{   /* Needs to be included after YYSTYPE is defined. */   #include "lex.h"   %}      %{   /* Include <stdio.h> our selves, so that we can do our magic    * without being disturbed... */
pike.git/src/language.yacc:297:   %type <number> arguments   %type <number> arguments2   %type <number> func_args   %type <number> assign   %type <number> modifier   %type <number> modifier_list   %type <number> modifiers   %type <number> optional_dot_dot_dot   %type <number> optional_stars    + %type <str> magic_identifiers + %type <str> magic_identifiers1 + %type <str> magic_identifiers2 + %type <str> magic_identifiers3 +    /* The following symbols return type information */      %type <n> number_or_minint   %type <n> number_or_maxint   %type <n> cast   %type <n> soft_cast   %type <n> simple_type   %type <n> simple_type2   %type <n> simple_identifier_type   %type <n> string_constant
pike.git/src/language.yacc:371:   %type <n> statements   %type <n> switch   %type <n> typeof   %type <n> unused   %type <n> unused2   %type <n> while   %type <n> optional_comma_expr   %type <n> low_program_ref   %type <n> local_function   %type <n> local_function2 + %type <n> magic_identifier   %%      all: program { YYACCEPT; }    | program F_LEX_EOF { YYACCEPT; }   /* | error F_LEX_EOF { YYABORT; } */    ;      program: program def optional_semi_colon   /* | error { yyerrok; } */    | /* empty */
pike.git/src/language.yacc:831:   modifier: F_NO_MASK { $$ = ID_NOMASK; }    | F_FINAL_ID { $$ = ID_NOMASK; }    | F_STATIC { $$ = ID_STATIC; }    | F_PRIVATE { $$ = ID_PRIVATE | ID_STATIC; }    | F_LOCAL_ID { $$ = ID_INLINE; }    | F_PUBLIC { $$ = ID_PUBLIC; }    | F_PROTECTED { $$ = ID_PROTECTED; }    | F_INLINE { $$ = ID_INLINE; }    ;    + magic_identifiers1: +  F_NO_MASK { $$ = "nomask"; } +  | F_FINAL_ID { $$ = "final"; } +  | F_STATIC { $$ = "static"; } +  | F_PRIVATE { $$ = "private"; } +  | F_LOCAL_ID { $$ = "local"; } +  | F_PUBLIC { $$ = "public"; } +  | F_PROTECTED { $$ = "protected"; } +  | F_INLINE { $$ = "inline"; } +  ; +  + magic_identifiers2: +  F_VOID_ID { $$ = "void"; } +  | F_MIXED_ID { $$ = "mixed"; } +  | F_ARRAY_ID { $$ = "array"; } +  | F_MAPPING_ID { $$ = "mapping"; } +  | F_MULTISET_ID { $$ = "multiset"; } +  | F_OBJECT_ID { $$ = "object"; } +  | F_FUNCTION_ID { $$ = "function"; } +  | F_PROGRAM_ID { $$ = "program"; } +  | F_STRING_ID { $$ = "string"; } +  | F_FLOAT_ID { $$ = "float"; } +  | F_INT_ID { $$ = "int"; } +  ; +  + magic_identifiers3: +  F_IF { $$ = "if"; } +  | F_DO { $$ = "do"; } +  | F_FOR { $$ = "for"; } +  | F_WHILE { $$ = "while"; } +  | F_ELSE { $$ = "else"; } +  | F_FOREACH { $$ = "foreach"; } +  | F_CATCH { $$ = "catch"; } +  | F_GAUGE { $$ = "gauge"; } +  | F_CLASS { $$ = "class"; } +  | F_BREAK { $$ = "break"; } +  | F_CASE { $$ = "case"; } +  | F_CONSTANT { $$ = "constant"; } +  | F_CONTINUE { $$ = "continue"; } +  | F_DEFAULT { $$ = "default"; } +  | F_IMPORT { $$ = "import"; } +  | F_INHERIT { $$ = "inherit"; } +  | F_LAMBDA { $$ = "lambda"; } +  | F_PREDEF { $$ = "predef"; } +  | F_RETURN { $$ = "return"; } +  | F_SSCANF { $$ = "sscanf"; } +  | F_SWITCH { $$ = "switch"; } +  | F_TYPEOF { $$ = "typeof"; } +  ; +  + magic_identifiers: magic_identifiers1 | magic_identifiers2 | magic_identifiers3 + magic_identifier: magic_identifiers +  { +  struct pike_string *tmp=make_shared_string($1); +  $$=mkstrnode(tmp); +  free_string(tmp); +  } +  | F_IDENTIFIER +  ; +    modifiers: modifier_list    {    $$=current_modifiers=$1 | (lex.pragmas & ID_MODIFIER_MASK);    }    ;      modifier_list: /* empty */ { $$ = 0; }    | modifier modifier_list { $$ = $1 | $2; }    ;   
pike.git/src/language.yacc:1991:    yyerror("Missing '>'.");    $$=0; yyerrok;    }    | F_MULTISET_START error F_LEX_EOF    {    $$=0; yyerror("Missing '>)'.");    yyerror("Unexpected end of file.");    }    | F_MULTISET_START error ';' { $$=0; yyerror("Missing '>)'."); }    | F_MULTISET_START error '}' { $$=0; yyerror("Missing '>)'."); } -  | expr4 F_ARROW F_IDENTIFIER +  | expr4 F_ARROW magic_identifier    {    $$=mknode(F_ARROW,$1,$3);    }    | expr4 F_ARROW bad_identifier {}    | expr4 F_ARROW error {}    ;      idents: low_idents    | idents '.' F_IDENTIFIER    {