pike.git/
src/
language.yacc
Branch:
Tag:
Non-build tags
All tags
No tags
2001-02-26
2001-02-26 22:44:08 by Henrik Grubbström (Grubba) <grubba@grubba.org>
92aeb18a262629bf09e9f8ec15785741e8159c2e (
40
lines) (+
37
/-
3
)
[
Show
|
Annotate
]
Branch:
7.9
Cleaned up use of type_stack_reverse() to support USE_PIKE_TYPE.
Rev: src/language.yacc:1.230
110:
/* This is the grammar definition of Pike. */ #include "global.h"
-
RCSID("$Id: language.yacc,v 1.
229
2001/02/
25
14
:
42
:
55
grubba Exp $");
+
RCSID("$Id: language.yacc,v 1.
230
2001/02/
26
22
:
44
:
08
grubba Exp $");
#ifdef HAVE_MEMORY_H #include <memory.h> #endif
1190:
| TOK_MIXED_ID { push_type(T_MIXED); } | TOK_STRING_ID { push_type(T_STRING); } | TOK_OBJECT_ID opt_object_type {}
-
| TOK_MAPPING_ID opt_mapping_type
{ push_type(T_MAPPING); }
+
| TOK_MAPPING_ID opt_mapping_type
{}
| TOK_ARRAY_ID opt_array_type { push_type(T_ARRAY); } | TOK_MULTISET_ID opt_array_type { push_type(T_MULTISET); }
-
| TOK_FUNCTION_ID opt_function_type
{ push_type(T_FUNCTION); }
+
| TOK_FUNCTION_ID opt_function_type
{}
; type8: type3 | identifier_type ;
1294:
opt_function_type: '(' { type_stack_mark();
+
#ifndef USE_PIKE_TYPE
type_stack_mark();
-
+
#endif /* !USE_PIKE_TYPE */
} function_type_list optional_dot_dot_dot ':' {
1308:
if (Pike_compiler->compiler_pass == 1) { yyerror("Missing type before ... ."); }
+
#ifndef USE_PIKE_TYPE
type_stack_reverse(); type_stack_mark();
-
+
#endif /* !USE_PIKE_TYPE */
push_type(T_MIXED); } }else{
-
+
#ifndef USE_PIKE_TYPE
type_stack_reverse(); type_stack_mark();
-
+
#endif /* !USE_PIKE_TYPE */
push_type(T_VOID); }
-
+
#ifndef USE_PIKE_TYPE
/* Rotate T_MANY into the proper position. */ push_type(T_MANY); type_stack_reverse(); type_stack_mark();
-
+
#endif /* !USE_PIKE_TYPE */
} type7 ')' {
-
+
#ifdef USE_PIKE_TYPE
+
push_reverse_type(T_MANY);
+
Pike_compiler->pike_type_mark_stackp--;
+
while (*Pike_compiler->pike_type_mark_stackp <
+
Pike_compiler->type_stackp) {
+
push_reverse_type(T_FUNCTION);
+
}
+
#else /* !USE_PIKE_TYPE */
type_stack_reverse(); type_stack_reverse();
-
+
push_type(T_FUNCTION);
+
#endif /* USE_PIKE_TYPE */
} | /* empty */ {
1338:
push_type(T_OR); push_type(T_MANY);
+
#ifndef USE_PIKE_TYPE
+
push_type(T_FUNCTION);
+
#endif /* !USE_PIKE_TYPE */
} ;
1348:
function_type_list2: type7 { $$=1; } | function_type_list2 ',' {
+
#ifndef USE_PIKE_TYPE
type_stack_reverse(); type_stack_mark();
-
+
#endif /* !USE_PIKE_TYPE */
} type7 ;
1360:
opt_mapping_type: '(' {
+
#ifndef USE_PIKE_TYPE
type_stack_mark(); type_stack_mark();
-
+
#endif /* !USE_PIKE_TYPE */
} type7 ':' {
-
+
#ifndef USE_PIKE_TYPE
type_stack_reverse(); type_stack_mark();
-
+
#endif /* !USE_PIKE_TYPE */
} type7 {
-
+
#ifdef USE_PIKE_TYPE
+
push_reverse_type(T_MAPPING);
+
#else /* !USE_PIKE_TYPE */
type_stack_reverse(); type_stack_reverse();
-
+
push_type(T_MAPPING);
+
#endif /* USE_PIKE_TYPE */
} ')' | /* empty */ { push_type(T_MIXED); push_type(T_MIXED);
-
+
push_type(T_MAPPING);
} ;