Mercurial > hg > octave-lyh
comparison src/parse.y @ 723:1c072f20b522
[project @ 1994-09-21 16:00:10 by jwe]
author | jwe |
---|---|
date | Wed, 21 Sep 1994 16:00:10 +0000 |
parents | fb4f6556b443 |
children | c9f3cb77478d |
comparison
equal
deleted
inserted
replaced
722:c40cdd16121e | 723:1c072f20b522 |
---|---|
233 %type <tree_identifier_type> identifier | 233 %type <tree_identifier_type> identifier |
234 %type <tree_function_type> func_def1 func_def2 func_def3 | 234 %type <tree_function_type> func_def1 func_def2 func_def3 |
235 %type <tree_index_expression_type> variable word_list_cmd | 235 %type <tree_index_expression_type> variable word_list_cmd |
236 %type <tree_colon_expression_type> colon_expr | 236 %type <tree_colon_expression_type> colon_expr |
237 %type <tree_argument_list_type> arg_list word_list | 237 %type <tree_argument_list_type> arg_list word_list |
238 %type <tree_parameter_list_type> param_list param_list1 func_def1a | 238 %type <tree_parameter_list_type> param_list param_list1 |
239 %type <tree_parameter_list_type> return_list return_list1 | |
239 %type <tree_command_type> command func_def | 240 %type <tree_command_type> command func_def |
240 %type <tree_if_command_type> if_command | 241 %type <tree_if_command_type> if_command |
241 %type <tree_if_clause_type> elseif_clause else_clause | 242 %type <tree_if_clause_type> elseif_clause else_clause |
242 %type <tree_if_command_list_type> if_cmd_list1 if_cmd_list | 243 %type <tree_if_command_list_type> if_cmd_list1 if_cmd_list |
243 %type <tree_global_type> global_decl2 | 244 %type <tree_global_type> global_decl2 |
882 ($1->sym_rec (), $1->line (), $1->column ()); | 883 ($1->sym_rec (), $1->line (), $1->column ()); |
883 tree_parameter_list *tpl = new tree_parameter_list (tmp); | 884 tree_parameter_list *tpl = new tree_parameter_list (tmp); |
884 tpl->mark_as_formal_parameters (); | 885 tpl->mark_as_formal_parameters (); |
885 $$ = $5->define_ret_list (tpl); | 886 $$ = $5->define_ret_list (tpl); |
886 } | 887 } |
887 | func_def1a ']' g_symtab '=' func_def2 | 888 | return_list g_symtab '=' func_def2 |
888 { | 889 { |
889 $1->mark_as_formal_parameters (); | 890 $1->mark_as_formal_parameters (); |
890 $$ = $5->define_ret_list ($1); | 891 $$ = $4->define_ret_list ($1); |
891 } | 892 } |
892 ; | 893 ; |
893 | 894 |
894 func_def1a : '[' safe local_symtab identifier | 895 return_list_x : '[' safe local_symtab |
895 { $$ = new tree_parameter_list ($4); } | 896 ; |
896 | func_def1a ',' identifier | 897 |
898 return_list : return_list_x ']' | |
899 { $$ = new tree_parameter_list (); } | |
900 | return_list_x ELLIPSIS ']' | |
901 { | |
902 tree_parameter_list *tmp = new tree_parameter_list (); | |
903 tmp->mark_varargs_only (); | |
904 $$ = tmp; | |
905 } | |
906 | return_list1 ']' | |
907 { $$ = $1; } | |
908 | return_list1 ',' ELLIPSIS ']' | |
909 { | |
910 $1->mark_varargs (); | |
911 $$ = $1; | |
912 } | |
913 ; | |
914 | |
915 return_list1 : return_list_x identifier | |
916 { $$ = new tree_parameter_list ($2); } | |
917 | return_list_x error | |
918 { | |
919 yyerror ("parse error"); | |
920 error ("invalid function return list"); | |
921 ABORT_PARSE; | |
922 } | |
923 | return_list1 ',' identifier | |
897 { $1->append ($3); } | 924 { $1->append ($3); } |
898 ; | 925 ; |
899 | 926 |
900 func_def2 : identifier safe local_symtab func_def3 | 927 func_def2 : identifier safe local_symtab func_def3 |
901 { | 928 { |