home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Gadgets 1
/
ADE-1.bin
/
ade-dist
/
octave-1.1.1p1-src.tgz
/
tar.out
/
fsf
/
octave
/
src
/
parse.cc
< prev
next >
Wrap
C/C++ Source or Header
|
1996-09-28
|
97KB
|
2,992 lines
/* A Bison parser, made from parse.y with Bison version GNU Bison version 1.22
*/
#define YYBISON 1 /* Identify Bison output. */
#define EXPR_AND_AND 258
#define EXPR_OR_OR 259
#define EXPR_AND 260
#define EXPR_OR 261
#define EXPR_NOT 262
#define EXPR_LT 263
#define EXPR_LE 264
#define EXPR_EQ 265
#define EXPR_NE 266
#define EXPR_GE 267
#define EXPR_GT 268
#define LEFTDIV 269
#define EMUL 270
#define EDIV 271
#define ELEFTDIV 272
#define QUOTE 273
#define TRANSPOSE 274
#define PLUS_PLUS 275
#define MINUS_MINUS 276
#define POW 277
#define EPOW 278
#define NUM 279
#define IMAG_NUM 280
#define NAME 281
#define SCREW 282
#define END 283
#define PLOT 284
#define TEXT 285
#define STYLE 286
#define FOR 287
#define WHILE 288
#define IF 289
#define ELSEIF 290
#define ELSE 291
#define BREAK 292
#define CONTINUE 293
#define FUNC_RET 294
#define UNWIND 295
#define CLEANUP 296
#define GLOBAL 297
#define TEXT_ID 298
#define LEXICAL_ERROR 299
#define FCN 300
#define SCREW_TWO 301
#define ELLIPSIS 302
#define ALL_VA_ARGS 303
#define END_OF_INPUT 304
#define USING 305
#define TITLE 306
#define WITH 307
#define COLON 308
#define OPEN_BRACE 309
#define CLOSE_BRACE 310
#define CLEAR 311
#define UNARY 312
#line 27 "parse.y"
#define YYDEBUG 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <strstream.h>
#include "SLStack.h"
#include "Matrix.h"
#include "octave-hist.h"
#include "user-prefs.h"
#include "tree-base.h"
#include "tree-expr.h"
#include "tree-cmd.h"
#include "tree-const.h"
#include "tree-misc.h"
#include "variables.h"
#include "tree-plot.h"
#include "octave.h"
#include "symtab.h"
#include "parse.h"
#include "token.h"
#include "error.h"
#include "pager.h"
#include "input.h"
#include "utils.h"
#include "lex.h"
// Nonzero means we're in the middle of defining a function.
int defining_func = 0;
// Nonzero means we're in the middle of defining a loop.
int looping = 0;
// Nonzero means we're in the middle of defining a conditional expression.
int iffing = 0;
// Nonzero means we need to do some extra lookahead to avoid being
// screwed by bogus function syntax.
int maybe_screwed = 0;
// Nonzero means we need to do some extra lookahead to avoid being
// screwed by bogus function syntax.
int maybe_screwed_again = 0;
// Temporary symbol table pointer used to cope with bogus function syntax.
symbol_table *tmp_local_sym_tab = 0;
// Stack to hold list of literal matrices.
SLStack <tree_matrix *> ml;
// A nonzero element corresponding to an element of ml means we just
// started reading a new matrix. This should probably be part of a
// new struct for matrix lists...
SLStack <int> mlnm;
// The current input line number.
int input_line_number = 0;
// The column of the current token.
int current_input_column = 1;
// Buffer for help text snagged from function files.
char *help_buf = 0;
// Nonzero means we're working on a plot command.
int plotting = 0;
// Nonzero means we've seen something that means we must be past the
// range part of a plot command.
int past_plot_range = 0;
// Nonzero means we're looking at the range part of a plot command.
int in_plot_range = 0;
// Nonzero means we're looking at the using part of a plot command.
int in_plot_using = 0;
// Nonzero means we're looking at the style part of a plot command.
int in_plot_style = 0;
// Nonzero means we're looking at an indirect reference to a structure
// element.
int looking_at_indirect_ref = 0;
// Forward declarations for some functions defined at the bottom of
// the file.
// Generic error messages.
static void yyerror (char *s);
// Error mesages for mismatched end tokens.
static void end_error (char *type, token::end_tok_type ettype, int l, int c);
// Check to see that end tokens are properly matched.
static int check_end (token *tok, token::end_tok_type expected);
// Try to figure out early if an expression should become an
// assignment to the builtin variable ans.
static tree_expression *maybe_convert_to_ans_assign (tree_expression *expr);
// Maybe print a warning if an assignment expression is used as the
// test in a logical expression.
static void maybe_warn_assign_as_truth_value (tree_expression *expr);
// Build a binary expression.
static tree_expression *make_binary_op
(int op, tree_expression *op1, token *tok_val, tree_expression *op2);
// Build a prefix expression.
static tree_expression *make_prefix_op
(int op, tree_identifier *op1, token *tok_val);
// Build a postfix expression.
static tree_expression *make_postfix_op
(int op, tree_identifier *op1, token *tok_val);
// Build a binary expression.
static tree_expression *make_unary_op
(int op, tree_expression *op1, token *tok_val);
// Make an expression that handles assignment of multiple values.
static tree_expression *make_multi_val_ret
(tree_expression *rhs, int l = -1, int c = -1);
// Make an index expression.
static tree_index_expression *make_index_expression
(tree_indirect_ref *indir, tree_argument_list *args);
#define ABORT_PARSE \
do \
{ \
global_command = 0; \
yyerrok; \
if (interactive) \
YYACCEPT; \
else \
YYABORT; \
} \
while (0)
#line 176 "parse.y"
typedef union
{
// The type of the basic tokens returned by the lexer.
token *tok_val;
// Types for the nonterminals we generate.
tree *tree_type;
tree_expression *tree_expression_type;
tree_constant *tree_constant_type;
tree_matrix *tree_matrix_type;
tree_identifier *tree_identifier_type;
tree_indirect_ref *tree_indirect_ref_type;
tree_function *tree_function_type;
tree_index_expression *tree_index_expression_type;
tree_colon_expression *tree_colon_expression_type;
tree_argument_list *tree_argument_list_type;
tree_parameter_list *tree_parameter_list_type;
tree_command *tree_command_type;
tree_if_command *tree_if_command_type;
tree_if_clause *tree_if_clause_type;
tree_if_command_list *tree_if_command_list_type;
tree_global *tree_global_type;
tree_global_init_list *tree_global_init_list_type;
tree_global_command *tree_global_command_type;
tree_statement *tree_statement_type;
tree_statement_list *tree_statement_list_type;
tree_plot_command *tree_plot_command_type;
subplot *subplot_type;
subplot_list *subplot_list_type;
plot_limits *plot_limits_type;
plot_range *plot_range_type;
subplot_using *subplot_using_type;
subplot_style *subplot_style_type;
} YYSTYPE;
#ifndef YYLTYPE
typedef
struct yyltype
{
int timestamp;
int first_line;
int first_column;
int last_line;
int last_column;
char *text;
}
yyltype;
#define YYLTYPE yyltype
#endif
#include <stdio.h>
#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif
#define YYFINAL 330
#define YYFLAG -32768
#define YYNTBASE 72
#define YYTRANSLATE(x) ((unsigned)(x) <= 312 ? yytranslate[x] : 141)
static const char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 65,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 68,
69, 7, 6, 64, 5, 71, 8, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 4, 63, 2,
3, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
67, 2, 70, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 1, 2, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
62, 66
};
#if YYDEBUG != 0
static const short yyprhs[] = { 0,
0, 2, 4, 7, 9, 11, 13, 16, 19, 21,
23, 25, 27, 29, 32, 35, 37, 40, 43, 47,
51, 53, 56, 59, 61, 64, 67, 69, 71, 74,
76, 79, 80, 82, 84, 87, 90, 92, 96, 100,
102, 104, 107, 110, 114, 116, 119, 123, 129, 134,
139, 143, 146, 147, 149, 153, 155, 158, 160, 162,
164, 167, 170, 173, 176, 179, 182, 186, 190, 194,
198, 202, 206, 208, 211, 214, 218, 221, 224, 228,
234, 235, 237, 240, 242, 246, 248, 252, 253, 255,
257, 259, 261, 263, 271, 277, 285, 287, 289, 291,
295, 297, 300, 304, 307, 313, 317, 318, 320, 322,
324, 326, 329, 332, 335, 336, 340, 344, 351, 353,
355, 358, 361, 364, 367, 371, 375, 379, 383, 387,
391, 395, 399, 403, 407, 411, 415, 419, 423, 427,
431, 435, 439, 443, 447, 449, 451, 453, 457, 459,
461, 463, 466, 470, 472, 475, 478, 481, 484, 487,
491, 495, 498, 500, 503, 504, 505, 506, 507, 512,
517, 523, 528, 532, 535, 539, 542, 547, 550, 553,
557, 562, 567, 571, 573, 575, 577, 579, 580, 585,
587, 591, 596, 599, 602, 606, 609, 614, 617, 621,
624, 628, 630, 632, 634, 636, 640, 644, 648, 653,
655, 658, 660, 664, 666, 669, 671
};
static const short yyrhs[] = { 73,
0, 55, 0, 75, 74, 0, 74, 0, 65, 0,
75, 0, 75, 65, 0, 75, 55, 0, 50, 0,
1, 0, 77, 0, 78, 0, 76, 0, 76, 77,
0, 76, 78, 0, 84, 0, 77, 84, 0, 78,
84, 0, 76, 77, 84, 0, 76, 78, 84, 0,
63, 0, 77, 64, 0, 77, 63, 0, 64, 0,
78, 63, 0, 78, 64, 0, 64, 0, 65, 0,
79, 108, 0, 63, 0, 80, 108, 0, 0, 82,
0, 83, 0, 83, 79, 0, 83, 80, 0, 84,
0, 83, 79, 84, 0, 83, 80, 84, 0, 101,
0, 96, 0, 35, 62, 0, 35, 88, 0, 35,
86, 88, 0, 87, 0, 87, 87, 0, 87, 87,
87, 0, 60, 110, 59, 110, 61, 0, 60, 59,
110, 61, 0, 60, 110, 59, 61, 0, 60, 59,
61, 0, 60, 61, 0, 0, 89, 0, 88, 64,
89, 0, 110, 0, 110, 90, 0, 91, 0, 93,
0, 94, 0, 91, 93, 0, 93, 91, 0, 91,
94, 0, 94, 91, 0, 93, 94, 0, 94, 93,
0, 91, 93, 94, 0, 91, 94, 93, 0, 93,
91, 94, 0, 93, 94, 91, 0, 94, 91, 93,
0, 94, 93, 91, 0, 92, 0, 92, 110, 0,
56, 110, 0, 92, 59, 110, 0, 57, 110, 0,
58, 37, 0, 58, 37, 110, 0, 58, 37, 110,
95, 110, 0, 0, 110, 0, 48, 98, 0, 99,
0, 98, 100, 99, 0, 134, 0, 134, 3, 110,
0, 0, 64, 0, 85, 0, 120, 0, 97, 0,
102, 0, 46, 107, 81, 47, 107, 81, 34, 0,
39, 110, 107, 81, 34, 0, 38, 131, 3, 110,
107, 81, 34, 0, 43, 0, 44, 0, 45, 0,
40, 103, 34, 0, 104, 0, 104, 106, 0, 110,
107, 81, 0, 104, 105, 0, 41, 107, 110, 107,
81, 0, 42, 107, 81, 0, 0, 108, 0, 64,
0, 63, 0, 65, 0, 108, 64, 0, 108, 63,
0, 108, 65, 0, 0, 131, 3, 110, 0, 30,
3, 110, 0, 67, 109, 139, 52, 3, 110, 0,
111, 0, 112, 0, 134, 26, 0, 134, 27, 0,
111, 24, 0, 111, 25, 0, 111, 28, 111, 0,
111, 29, 111, 0, 111, 6, 111, 0, 111, 5,
111, 0, 111, 7, 111, 0, 111, 8, 111, 0,
111, 21, 111, 0, 111, 22, 111, 0, 111, 20,
111, 0, 111, 23, 111, 0, 111, 14, 111, 0,
111, 15, 111, 0, 111, 16, 111, 0, 111, 18,
111, 0, 111, 19, 111, 0, 111, 17, 111, 0,
111, 9, 111, 0, 111, 10, 111, 0, 111, 11,
111, 0, 111, 12, 111, 0, 30, 0, 31, 0,
36, 0, 68, 110, 69, 0, 114, 0, 131, 0,
136, 0, 67, 70, 0, 67, 63, 70, 0, 113,
0, 26, 134, 0, 27, 134, 0, 13, 111, 0,
6, 111, 0, 5, 111, 0, 111, 4, 111, 0,
113, 4, 111, 0, 134, 115, 0, 36, 0, 115,
36, 0, 0, 0, 0, 0, 51, 116, 119, 121,
0, 51, 116, 119, 125, 0, 33, 118, 116, 3,
125, 0, 123, 116, 3, 125, 0, 67, 118, 117,
0, 122, 70, 0, 122, 53, 70, 0, 124, 70,
0, 124, 64, 53, 70, 0, 122, 134, 0, 122,
1, 0, 124, 64, 134, 0, 134, 118, 117, 126,
0, 132, 107, 81, 127, 0, 107, 81, 127, 0,
34, 0, 55, 0, 129, 0, 134, 0, 0, 129,
71, 130, 49, 0, 128, 0, 128, 68, 69, 0,
128, 68, 135, 69, 0, 128, 67, 0, 68, 69,
0, 68, 53, 69, 0, 133, 69, 0, 133, 64,
53, 69, 0, 68, 134, 0, 133, 64, 134, 0,
68, 1, 0, 133, 64, 1, 0, 32, 0, 4,
0, 110, 0, 54, 0, 135, 64, 4, 0, 135,
64, 110, 0, 135, 64, 54, 0, 67, 109, 137,
70, 0, 138, 0, 138, 63, 0, 139, 0, 138,
63, 139, 0, 140, 0, 140, 64, 0, 110, 0,
140, 64, 110, 0
};
#endif
#if YYDEBUG != 0
static const short yyrline[] = { 0,
290, 296, 302, 304, 308, 310, 312, 314, 318, 320,
323, 325, 327, 329, 334, 338, 340, 342, 344, 350,
354, 355, 356, 359, 360, 361, 364, 365, 366, 369,
370, 373, 375, 379, 381, 383, 390, 395, 397, 405,
407, 409, 417, 434, 453, 455, 457, 461, 463, 465,
467, 469, 473, 475, 477, 481, 483, 490, 492, 494,
496, 498, 500, 502, 504, 506, 508, 510, 512, 514,
516, 518, 522, 527, 534, 539, 543, 547, 549, 551,
555, 558, 562, 569, 571, 574, 576, 585, 586, 594,
596, 598, 600, 606, 614, 623, 631, 641, 652, 663,
671, 673, 677, 683, 687, 694, 698, 699, 702, 703,
704, 705, 706, 707, 710, 714, 717, 723, 730, 734,
736, 738, 740, 742, 744, 746, 748, 750, 752, 754,
756, 758, 760, 762, 764, 766, 768, 770, 772, 774,
776, 778, 780, 782, 786, 792, 799, 801, 806, 808,
810, 812, 817, 822, 824, 826, 828, 830, 832, 836,
839, 847, 854, 859, 868, 872, 876, 880, 884, 890,
898, 906, 913, 916, 918, 924, 926, 933, 935, 940,
944, 999, 1004, 1008, 1016, 1023, 1029, 1034, 1035, 1038,
1040, 1042, 1044, 1053, 1058, 1065, 1070, 1078, 1080, 1082,
1087, 1094, 1101, 1108, 1110, 1117, 1124, 1126, 1135, 1144,
1145, 1148, 1149, 1152, 1153, 1156, 1173
};
static const char * const yytname[] = { "$","error","$illegal.","'='","':'",
"'-'","'+'","'*'","'/'","EXPR_AND_AND","EXPR_OR_OR","EXPR_AND","EXPR_OR","EXPR_NOT",
"EXPR_LT","EXPR_LE","EXPR_EQ","EXPR_NE","EXPR_GE","EXPR_GT","LEFTDIV","EMUL",
"EDIV","ELEFTDIV","QUOTE","TRANSPOSE","PLUS_PLUS","MINUS_MINUS","POW","EPOW",
"NUM","IMAG_NUM","NAME","SCREW","END","PLOT","TEXT","STYLE","FOR","WHILE","IF",
"ELSEIF","ELSE","BREAK","CONTINUE","FUNC_RET","UNWIND","CLEANUP","GLOBAL","TEXT_ID",
"LEXICAL_ERROR","FCN","SCREW_TWO","ELLIPSIS","ALL_VA_ARGS","END_OF_INPUT","USING",
"TITLE","WITH","COLON","OPEN_BRACE","CLOSE_BRACE","CLEAR","';'","','","'\\n'",
"UNARY","'['","'('","')'","']'","'.'","input","input1","parse_error","simple_list",
"simple_list1","semi_comma","comma_semi","comma_nl_sep","semi_sep","opt_list",
"list","list1","statement","plot_command","ranges","ranges1","plot_command1",
"plot_command2","plot_options","using","using1","title","style","bogus_syntax",
"ans_expression","global_decl","global_decl1","global_decl2","optcomma","command",
"if_command","if_cmd_list","if_cmd_list1","elseif_clause","else_clause","optsep",
"sep","screwed_again","expression","simple_expr","simple_expr1","colon_expr",
"word_list_cmd","word_list","g_symtab","local_symtab","safe","are_we_screwed",
"func_def","func_def1","return_list_x","return_list","return_list1","func_def2",
"func_def3","fcn_end_or_eof","indirect_ref","indirect_ref1","@1","variable",
"param_list","param_list1","identifier","arg_list","matrix","rows","rows1","matrix_row",
"matrix_row1",""
};
#endif
static const short yyr1[] = { 0,
72, 72, 72, 72, 73, 73, 73, 73, 74, 74,
75, 75, 75, 75, 75, 76, 76, 76, 76, 76,
77, 77, 77, 78, 78, 78, 79, 79, 79, 80,
80, 81, 81, 82, 82, 82, 83, 83, 83, 84,
84, 84, 85, 85, 86, 86, 86, 87, 87, 87,
87, 87, 88, 88, 88, 89, 89, 90, 90, 90,
90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
90, 90, 91, 91, 92, 92, 93, 94, 94, 94,
95, 96, 97, 98, 98, 99, 99, 100, 100, 101,
101, 101, 101, 101, 101, 101, 101, 101, 101, 102,
103, 103, 104, 104, 105, 106, 107, 107, 108, 108,
108, 108, 108, 108, 109, 110, 110, 110, 110, 111,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 113,
113, 114, 115, 115, 116, 117, 118, 119, 120, 120,
121, 121, 122, 123, 123, 123, 123, 124, 124, 124,
125, 126, 126, 127, 127, 128, 129, 130, 129, 131,
131, 131, 131, 132, 132, 132, 132, 133, 133, 133,
133, 134, 135, 135, 135, 135, 135, 135, 136, 137,
137, 138, 138, 139, 139, 140, 140
};
static const short yyr2[] = { 0,
1, 1, 2, 1, 1, 1, 2, 2, 1, 1,
1, 1, 1, 2, 2, 1, 2, 2, 3, 3,
1, 2, 2, 1, 2, 2, 1, 1, 2, 1,
2, 0, 1, 1, 2, 2, 1, 3, 3, 1,
1, 2, 2, 3, 1, 2, 3, 5, 4, 4,
3, 2, 0, 1, 3, 1, 2, 1, 1, 1,
2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
3, 3, 1, 2, 2, 3, 2, 2, 3, 5,
0, 1, 2, 1, 3, 1, 3, 0, 1, 1,
1, 1, 1, 7, 5, 7, 1, 1, 1, 3,
1, 2, 3, 2, 5, 3, 0, 1, 1, 1,
1, 2, 2, 2, 0, 3, 3, 6, 1, 1,
2, 2, 2, 2, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 1, 1, 1, 3, 1, 1,
1, 2, 3, 1, 2, 2, 2, 2, 2, 3,
3, 2, 1, 2, 0, 0, 0, 0, 4, 4,
5, 4, 3, 2, 3, 2, 4, 2, 2, 3,
4, 4, 3, 1, 1, 1, 1, 0, 4, 1,
3, 4, 2, 2, 3, 2, 4, 2, 3, 2,
3, 1, 1, 1, 1, 3, 3, 3, 4, 1,
2, 1, 3, 1, 2, 1, 3
};
static const short yydefact[] = { 0,
10, 0, 0, 0, 0, 0, 145, 146, 202, 53,
147, 0, 0, 0, 97, 98, 99, 107, 0, 9,
165, 2, 21, 24, 5, 115, 0, 1, 4, 0,
13, 11, 12, 16, 90, 41, 92, 40, 93, 82,
119, 120, 154, 149, 91, 190, 186, 150, 187, 151,
145, 115, 159, 150, 158, 157, 155, 156, 0, 0,
42, 53, 45, 43, 54, 56, 0, 187, 107, 0,
101, 107, 110, 109, 111, 32, 108, 83, 84, 86,
168, 0, 152, 0, 0, 8, 7, 3, 14, 15,
23, 22, 17, 25, 26, 18, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 123, 124, 0, 0, 0,
193, 0, 188, 0, 121, 122, 163, 162, 0, 117,
0, 52, 0, 44, 46, 0, 0, 0, 0, 57,
58, 73, 59, 60, 0, 32, 100, 107, 107, 104,
102, 32, 0, 33, 34, 37, 113, 112, 114, 89,
0, 0, 0, 153, 216, 0, 210, 212, 214, 148,
19, 20, 160, 128, 127, 129, 130, 141, 142, 143,
144, 135, 136, 137, 140, 138, 139, 133, 131, 132,
134, 125, 126, 161, 203, 205, 191, 204, 0, 0,
116, 164, 212, 51, 0, 0, 47, 55, 75, 77,
78, 61, 63, 0, 74, 62, 65, 64, 66, 107,
0, 0, 32, 103, 107, 30, 27, 28, 35, 36,
85, 87, 167, 167, 169, 0, 165, 0, 170, 167,
209, 211, 0, 215, 0, 192, 189, 49, 50, 0,
79, 67, 68, 76, 69, 70, 71, 72, 32, 95,
107, 106, 32, 38, 29, 39, 31, 165, 166, 179,
0, 174, 178, 0, 0, 176, 166, 213, 0, 217,
206, 208, 207, 48, 0, 0, 32, 0, 0, 173,
175, 0, 0, 180, 107, 118, 80, 96, 105, 94,
0, 172, 177, 0, 32, 181, 107, 0, 171, 200,
0, 194, 198, 0, 32, 0, 196, 195, 184, 185,
183, 0, 201, 0, 199, 182, 197, 0, 0, 0
};
static const short yydefgoto[] = { 328,
28, 29, 30, 31, 32, 33, 229, 230, 153, 154,
155, 156, 35, 62, 63, 64, 65, 140, 141, 142,
143, 144, 285, 36, 37, 78, 79, 161, 38, 39,
70, 71, 150, 151, 76, 77, 84, 40, 41, 42,
43, 44, 128, 81, 290, 268, 163, 45, 235, 236,
237, 238, 239, 306, 321, 46, 47, 200, 48, 307,
308, 49, 199, 50, 166, 167, 168, 169
};
static const short yypact[] = { 355,
-32768, 627, 627, 627, 17, 17, 55,-32768,-32768, 233,
-32768, 17, 655, 655,-32768,-32768,-32768, 36, 17,-32768,
-32768,-32768,-32768,-32768,-32768, -29, 655,-32768,-32768, 47,
-31, 446, 490,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
735,-32768, 67,-32768,-32768, -22, 8, 100, 4,-32768,
-32768, -29, 80,-32768, 80, 80,-32768,-32768, 655, 562,
-32768, 655, 23, 58,-32768, 68, 133,-32768, 36, 53,
91, 36,-32768,-32768,-32768, 534, 109, -9,-32768, 148,
-32768, 83,-32768, 655, 88,-32768,-32768,-32768, 446, 490,
-32768,-32768,-32768,-32768,-32768,-32768, 627, 627, 627, 627,
627, 627, 627, 627, 627, 627, 627, 627, 627, 627,
627, 627, 627, 627, 627,-32768,-32768, 627, 627, 627,
-32768, 114,-32768, 655,-32768,-32768,-32768, 119, 655,-32768,
37,-32768, 102, 58, 23, 655, 655, 655, 132,-32768,
81, 578, 57, 86, 655, 534,-32768, 36, 36,-32768,
-32768, 534, 123,-32768, 115,-32768,-32768,-32768,-32768,-32768,
17, 655, -6,-32768,-32768, 105, 113, 134, 127,-32768,
-32768,-32768, 812, 260, 260, 82, 82, 761, 761, 787,
787, 704, 704, 704, 704, 704, 704, 82, 82, 82,
82, 80, 80, 812,-32768,-32768,-32768,-32768, -7, 143,
-32768,-32768,-32768,-32768, 135, 612,-32768,-32768,-32768,-32768,
655, 137, 136, 655,-32768, 137, 141, 136, 141, 36,
165, 655, 534,-32768, 36,-32768,-32768,-32768, 402, 402,
-32768,-32768,-32768,-32768,-32768, 21,-32768, 2,-32768,-32768,
-32768, 655, 197, 655, 158,-32768,-32768,-32768,-32768, 144,
670,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 534,-32768,
36,-32768, 534,-32768, 109,-32768, 109,-32768,-32768,-32768,
138,-32768,-32768, 199, -16,-32768,-32768,-32768, 655,-32768,
-32768,-32768,-32768,-32768, 655, 170, 534, 173, 206,-32768,
-32768, 17, 140,-32768, 84,-32768,-32768,-32768,-32768,-32768,
17,-32768,-32768, 12, 534,-32768, 36, 6,-32768,-32768,
142,-32768,-32768, 5, 534, 24,-32768,-32768,-32768,-32768,
-32768, 5,-32768, 146,-32768,-32768,-32768, 213, 216,-32768
};
static const short yypgoto[] = {-32768,
-32768, 190,-32768,-32768, 191, 192,-32768,-32768, -128,-32768,
-32768, 3,-32768,-32768, -53, 159, 92,-32768, -123,-32768,
-133, -126,-32768,-32768,-32768,-32768, 63,-32768,-32768,-32768,
-32768,-32768,-32768,-32768, -60, -63, 177, -8, 239,-32768,
-32768,-32768,-32768, -209, -47, -156,-32768,-32768,-32768,-32768,
-32768,-32768, -263,-32768, -82,-32768,-32768,-32768, 215,-32768,
-32768, -5,-32768,-32768,-32768,-32768, -125,-32768
};
#define YYLAST 841
static const short yytable[] = { 57,
58, 66, 34, 203, 69, 72, 68, 212, 146, 135,
219, 152, 310, 80, 213, 9, 217, 221, 85, 216,
218, 270, -88, 224, 323, 9, 233, 274, 302, 125,
126, 23, 24, 82, 93, 96, 293, 309, 319, 127,
83, 2, 3, 9, 121, 122, -6, 1, 9, 4,
130, 133, 9, 66, 160, 9, 245, 59, 289, 320,
234, 246, 5, 6, 311, 275, 7, 8, 9, 316,
120, 276, 11, 271, 317, 165, 324, 269, 123, 253,
312, 207, 60, 277, 257, 252, 147, 222, 223, 255,
272, 171, 172, 256, 262, 258, 20, 204, 73, 74,
75, 86, 124, 26, 27, 116, 117, 118, 119, 118,
119, 87, 137, 198, 139, 201, 278, 195, 2, 3,
165, 136, 205, 137, 138, 139, 4, 66, 209, 210,
286, 148, 149, 215, 288, 145, 220, 138, 139, 5,
6, 137, 138, 7, 8, 9, 73, 74, 75, 11,
162, 304, 164, 232, 202, 80, 170, 240, 299, 259,
206, 281, 2, 3, 263, 265, 267, 196, 211, 225,
4, 157, 158, 159, 241, 242, 314, 226, 227, 228,
26, 27, 197, 5, 6, 243, 322, 7, 8, 9,
244, 247, 138, 11, 139, 248, 137, 250, 260, 279,
287, 292, 251, 298, 284, 254, 300, 291, 301, 303,
318, 282, 329, 261, 327, 330, 54, 54, 54, 88,
134, 89, 90, 231, 26, 27, 67, 208, 129, 295,
273, 264, 266, 165, 305, 280, 283, 2, 3, 326,
53, 55, 56, 0, 0, 4, 315, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 5, 6,
0, 0, 7, 8, 9, 0, 100, 101, 11, 294,
296, 0, 0, 0, 0, 0, 297, 0, 0, 112,
113, 114, 115, 116, 117, 0, 240, 118, 119, 0,
0, 0, 60, 0, 61, 240, 0, 0, 313, 26,
27, 0, 0, 0, 0, 0, 0, 0, 0, 0,
325, 54, 54, 54, 54, 54, 54, 54, 54, 54,
54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
0, 0, 54, 54, 54, 173, 174, 175, 176, 177,
178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
188, 189, 190, 191, 0, 1, 192, 193, 194, 2,
3, 0, 0, 0, 0, 0, 0, 4, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 6, 0, 0, 7, 8, 9, 0, 0, 10,
11, 0, 12, 13, 14, 0, 0, 15, 16, 17,
18, 0, 19, 0, 20, 21, 2, 3, 0, 22,
0, 0, 0, 0, 4, 0, 0, 23, 24, 25,
0, 26, 27, 0, 0, 0, 0, 5, 6, 0,
0, 7, 8, 9, 0, 0, 10, 11, 0, 12,
13, 14, 0, 0, 15, 16, 17, 18, 0, 19,
2, 3, 21, 0, 0, 0, 0, 0, 4, 0,
0, 0, 0, 0, 73, 74, 75, 0, 26, 27,
0, 5, 6, 0, 0, 7, 8, 9, 0, 0,
10, 11, 0, 12, 13, 14, 0, 0, 15, 16,
17, 18, 0, 19, 2, 3, 21, 0, 0, 0,
0, 0, 4, 0, 0, 0, 0, 0, 91, 92,
0, 0, 26, 27, 0, 5, 6, 0, 0, 7,
8, 9, 0, 0, 10, 11, 0, 12, 13, 14,
0, 0, 15, 16, 17, 18, 0, 19, 2, 3,
21, 0, 0, 0, 0, 0, 4, 0, 0, 0,
0, 0, 94, 95, 0, 0, 26, 27, 0, 5,
6, 0, 0, 7, 8, 9, 2, 3, 10, 11,
0, 12, 13, 14, 4, 0, 15, 16, 17, 18,
0, 19, 2, 3, 21, 0, 0, 5, 6, 0,
4, 7, 8, 9, 0, 0, 0, 11, 0, 0,
26, 27, 0, 5, 6, 0, 0, 7, 8, 9,
0, 0, 0, 11, 0, 0, 2, 3, 0, 0,
131, 0, 132, 0, 4, 0, 0, 0, 26, 27,
0, 2, 3, 0, 0, 0, 214, 5, 6, 4,
0, 7, 8, 9, 26, 27, 0, 11, 0, 0,
0, 0, 5, 6, 0, 0, 51, 8, 9, 2,
3, 0, 11, 0, 0, 0, 0, 4, 0, 0,
0, 0, 249, 0, -81, -81, 0, 0, 26, 27,
5, 6, -81, 0, 7, 8, 9, 0, 0, 0,
11, 0, 0, 52, 27, -81, -81, 0, 0, -81,
-81, -81, 0, 0, 0, -81, 0, 97, 98, 99,
100, 101, 0, 0, 0, 0, 0, 0, 0, 0,
0, 26, 27, 112, 113, 114, 115, 116, 117, 0,
0, 118, 119, 0, 0, 0, -81, -81, 97, 98,
99, 100, 101, 102, 103, 104, 105, 0, 106, 107,
108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
0, 0, 118, 119, 97, 98, 99, 100, 101, 0,
0, 104, 105, 0, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 0, 0, 118, 119,
97, 98, 99, 100, 101, 0, 0, 0, 0, 0,
106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
116, 117, 0, 0, 118, 119, 98, 99, 100, 101,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 112, 113, 114, 115, 116, 117, 0, 0, 118,
119
};
static const short yycheck[] = { 5,
6, 10, 0, 129, 13, 14, 12, 141, 69, 63,
144, 72, 1, 19, 141, 32, 143, 146, 27, 143,
144, 1, 32, 152, 1, 32, 33, 237, 292, 26,
27, 63, 64, 63, 32, 33, 53, 301, 34, 36,
70, 5, 6, 32, 67, 68, 0, 1, 32, 13,
59, 60, 32, 62, 64, 32, 64, 3, 268, 55,
67, 69, 26, 27, 53, 64, 30, 31, 32, 64,
4, 70, 36, 53, 69, 84, 53, 234, 71, 213,
69, 135, 60, 240, 218, 212, 34, 148, 149, 216,
70, 89, 90, 217, 223, 219, 50, 61, 63, 64,
65, 55, 3, 67, 68, 24, 25, 28, 29, 28,
29, 65, 56, 122, 58, 124, 242, 4, 5, 6,
129, 64, 131, 56, 57, 58, 13, 136, 137, 138,
259, 41, 42, 142, 263, 3, 145, 57, 58, 26,
27, 56, 57, 30, 31, 32, 63, 64, 65, 36,
3, 68, 70, 162, 36, 161, 69, 163, 287, 220,
59, 4, 5, 6, 225, 229, 230, 54, 37, 47,
13, 63, 64, 65, 70, 63, 305, 63, 64, 65,
67, 68, 69, 26, 27, 52, 315, 30, 31, 32,
64, 49, 57, 36, 58, 61, 56, 206, 34, 3,
261, 3, 211, 34, 61, 214, 34, 70, 3, 70,
69, 54, 0, 222, 69, 0, 2, 3, 4, 30,
62, 31, 31, 161, 67, 68, 12, 136, 52, 277,
236, 229, 230, 242, 295, 244, 245, 5, 6, 322,
2, 3, 4, -1, -1, 13, 307, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 26, 27,
-1, -1, 30, 31, 32, -1, 7, 8, 36, 275,
279, -1, -1, -1, -1, -1, 285, -1, -1, 20,
21, 22, 23, 24, 25, -1, 292, 28, 29, -1,
-1, -1, 60, -1, 62, 301, -1, -1, 304, 67,
68, -1, -1, -1, -1, -1, -1, -1, -1, -1,
316, 97, 98, 99, 100, 101, 102, 103, 104, 105,
106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
-1, -1, 118, 119, 120, 97, 98, 99, 100, 101,
102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, -1, 1, 118, 119, 120, 5,
6, -1, -1, -1, -1, -1, -1, 13, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
26, 27, -1, -1, 30, 31, 32, -1, -1, 35,
36, -1, 38, 39, 40, -1, -1, 43, 44, 45,
46, -1, 48, -1, 50, 51, 5, 6, -1, 55,
-1, -1, -1, -1, 13, -1, -1, 63, 64, 65,
-1, 67, 68, -1, -1, -1, -1, 26, 27, -1,
-1, 30, 31, 32, -1, -1, 35, 36, -1, 38,
39, 40, -1, -1, 43, 44, 45, 46, -1, 48,
5, 6, 51, -1, -1, -1, -1, -1, 13, -1,
-1, -1, -1, -1, 63, 64, 65, -1, 67, 68,
-1, 26, 27, -1, -1, 30, 31, 32, -1, -1,
35, 36, -1, 38, 39, 40, -1, -1, 43, 44,
45, 46, -1, 48, 5, 6, 51, -1, -1, -1,
-1, -1, 13, -1, -1, -1, -1, -1, 63, 64,
-1, -1, 67, 68, -1, 26, 27, -1, -1, 30,
31, 32, -1, -1, 35, 36, -1, 38, 39, 40,
-1, -1, 43, 44, 45, 46, -1, 48, 5, 6,
51, -1, -1, -1, -1, -1, 13, -1, -1, -1,
-1, -1, 63, 64, -1, -1, 67, 68, -1, 26,
27, -1, -1, 30, 31, 32, 5, 6, 35, 36,
-1, 38, 39, 40, 13, -1, 43, 44, 45, 46,
-1, 48, 5, 6, 51, -1, -1, 26, 27, -1,
13, 30, 31, 32, -1, -1, -1, 36, -1, -1,
67, 68, -1, 26, 27, -1, -1, 30, 31, 32,
-1, -1, -1, 36, -1, -1, 5, 6, -1, -1,
59, -1, 61, -1, 13, -1, -1, -1, 67, 68,
-1, 5, 6, -1, -1, -1, 59, 26, 27, 13,
-1, 30, 31, 32, 67, 68, -1, 36, -1, -1,
-1, -1, 26, 27, -1, -1, 30, 31, 32, 5,
6, -1, 36, -1, -1, -1, -1, 13, -1, -1,
-1, -1, 61, -1, 5, 6, -1, -1, 67, 68,
26, 27, 13, -1, 30, 31, 32, -1, -1, -1,
36, -1, -1, 67, 68, 26, 27, -1, -1, 30,
31, 32, -1, -1, -1, 36, -1, 4, 5, 6,
7, 8, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 67, 68, 20, 21, 22, 23, 24, 25, -1,
-1, 28, 29, -1, -1, -1, 67, 68, 4, 5,
6, 7, 8, 9, 10, 11, 12, -1, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
-1, -1, 28, 29, 4, 5, 6, 7, 8, -1,
-1, 11, 12, -1, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, -1, -1, 28, 29,
4, 5, 6, 7, 8, -1, -1, -1, -1, -1,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, -1, -1, 28, 29, 5, 6, 7, 8,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 20, 21, 22, 23, 24, 25, -1, -1, 28,
29
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/local/gnu/lib/bison.simple"
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C. */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
#pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */
#ifdef __hpux
#ifdef __cplusplus
extern "C" {
void *alloca (unsigned int);
};
#else /* not __cplusplus */
void *alloca ();
#endif /* not __cplusplus */
#endif /* __hpux */
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc. */
#endif /* not GNU C. */
#endif /* alloca not defined. */
/* This is the parser code that is written into each bison parser
when the %semantic_parser declaration is not specified in the grammar.
It was written by Richard Stallman by simplifying the hairy parser
used when %semantic_parser is specified. */
/* Note: there must be only one dollar sign in this file.
It is replaced by the list of actions, each action
as one case of the switch. */
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2
#define YYEOF 0
#define YYACCEPT return(0)
#define YYABORT return(1)
#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror.
This remains here temporarily to ease the
transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(token, value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ yychar = (token), yylval = (value); \
yychar1 = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
#ifndef YYPURE
#define YYLEX yylex()
#endif
#ifdef YYPURE
#ifdef YYLSP_NEEDED
#define YYLEX yylex(&yylval, &yylloc)
#else
#define YYLEX yylex(&yylval)
#endif
#endif
/* If nonreentrant, generate the variables here */
#ifndef YYPURE
int yychar; /* the lookahead symbol */
YYSTYPE yylval; /* the semantic value of the */
/* lookahead symbol */
#ifdef YYLSP_NEEDED
YYLTYPE yylloc; /* location data for the lookahead */
/* symbol */
#endif
int yynerrs; /* number of parse errors so far */
#endif /* not YYPURE */
#if YYDEBUG != 0
int yydebug; /* nonzero means print parse trace */
/* Since this is uninitialized, it does not stop multiple parsers
from coexisting. */
#endif
/* YYINITDEPTH indicates the initial size of the parser's stacks */
#ifndef YYINITDEPTH
#define YYINITDEPTH 200
#endif
/* YYMAXDEPTH is the maximum size the stacks can grow to
(effective only if the built-in stack extension method is used). */
#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif
/* Prevent warning if -Wstrict-prototypes. */
#ifdef __GNUC__
int yyparse (void);
#endif
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
#define __yy_bcopy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
#else /* not GNU C or C++ */
#ifndef __cplusplus
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
static void
__yy_bcopy (from, to, count)
char *from;
char *to;
int count;
{
register char *f = from;
register char *t = to;
register int i = count;
while (i-- > 0)
*t++ = *f++;
}
#else /* __cplusplus */
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
static void
__yy_bcopy (char *from, char *to, int count)
{
register char *f = from;
register char *t = to;
register int i = count;
while (i-- > 0)
*t++ = *f++;
}
#endif
#endif
#line 184 "/usr/local/gnu/lib/bison.simple"
int
yyparse()
{
register int yystate;
register int yyn;
register short *yyssp;
register YYSTYPE *yyvsp;
int yyerrstatus; /* number of tokens to shift before error messages enabled */
int yychar1 = 0; /* lookahead token as an internal (translated) token number */
short yyssa[YYINITDEPTH]; /* the state stack */
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
#ifdef YYLSP_NEEDED
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
YYLTYPE *yyls = yylsa;
YYLTYPE *yylsp;
#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
#else
#define YYPOPSTACK (yyvsp--, yyssp--)
#endif
int yystacksize = YYINITDEPTH;
#ifdef YYPURE
int yychar;
YYSTYPE yylval;
int yynerrs;
#ifdef YYLSP_NEEDED
YYLTYPE yylloc;
#endif
#endif
YYSTYPE yyval; /* the variable used to return */
/* semantic values from the action */
/* routines */
int yylen;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Starting parse\n");
#endif
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
yyssp = yyss - 1;
yyvsp = yyvs;
#ifdef YYLSP_NEEDED
yylsp = yyls;
#endif
/* Push a new state, which is found in yystate . */
/* In all cases, when you get here, the value and location stacks
have just been pushed. so pushing a state here evens the stacks. */
yynewstate:
*++yyssp = yystate;
if (yyssp >= yyss + yystacksize - 1)
{
/* Give user a chance to reallocate the stack */
/* Use copies of these so that the &'s don't force the real ones into memory. */
YYSTYPE *yyvs1 = yyvs;
short *yyss1 = yyss;
#ifdef YYLSP_NEEDED
YYLTYPE *yyls1 = yyls;
#endif
/* Get the current used size of the three stacks, in elements. */
int size = yyssp - yyss + 1;
#ifdef yyoverflow
/* Each stack pointer address is followed by the size of
the data in use in that stack, in bytes. */
#ifdef YYLSP_NEEDED
/* This used to be a conditional around just the two extra args,
but that might be undefined if yyoverflow is a macro. */
yyoverflow("parser stack overflow",
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),
&yyls1, size * sizeof (*yylsp),
&yystacksize);
#else
yyoverflow("parser stack overflow",
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),
&yystacksize);
#endif
yyss = yyss1; yyvs = yyvs1;
#ifdef YYLSP_NEEDED
yyls = yyls1;
#endif
#else /* no yyoverflow */
/* Extend the stack our own way. */
if (yystacksize >= YYMAXDEPTH)
{
yyerror("parser stack overflow");
return 2;
}
yystacksize *= 2;
if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
__yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
__yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
__yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
#endif
#endif /* no yyoverflow */
yyssp = yyss + size - 1;
yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED
yylsp = yyls + size - 1;
#endif
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
#endif
if (yyssp >= yyss + yystacksize - 1)
YYABORT;
}
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Entering state %d\n", yystate);
#endif
goto yybackup;
yybackup:
/* Do appropriate processing given the current state. */
/* Read a lookahead token if we need one and don't already have one. */
/* yyresume: */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* yychar is either YYEMPTY or YYEOF
or a valid token in external form. */
if (yychar == YYEMPTY)
{
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Reading a token: ");
#endif
yychar = YYLEX;
}
/* Convert token to internal form (in yychar1) for indexing tables with */
if (yychar <= 0) /* This means end of input. */
{
yychar1 = 0;
yychar = YYEOF; /* Don't call YYLEX any more */
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Now at end of input.\n");
#endif
}
else
{
yychar1 = YYTRANSLATE(yychar);
#if YYDEBUG != 0
if (yydebug)
{
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
/* Give the individual parser a way to print the precise meaning
of a token, for further debugging info. */
#ifdef YYPRINT
YYPRINT (stderr, yychar, yylval);
#endif
fprintf (stderr, ")\n");
}
#endif
}
yyn += yychar1;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
goto yydefault;
yyn = yytable[yyn];
/* yyn is what to do for this token type in this state.
Negative => reduce, -yyn is rule number.
Positive => shift, yyn is new state.
New state is final state => don't bother to shift,
just return success.
0, or most negative number => error. */
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrlab;
if (yyn == YYFINAL)
YYACCEPT;
/* Shift the lookahead token. */
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
#endif
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
yychar = YYEMPTY;
*++yyvsp = yylval;
#ifdef YYLSP_NEEDED
*++yylsp = yylloc;
#endif
/* count tokens shifted since error; after three, turn off error status. */
if (yyerrstatus) yyerrstatus--;
yystate = yyn;
goto yynewstate;
/* Do the default action for the current state. */
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
/* Do a reduction. yyn is the number of a rule to reduce with. */
yyreduce:
yylen = yyr2[yyn];
if (yylen > 0)
yyval = yyvsp[1-yylen]; /* implement default value of the action */
#if YYDEBUG != 0
if (yydebug)
{
int i;
fprintf (stderr, "Reducing via rule %d (line %d), ",
yyn, yyrline[yyn]);
/* Print the symbols being reduced, and their result. */
for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
fprintf (stderr, "%s ", yytname[yyrhs[i]]);
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
}
#endif
switch (yyn) {
case 1:
#line 291 "parse.y"
{
global_command = yyvsp[0].tree_statement_list_type;
promptflag = 1;
YYACCEPT;
;
break;}
case 2:
#line 297 "parse.y"
{
global_command = 0;
promptflag = 1;
YYABORT;
;
break;}
case 3:
#line 303 "parse.y"
{ ABORT_PARSE; ;
break;}
case 4:
#line 305 "parse.y"
{ ABORT_PARSE; ;
break;}
case 5:
#line 309 "parse.y"
{ yyval.tree_statement_list_type = 0; ;
break;}
case 6:
#line 311 "parse.y"
{ yyval.tree_statement_list_type = yyvsp[0].tree_statement_list_type; ;
break;}
case 7:
#line 313 "parse.y"
{ yyval.tree_statement_list_type = yyvsp[-1].tree_statement_list_type; ;
break;}
case 8:
#line 315 "parse.y"
{ yyval.tree_statement_list_type = yyvsp[-1].tree_statement_list_type; ;
break;}
case 9:
#line 319 "parse.y"
{ yyerror ("parse error"); ;
break;}
case 11:
#line 324 "parse.y"
{ yyval.tree_statement_list_type = 0; ;
break;}
case 12:
#line 326 "parse.y"
{ yyval.tree_statement_list_type = 0; ;
break;}
case 13:
#line 328 "parse.y"
{ yyval.tree_statement_list_type = yyvsp[0].tree_statement_list_type; ;
break;}
case 14:
#line 330 "parse.y"
{
tree_statement *tmp = yyvsp[-1].tree_statement_list_type->rear ();
tmp->set_print_flag (0);
;
break;}
case 15:
#line 335 "parse.y"
{ yyval.tree_statement_list_type = yyvsp[-1].tree_statement_list_type; ;
break;}
case 16:
#line 339 "parse.y"
{ yyval.tree_statement_list_type = new tree_statement_list (yyvsp[0].tree_statement_type); ;
break;}
case 17:
#line 341 "parse.y"
{ yyval.tree_statement_list_type = new tree_statement_list (yyvsp[0].tree_statement_type); ;
break;}
case 18:
#line 343 "parse.y"
{ yyval.tree_statement_list_type = new tree_statement_list (yyvsp[0].tree_statement_type); ;
break;}
case 19:
#line 345 "parse.y"
{
tree_statement *tmp = yyvsp[-2].tree_statement_list_type->rear ();
tmp->set_print_flag (0);
yyvsp[-2].tree_statement_list_type->append (yyvsp[0].tree_statement_type);
;
break;}
case 20:
#line 351 "parse.y"
{ yyvsp[-2].tree_statement_list_type->append (yyvsp[0].tree_statement_type); ;
break;}
case 32:
#line 374 "parse.y"
{ yyval.tree_statement_list_type = new tree_statement_list (); ;
break;}
case 33:
#line 376 "parse.y"
{ yyval.tree_statement_list_type = yyvsp[0].tree_statement_list_type; ;
break;}
case 34:
#line 380 "parse.y"
{ yyval.tree_statement_list_type = yyvsp[0].tree_statement_list_type; ;
break;}
case 35:
#line 382 "parse.y"
{ yyval.tree_statement_list_type = yyvsp[-1].tree_statement_list_type; ;
break;}
case 36:
#line 384 "parse.y"
{
tree_statement *tmp = yyvsp[-1].tree_statement_list_type->rear ();
tmp->set_print_flag (0);
;
break;}
case 37:
#line 391 "parse.y"
{
beginning_of_function = 0;
yyval.tree_statement_list_type = new tree_statement_list (yyvsp[0].tree_statement_type);
;
break;}
case 38:
#line 396 "parse.y"
{ yyvsp[-2].tree_statement_list_type->append (yyvsp[0].tree_statement_type); ;
break;}
case 39:
#line 398 "parse.y"
{
tree_statement *tmp = yyvsp[-2].tree_statement_list_type->rear ();
tmp->set_print_flag (0);
yyvsp[-2].tree_statement_list_type->append (yyvsp[0].tree_statement_type);
;
break;}
case 40:
#line 406 "parse.y"
{ yyval.tree_statement_type = new tree_statement (yyvsp[0].tree_command_type); ;
break;}
case 41:
#line 408 "parse.y"
{ yyval.tree_statement_type = new tree_statement (yyvsp[0].tree_expression_type); ;
break;}
case 42:
#line 410 "parse.y"
{
symbol_record *sr = lookup_by_name ("clearplot", 0);
tree_identifier *id = new tree_identifier (sr);
yyval.tree_statement_type = new tree_statement (id);
;
break;}
case 43:
#line 418 "parse.y"
{
if (! yyvsp[0].subplot_list_type && yyvsp[-1].tok_val->pttype () != token::replot)
{
yyerror ("must have something to plot");
ABORT_PARSE;
}
else
{
yyval.tree_plot_command_type = new tree_plot_command (yyvsp[0].subplot_list_type, yyvsp[-1].tok_val->pttype ());
plotting = 0;
past_plot_range = 0;
in_plot_range = 0;
in_plot_using = 0;
in_plot_style = 0;
}
;
break;}
case 44:
#line 435 "parse.y"
{
if (yyvsp[-2].tok_val->pttype () == token::replot)
{
yyerror ("cannot specify new ranges with replot");
ABORT_PARSE;
}
else
{
yyval.tree_plot_command_type = new tree_plot_command (yyvsp[0].subplot_list_type, yyvsp[-1].plot_limits_type, yyvsp[-2].tok_val->pttype ());
plotting = 0;
past_plot_range = 0;
in_plot_range = 0;
in_plot_using = 0;
in_plot_style = 0;
}
;
break;}
case 45:
#line 454 "parse.y"
{ yyval.plot_limits_type = new plot_limits (yyvsp[0].plot_range_type); ;
break;}
case 46:
#line 456 "parse.y"
{ yyval.plot_limits_type = new plot_limits (yyvsp[-1].plot_range_type, yyvsp[0].plot_range_type); ;
break;}
case 47:
#line 458 "parse.y"
{ yyval.plot_limits_type = new plot_limits (yyvsp[-2].plot_range_type, yyvsp[-1].plot_range_type, yyvsp[0].plot_range_type); ;
break;}
case 48:
#line 462 "parse.y"
{ yyval.plot_range_type = new plot_range (yyvsp[-3].tree_expression_type, yyvsp[-1].tree_expression_type); ;
break;}
case 49:
#line 464 "parse.y"
{ yyval.plot_range_type = new plot_range (0, yyvsp[-1].tree_expression_type); ;
break;}
case 50:
#line 466 "parse.y"
{ yyval.plot_range_type = new plot_range (yyvsp[-2].tree_expression_type, 0); ;
break;}
case 51:
#line 468 "parse.y"
{ yyval.plot_range_type = new plot_range (); ;
break;}
case 52:
#line 470 "parse.y"
{ yyval.plot_range_type = new plot_range (); ;
break;}
case 53:
#line 474 "parse.y"
{ yyval.subplot_list_type = 0; ;
break;}
case 54:
#line 476 "parse.y"
{ yyval.subplot_list_type = new subplot_list (yyvsp[0].subplot_type); ;
break;}
case 55:
#line 478 "parse.y"
{ yyvsp[-2].subplot_list_type->append (yyvsp[0].subplot_type); ;
break;}
case 56:
#line 482 "parse.y"
{ yyval.subplot_type = new subplot (yyvsp[0].tree_expression_type); ;
break;}
case 57:
#line 484 "parse.y"
{
yyvsp[0].subplot_type->set_data (yyvsp[-1].tree_expression_type);
yyval.subplot_type = yyvsp[0].subplot_type;
;
break;}
case 58:
#line 491 "parse.y"
{ yyval.subplot_type = new subplot (yyvsp[0].subplot_using_type, 0, 0); ;
break;}
case 59:
#line 493 "parse.y"
{ yyval.subplot_type = new subplot (0, yyvsp[0].tree_expression_type, 0); ;
break;}
case 60:
#line 495 "parse.y"
{ yyval.subplot_type = new subplot (0, 0, yyvsp[0].subplot_style_type); ;
break;}
case 61:
#line 497 "parse.y"
{ yyval.subplot_type = new subplot (yyvsp[-1].subplot_using_type, yyvsp[0].tree_expression_type, 0); ;
break;}
case 62:
#line 499 "parse.y"
{ yyval.subplot_type = new subplot (yyvsp[0].subplot_using_type, yyvsp[-1].tree_expression_type, 0); ;
break;}
case 63:
#line 501 "parse.y"
{ yyval.subplot_type = new subplot (yyvsp[-1].subplot_using_type, 0, yyvsp[0].subplot_style_type); ;
break;}
case 64:
#line 503 "parse.y"
{ yyval.subplot_type = new subplot (yyvsp[0].subplot_using_type, 0, yyvsp[-1].subplot_style_type); ;
break;}
case 65:
#line 505 "parse.y"
{ yyval.subplot_type = new subplot (0, yyvsp[-1].tree_expression_type, yyvsp[0].subplot_style_type); ;
break;}
case 66:
#line 507 "parse.y"
{ yyval.subplot_type = new subplot (0, yyvsp[0].tree_expression_type, yyvsp[-1].subplot_style_type); ;
break;}
case 67:
#line 509 "parse.y"
{ yyval.subplot_type = new subplot (yyvsp[-2].subplot_using_type, yyvsp[-1].tree_expression_type, yyvsp[0].subplot_style_type); ;
break;}
case 68:
#line 511 "parse.y"
{ yyval.subplot_type = new subplot (yyvsp[-2].subplot_using_type, yyvsp[0].tree_expression_type, yyvsp[-1].subplot_style_type); ;
break;}
case 69:
#line 513 "parse.y"
{ yyval.subplot_type = new subplot (yyvsp[-1].subplot_using_type, yyvsp[-2].tree_expression_type, yyvsp[0].subplot_style_type); ;
break;}
case 70:
#line 515 "parse.y"
{ yyval.subplot_type = new subplot (yyvsp[0].subplot_using_type, yyvsp[-2].tree_expression_type, yyvsp[-1].subplot_style_type); ;
break;}
case 71:
#line 517 "parse.y"
{ yyval.subplot_type = new subplot (yyvsp[-1].subplot_using_type, yyvsp[0].tree_expression_type, yyvsp[-2].subplot_style_type); ;
break;}
case 72:
#line 519 "parse.y"
{ yyval.subplot_type = new subplot (yyvsp[0].subplot_using_type, yyvsp[-1].tree_expression_type, yyvsp[-2].subplot_style_type); ;
break;}
case 73:
#line 523 "parse.y"
{
in_plot_using = 0;
yyval.subplot_using_type = yyvsp[0].subplot_using_type;
;
break;}
case 74:
#line 528 "parse.y"
{
in_plot_using = 0;
yyval.subplot_using_type = yyvsp[-1].subplot_using_type->set_format (yyvsp[0].tree_expression_type);
;
break;}
case 75:
#line 535 "parse.y"
{
subplot_using *tmp = new subplot_using ();
yyval.subplot_using_type = tmp->add_qualifier (yyvsp[0].tree_expression_type);
;
break;}
case 76:
#line 540 "parse.y"
{ yyval.subplot_using_type = yyvsp[-2].subplot_using_type->add_qualifier (yyvsp[0].tree_expression_type); ;
break;}
case 77:
#line 544 "parse.y"
{ yyval.tree_expression_type = yyvsp[0].tree_expression_type; ;
break;}
case 78:
#line 548 "parse.y"
{ yyval.subplot_style_type = new subplot_style (yyvsp[0].tok_val->string ()); ;
break;}
case 79:
#line 550 "parse.y"
{ yyval.subplot_style_type = new subplot_style (yyvsp[-1].tok_val->string (), yyvsp[0].tree_expression_type); ;
break;}
case 80:
#line 552 "parse.y"
{ yyval.subplot_style_type = new subplot_style (yyvsp[-3].tok_val->string (), yyvsp[-2].tree_expression_type, yyvsp[0].tree_expression_type); ;
break;}
case 82:
#line 559 "parse.y"
{ yyval.tree_expression_type = maybe_convert_to_ans_assign (yyvsp[0].tree_expression_type); ;
break;}
case 83:
#line 563 "parse.y"
{
yyval.tree_global_command_type = new tree_global_command (yyvsp[0].tree_global_init_list_type, yyvsp[-1].tok_val->line (),
yyvsp[-1].tok_val->column ());
;
break;}
case 84:
#line 570 "parse.y"
{ yyval.tree_global_init_list_type = new tree_global_init_list (yyvsp[0].tree_global_type); ;
break;}
case 85:
#line 572 "parse.y"
{ yyvsp[-2].tree_global_init_list_type->append (yyvsp[0].tree_global_type); ;
break;}
case 86:
#line 575 "parse.y"
{ yyval.tree_global_type = new tree_global (yyvsp[0].tree_identifier_type); ;
break;}
case 87:
#line 577 "parse.y"
{
tree_simple_assignment_expression *tmp_ass;
tmp_ass = new tree_simple_assignment_expression
(yyvsp[-2].tree_identifier_type, yyvsp[0].tree_expression_type, 0, 0, yyvsp[-1].tok_val->line (), yyvsp[-1].tok_val->column ());
yyval.tree_global_type = new tree_global (tmp_ass);
;
break;}
case 89:
#line 587 "parse.y"
{
if (user_pref.warn_comma_in_global_decl)
warning ("comma in global declaration not\
interpreted as a command separator");
;
break;}
case 90:
#line 595 "parse.y"
{ yyval.tree_command_type = yyvsp[0].tree_plot_command_type; ;
break;}
case 91:
#line 597 "parse.y"
{ yyval.tree_command_type = yyvsp[0].tree_command_type; ;
break;}
case 92:
#line 599 "parse.y"
{ yyval.tree_command_type = yyvsp[0].tree_global_command_type; ;
break;}
case 93:
#line 601 "parse.y"
{
iffing--;
yyval.tree_command_type = yyvsp[0].tree_if_command_type;
;
break;}
case 94:
#line 607 "parse.y"
{
if (check_end (yyvsp[0].tok_val, token::unwind_protect_end))
ABORT_PARSE;
yyval.tree_command_type = new tree_unwind_protect_command (yyvsp[-4].tree_statement_list_type, yyvsp[-1].tree_statement_list_type, yyvsp[-6].tok_val->line (),
yyvsp[-6].tok_val->column ());
;
break;}
case 95:
#line 615 "parse.y"
{
maybe_warn_assign_as_truth_value (yyvsp[-3].tree_expression_type);
if (check_end (yyvsp[0].tok_val, token::while_end))
ABORT_PARSE;
looping--;
yyval.tree_command_type = new tree_while_command (yyvsp[-3].tree_expression_type, yyvsp[-1].tree_statement_list_type, yyvsp[-4].tok_val->line (),
yyvsp[-4].tok_val->column ());
;
break;}
case 96:
#line 624 "parse.y"
{
if (check_end (yyvsp[0].tok_val, token::for_end))
ABORT_PARSE;
looping--;
yyval.tree_command_type = new tree_for_command (yyvsp[-5].tree_index_expression_type, yyvsp[-3].tree_expression_type, yyvsp[-1].tree_statement_list_type,
yyvsp[-6].tok_val->line (), yyvsp[-6].tok_val->column ());
;
break;}
case 97:
#line 632 "parse.y"
{
if (! (looping || defining_func))
{
yyerror ("break: only meaningful within a loop\
or function body");
ABORT_PARSE;
}
yyval.tree_command_type = new tree_break_command (yyvsp[0].tok_val->line (), yyvsp[0].tok_val->column ());
;
break;}
case 98:
#line 642 "parse.y"
{
if (! looping)
{
yyerror ("continue: only meaningful within a\
`for' or `while' loop");
ABORT_PARSE;
}
yyval.tree_command_type = new tree_continue_command (yyvsp[0].tok_val->line (),
yyvsp[0].tok_val->column ());
;
break;}
case 99:
#line 653 "parse.y"
{
if (! defining_func)
{
yyerror ("return: only meaningful within a function");
ABORT_PARSE;
}
yyval.tree_command_type = new tree_return_command (yyvsp[0].tok_val->line (), yyvsp[0].tok_val->column ());
;
break;}
case 100:
#line 664 "parse.y"
{
if (check_end (yyvsp[0].tok_val, token::if_end))
ABORT_PARSE;
yyval.tree_if_command_type = new tree_if_command (yyvsp[-1].tree_if_command_list_type, yyvsp[-2].tok_val->line (), yyvsp[-2].tok_val->column ());
;
break;}
case 101:
#line 672 "parse.y"
{ yyval.tree_if_command_list_type = yyvsp[0].tree_if_command_list_type ;
break;}
case 102:
#line 674 "parse.y"
{ yyvsp[-1].tree_if_command_list_type->append (yyvsp[0].tree_if_clause_type); ;
break;}
case 103:
#line 678 "parse.y"
{
maybe_warn_assign_as_truth_value (yyvsp[-2].tree_expression_type);
tree_if_clause *t = new tree_if_clause (yyvsp[-2].tree_expression_type, yyvsp[0].tree_statement_list_type);
yyval.tree_if_command_list_type = new tree_if_command_list (t);
;
break;}
case 104:
#line 684 "parse.y"
{ yyvsp[-1].tree_if_command_list_type->append (yyvsp[0].tree_if_clause_type); ;
break;}
case 105:
#line 688 "parse.y"
{
maybe_warn_assign_as_truth_value (yyvsp[-2].tree_expression_type);
yyval.tree_if_clause_type = new tree_if_clause (yyvsp[-2].tree_expression_type, yyvsp[0].tree_statement_list_type);
;
break;}
case 106:
#line 695 "parse.y"
{ yyval.tree_if_clause_type = new tree_if_clause (yyvsp[0].tree_statement_list_type); ;
break;}
case 115:
#line 711 "parse.y"
{ maybe_screwed_again++; ;
break;}
case 116:
#line 715 "parse.y"
{ yyval.tree_expression_type = new tree_simple_assignment_expression
(yyvsp[-2].tree_index_expression_type, yyvsp[0].tree_expression_type, 0, 0, yyvsp[-1].tok_val->line (), yyvsp[-1].tok_val->column ()); ;
break;}
case 117:
#line 718 "parse.y"
{
yyerror ("invalid assignment to a number");
yyval.tree_expression_type = 0;
ABORT_PARSE;
;
break;}
case 118:
#line 724 "parse.y"
{
yyval.tree_expression_type = make_multi_val_ret (yyvsp[0].tree_expression_type, yyvsp[-1].tok_val->line (), yyvsp[-1].tok_val->column ());
if (! yyval.tree_expression_type)
ABORT_PARSE;
;
break;}
case 119:
#line 731 "parse.y"
{ yyval.tree_expression_type = yyvsp[0].tree_expression_type; ;
break;}
case 120:
#line 735 "parse.y"
{ yyval.tree_expression_type = yyvsp[0].tree_expression_type; ;
break;}
case 121:
#line 737 "parse.y"
{ yyval.tree_expression_type = make_postfix_op (PLUS_PLUS, yyvsp[-1].tree_identifier_type, yyvsp[0].tok_val); ;
break;}
case 122:
#line 739 "parse.y"
{ yyval.tree_expression_type = make_postfix_op (MINUS_MINUS, yyvsp[-1].tree_identifier_type, yyvsp[0].tok_val); ;
break;}
case 123:
#line 741 "parse.y"
{ yyval.tree_expression_type = make_unary_op (QUOTE, yyvsp[-1].tree_expression_type, yyvsp[0].tok_val); ;
break;}
case 124:
#line 743 "parse.y"
{ yyval.tree_expression_type = make_unary_op (TRANSPOSE, yyvsp[-1].tree_expression_type, yyvsp[0].tok_val); ;
break;}
case 125:
#line 745 "parse.y"
{ yyval.tree_expression_type = make_binary_op (POW, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 126:
#line 747 "parse.y"
{ yyval.tree_expression_type = make_binary_op (EPOW, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 127:
#line 749 "parse.y"
{ yyval.tree_expression_type = make_binary_op ('+', yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 128:
#line 751 "parse.y"
{ yyval.tree_expression_type = make_binary_op ('-', yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 129:
#line 753 "parse.y"
{ yyval.tree_expression_type = make_binary_op ('*', yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 130:
#line 755 "parse.y"
{ yyval.tree_expression_type = make_binary_op ('/', yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 131:
#line 757 "parse.y"
{ yyval.tree_expression_type = make_binary_op (EMUL, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 132:
#line 759 "parse.y"
{ yyval.tree_expression_type = make_binary_op (EDIV, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 133:
#line 761 "parse.y"
{ yyval.tree_expression_type = make_binary_op (LEFTDIV, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 134:
#line 763 "parse.y"
{ yyval.tree_expression_type = make_binary_op (ELEFTDIV, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 135:
#line 765 "parse.y"
{ yyval.tree_expression_type = make_binary_op (EXPR_LT, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 136:
#line 767 "parse.y"
{ yyval.tree_expression_type = make_binary_op (EXPR_LE, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 137:
#line 769 "parse.y"
{ yyval.tree_expression_type = make_binary_op (EXPR_EQ, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 138:
#line 771 "parse.y"
{ yyval.tree_expression_type = make_binary_op (EXPR_GE, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 139:
#line 773 "parse.y"
{ yyval.tree_expression_type = make_binary_op (EXPR_GT, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 140:
#line 775 "parse.y"
{ yyval.tree_expression_type = make_binary_op (EXPR_NE, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 141:
#line 777 "parse.y"
{ yyval.tree_expression_type = make_binary_op (EXPR_AND_AND, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 142:
#line 779 "parse.y"
{ yyval.tree_expression_type = make_binary_op (EXPR_OR_OR, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 143:
#line 781 "parse.y"
{ yyval.tree_expression_type = make_binary_op (EXPR_AND, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 144:
#line 783 "parse.y"
{ yyval.tree_expression_type = make_binary_op (EXPR_OR, yyvsp[-2].tree_expression_type, yyvsp[-1].tok_val, yyvsp[0].tree_expression_type); ;
break;}
case 145:
#line 787 "parse.y"
{
tree_constant *tmp = new tree_constant (yyvsp[0].tok_val->number ());
tmp->stash_original_text (yyvsp[0].tok_val->text_rep ());
yyval.tree_expression_type = tmp;
;
break;}
case 146:
#line 793 "parse.y"
{
Complex c (0.0, yyvsp[0].tok_val->number ());
tree_constant *tmp = new tree_constant (c);
tmp->stash_original_text (yyvsp[0].tok_val->text_rep ());
yyval.tree_expression_type = tmp;
;
break;}
case 147:
#line 800 "parse.y"
{ yyval.tree_expression_type = new tree_constant (yyvsp[0].tok_val->string ()); ;
break;}
case 148:
#line 802 "parse.y"
{
yyvsp[-1].tree_expression_type->in_parens++;
yyval.tree_expression_type = yyvsp[-1].tree_expression_type;
;
break;}
case 149:
#line 807 "parse.y"
{ yyval.tree_expression_type = yyvsp[0].tree_index_expression_type; ;
break;}
case 150:
#line 809 "parse.y"
{ yyval.tree_expression_type = yyvsp[0].tree_index_expression_type; ;
break;}
case 151:
#line 811 "parse.y"
{ yyval.tree_expression_type = yyvsp[0].tree_matrix_type; ;
break;}
case 152:
#line 813 "parse.y"
{
mlnm.pop ();
yyval.tree_expression_type = new tree_constant (Matrix ());
;
break;}
case 153:
#line 818 "parse.y"
{
mlnm.pop ();
yyval.tree_expression_type = new tree_constant (Matrix ());
;
break;}
case 154:
#line 823 "parse.y"
{ yyval.tree_expression_type = yyvsp[0].tree_colon_expression_type; ;
break;}
case 155:
#line 825 "parse.y"
{ yyval.tree_expression_type = make_prefix_op (PLUS_PLUS, yyvsp[0].tree_identifier_type, yyvsp[-1].tok_val); ;
break;}
case 156:
#line 827 "parse.y"
{ yyval.tree_expression_type = make_prefix_op (MINUS_MINUS, yyvsp[0].tree_identifier_type, yyvsp[-1].tok_val); ;
break;}
case 157:
#line 829 "parse.y"
{ yyval.tree_expression_type = make_unary_op (EXPR_NOT, yyvsp[0].tree_expression_type, yyvsp[-1].tok_val); ;
break;}
case 158:
#line 831 "parse.y"
{ yyval.tree_expression_type = yyvsp[0].tree_expression_type; ;
break;}
case 159:
#line 833 "parse.y"
{ yyval.tree_expression_type = make_unary_op ('-', yyvsp[0].tree_expression_type, yyvsp[-1].tok_val); ;
break;}
case 160:
#line 837 "parse.y"
{ yyval.tree_colon_expression_type = new tree_colon_expression
(yyvsp[-2].tree_expression_type, yyvsp[0].tree_expression_type, yyvsp[-1].tok_val->line (), yyvsp[-1].tok_val->column ()); ;
break;}
case 161:
#line 840 "parse.y"
{
yyval.tree_colon_expression_type = yyvsp[-2].tree_colon_expression_type->chain (yyvsp[0].tree_expression_type);
if (! yyval.tree_colon_expression_type)
ABORT_PARSE;
;
break;}
case 162:
#line 848 "parse.y"
{
yyval.tree_index_expression_type = new tree_index_expression
(yyvsp[-1].tree_identifier_type, yyvsp[0].tree_argument_list_type, yyvsp[-1].tree_identifier_type->line (), yyvsp[-1].tree_identifier_type->column ());
;
break;}
case 163:
#line 855 "parse.y"
{
tree_constant *tmp = new tree_constant (yyvsp[0].tok_val->string ());
yyval.tree_argument_list_type = new tree_argument_list (tmp);
;
break;}
case 164:
#line 860 "parse.y"
{
tree_constant *tmp = new tree_constant (yyvsp[0].tok_val->string ());
yyvsp[-1].tree_argument_list_type->append (tmp);
;
break;}
case 165:
#line 869 "parse.y"
{ curr_sym_tab = global_sym_tab; ;
break;}
case 166:
#line 873 "parse.y"
{ curr_sym_tab = tmp_local_sym_tab; ;
break;}
case 167:
#line 877 "parse.y"
{ maybe_screwed = 0; ;
break;}
case 168:
#line 881 "parse.y"
{ maybe_screwed = 1; ;
break;}
case 169:
#line 885 "parse.y"
{
curr_sym_tab = top_level_sym_tab;
defining_func = 0;
yyval.tree_command_type = 0;
;
break;}
case 170:
#line 891 "parse.y"
{
curr_sym_tab = top_level_sym_tab;
defining_func = 0;
yyval.tree_command_type = 0;
;
break;}
case 171:
#line 899 "parse.y"
{
tree_identifier *tmp = new tree_identifier
(yyvsp[-4].tok_val->sym_rec (), yyvsp[-4].tok_val->line (), yyvsp[-4].tok_val->column ());
tree_parameter_list *tpl = new tree_parameter_list (tmp);
tpl->mark_as_formal_parameters ();
yyval.tree_function_type = yyvsp[0].tree_function_type->define_ret_list (tpl);
;
break;}
case 172:
#line 907 "parse.y"
{
yyvsp[-3].tree_parameter_list_type->mark_as_formal_parameters ();
yyval.tree_function_type = yyvsp[0].tree_function_type->define_ret_list (yyvsp[-3].tree_parameter_list_type);
;
break;}
case 174:
#line 917 "parse.y"
{ yyval.tree_parameter_list_type = new tree_parameter_list (); ;
break;}
case 175:
#line 919 "parse.y"
{
tree_parameter_list *tmp = new tree_parameter_list ();
tmp->mark_varargs_only ();
yyval.tree_parameter_list_type = tmp;
;
break;}
case 176:
#line 925 "parse.y"
{ yyval.tree_parameter_list_type = yyvsp[-1].tree_parameter_list_type; ;
break;}
case 177:
#line 927 "parse.y"
{
yyvsp[-3].tree_parameter_list_type->mark_varargs ();
yyval.tree_parameter_list_type = yyvsp[-3].tree_parameter_list_type;
;
break;}
case 178:
#line 934 "parse.y"
{ yyval.tree_parameter_list_type = new tree_parameter_list (yyvsp[0].tree_identifier_type); ;
break;}
case 179:
#line 936 "parse.y"
{
yyerror ("invalid function return list");
ABORT_PARSE;
;
break;}
case 180:
#line 941 "parse.y"
{ yyvsp[-2].tree_parameter_list_type->append (yyvsp[0].tree_identifier_type); ;
break;}
case 181:
#line 945 "parse.y"
{
char *id_name = yyvsp[-3].tree_identifier_type->name ();
// if (is_text_function_name (id_name))
// {
// yyerror ("invalid use of reserved word %s", id_name);
// ABORT_PARSE;
// }
// If input is coming from a file, issue a warning if the name of the
// file does not match the name of the function stated in the file.
// Matlab doesn't provide a diagnostic (it ignores the stated name).
yyvsp[0].tree_function_type->stash_function_name (id_name);
if (reading_fcn_file)
{
if (strcmp (curr_fcn_file_name, id_name) != 0)
{
if (user_pref.warn_function_name_clash)
warning ("function name `%s' does not agree\
with function file name `%s.m'", id_name, curr_fcn_file_name);
global_sym_tab->rename (id_name,
curr_fcn_file_name);
if (error_state)
ABORT_PARSE;
id_name = yyvsp[-3].tree_identifier_type->name ();
}
yyvsp[0].tree_function_type->stash_function_name (id_name);
yyvsp[0].tree_function_type->stash_fcn_file_name ();
yyvsp[0].tree_function_type->stash_fcn_file_time (time (0));
yyvsp[0].tree_function_type->mark_as_system_fcn_file ();
}
else if (! (input_from_tmp_history_file
|| input_from_startup_file)
&& reading_script_file
&& strcmp (curr_fcn_file_name, id_name) == 0)
{
warning ("function `%s' defined within\
script file `%s.m'", id_name, curr_fcn_file_name);
}
top_level_sym_tab->clear (id_name);
yyvsp[-3].tree_identifier_type->define (yyvsp[0].tree_function_type);
yyvsp[-3].tree_identifier_type->document (help_buf);
yyval.tree_function_type = yyvsp[0].tree_function_type;
;
break;}
case 182:
#line 1000 "parse.y"
{
tree_function *fcn = new tree_function (yyvsp[-1].tree_statement_list_type, curr_sym_tab);
yyval.tree_function_type = fcn->define_param_list (yyvsp[-3].tree_parameter_list_type);
;
break;}
case 183:
#line 1005 "parse.y"
{ yyval.tree_function_type = new tree_function (yyvsp[-1].tree_statement_list_type, curr_sym_tab); ;
break;}
case 184:
#line 1009 "parse.y"
{
if (check_end (yyvsp[0].tok_val, token::function_end))
ABORT_PARSE;
if (reading_fcn_file)
check_for_garbage_after_fcn_def ();
;
break;}
case 185:
#line 1017 "parse.y"
{
if (! (reading_fcn_file || reading_script_file))
YYABORT;
;
break;}
case 186:
#line 1024 "parse.y"
{
looking_at_indirect_ref = 0;
yyval.tree_indirect_ref_type = yyvsp[0].tree_indirect_ref_type;
;
break;}
case 187:
#line 1030 "parse.y"
{
yyval.tree_indirect_ref_type = new tree_indirect_ref (yyvsp[0].tree_identifier_type, yyvsp[0].tree_identifier_type->line (),
yyvsp[0].tree_identifier_type->column ());
;
break;}
case 188:
#line 1034 "parse.y"
{ looking_at_indirect_ref = 1; ;
break;}
case 189:
#line 1035 "parse.y"
{ yyval.tree_indirect_ref_type = yyvsp[-3].tree_indirect_ref_type->chain (yyvsp[0].tok_val->string ()); ;
break;}
case 190:
#line 1039 "parse.y"
{ yyval.tree_index_expression_type = make_index_expression (yyvsp[0].tree_indirect_ref_type, 0); ;
break;}
case 191:
#line 1041 "parse.y"
{ yyval.tree_index_expression_type = make_index_expression (yyvsp[-2].tree_indirect_ref_type, 0); ;
break;}
case 192:
#line 1043 "parse.y"
{ yyval.tree_index_expression_type = make_index_expression (yyvsp[-3].tree_indirect_ref_type, yyvsp[-1].tree_argument_list_type); ;
break;}
case 193:
#line 1045 "parse.y"
{
yyerror ("use `(\' and `)\' as index operators, not\
`[\' and `]\'");
yyval.tree_index_expression_type = 0;
ABORT_PARSE;
;
break;}
case 194:
#line 1054 "parse.y"
{
quote_is_transpose = 0;
yyval.tree_parameter_list_type = 0;
;
break;}
case 195:
#line 1059 "parse.y"
{
quote_is_transpose = 0;
tree_parameter_list *tmp = new tree_parameter_list ();
tmp->mark_varargs_only ();
yyval.tree_parameter_list_type = tmp;
;
break;}
case 196:
#line 1066 "parse.y"
{
quote_is_transpose = 0;
yyvsp[-1].tree_parameter_list_type->mark_as_formal_parameters ();
;
break;}
case 197:
#line 1071 "parse.y"
{
quote_is_transpose = 0;
yyvsp[-3].tree_parameter_list_type->mark_as_formal_parameters ();
yyvsp[-3].tree_parameter_list_type->mark_varargs ();
;
break;}
case 198:
#line 1079 "parse.y"
{ yyval.tree_parameter_list_type = new tree_parameter_list (yyvsp[0].tree_identifier_type); ;
break;}
case 199:
#line 1081 "parse.y"
{ yyvsp[-2].tree_parameter_list_type->append (yyvsp[0].tree_identifier_type); ;
break;}
case 200:
#line 1083 "parse.y"
{
yyerror ("invalid parameter list");
ABORT_PARSE;
;
break;}
case 201:
#line 1088 "parse.y"
{
yyerror ("invalid parameter list");
ABORT_PARSE;
;
break;}
case 202:
#line 1095 "parse.y"
{
yyval.tree_identifier_type = new tree_identifier
(yyvsp[0].tok_val->sym_rec (), yyvsp[0].tok_val->line (), yyvsp[0].tok_val->column ());
;
break;}
case 203:
#line 1102 "parse.y"
{
tree_constant *colon;
tree_constant::magic_colon t;
colon = new tree_constant (t);
yyval.tree_argument_list_type = new tree_argument_list (colon);
;
break;}
case 204:
#line 1109 "parse.y"
{ yyval.tree_argument_list_type = new tree_argument_list (yyvsp[0].tree_expression_type); ;
break;}
case 205:
#line 1111 "parse.y"
{
tree_constant *all_va_args;
tree_constant::all_va_args t;
all_va_args = new tree_constant (t);
yyval.tree_argument_list_type = new tree_argument_list (all_va_args);
;
break;}
case 206:
#line 1118 "parse.y"
{
tree_constant *colon;
tree_constant::magic_colon t;
colon = new tree_constant (t);
yyvsp[-2].tree_argument_list_type->append (colon);
;
break;}
case 207:
#line 1125 "parse.y"
{ yyvsp[-2].tree_argument_list_type->append (yyvsp[0].tree_expression_type); ;
break;}
case 208:
#line 1127 "parse.y"
{
tree_constant *all_va_args;
tree_constant::all_va_args t;
all_va_args = new tree_constant (t);
yyvsp[-2].tree_argument_list_type->append (all_va_args);
;
break;}
case 209:
#line 1136 "parse.y"
{
mlnm.pop ();
maybe_screwed_again--;
tree_matrix *tmp = ml.pop ();
yyval.tree_matrix_type = tmp->reverse ();
;
break;}
case 216:
#line 1157 "parse.y"
{
if (mlnm.top ())
{
mlnm.pop ();
mlnm.push (0);
tree_matrix *tmp = new tree_matrix
(yyvsp[0].tree_expression_type, tree_matrix::md_none);
ml.push (tmp);
}
else
{
tree_matrix *tmp = ml.pop ();
tmp = tmp->chain (yyvsp[0].tree_expression_type, tree_matrix::md_down);
ml.push (tmp);
}
;
break;}
case 217:
#line 1174 "parse.y"
{
tree_matrix *tmp = ml.pop ();
tmp = tmp->chain (yyvsp[0].tree_expression_type, tree_matrix::md_right);
ml.push (tmp);
;
break;}
}
/* the action file gets copied in in place of this dollarsign */
#line 465 "/usr/local/gnu/lib/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
#ifdef YYLSP_NEEDED
yylsp -= yylen;
#endif
#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, "state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
#endif
*++yyvsp = yyval;
#ifdef YYLSP_NEEDED
yylsp++;
if (yylen == 0)
{
yylsp->first_line = yylloc.first_line;
yylsp->first_column = yylloc.first_column;
yylsp->last_line = (yylsp-1)->last_line;
yylsp->last_column = (yylsp-1)->last_column;
yylsp->text = 0;
}
else
{
yylsp->last_line = (yylsp+yylen-1)->last_line;
yylsp->last_column = (yylsp+yylen-1)->last_column;
}
#endif
/* Now "shift" the result of the reduction.
Determine what state that goes to,
based on the state we popped back to
and the rule number reduced by. */
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTBASE];
goto yynewstate;
yyerrlab: /* here on detecting error */
if (! yyerrstatus)
/* If not already recovering from an error, report this error. */
{
++yynerrs;
#ifdef YYERROR_VERBOSE
yyn = yypact[yystate];
if (yyn > YYFLAG && yyn < YYLAST)
{
int size = 0;
char *msg;
int x, count;
count = 0;
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */
for (x = (yyn < 0 ? -yyn : 0);
x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
size += strlen(yytname[x]) + 15, count++;
msg = (char *) malloc(size + 15);
if (msg != 0)
{
strcpy(msg, "parse error");
if (count < 5)
{
count = 0;
for (x = (yyn < 0 ? -yyn : 0);
x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
{
strcat(msg, count == 0 ? ", expecting `" : " or `");
strcat(msg, yytname[x]);
strcat(msg, "'");
count++;
}
}
yyerror(msg);
free(msg);
}
else
yyerror ("parse error; also virtual memory exceeded");
}
else
#endif /* YYERROR_VERBOSE */
yyerror("parse error");
}
goto yyerrlab1;
yyerrlab1: /* here on error raised explicitly by an action */
if (yyerrstatus == 3)
{
/* if just tried and failed to reuse lookahead token after an error, discard it. */
/* return failure if at end of input */
if (yychar == YYEOF)
YYABORT;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif
yychar = YYEMPTY;
}
/* Else will try to reuse lookahead token
after shifting the error token. */
yyerrstatus = 3; /* Each real token shifted decrements this */
goto yyerrhandle;
yyerrdefault: /* current state does not do anything special for the error token. */
#if 0
/* This is wrong; only states that explicitly want error tokens
should shift them. */
yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
if (yyn) goto yydefault;
#endif
yyerrpop: /* pop the current state because it cannot handle the error token */
if (yyssp == yyss) YYABORT;
yyvsp--;
yystate = *--yyssp;
#ifdef YYLSP_NEEDED
yylsp--;
#endif
#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, "Error: state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
#endif
yyerrhandle:
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yyerrdefault;
yyn += YYTERROR;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
goto yyerrdefault;
yyn = yytable[yyn];
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrpop;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrpop;
if (yyn == YYFINAL)
YYACCEPT;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Shifting error token, ");
#endif
*++yyvsp = yylval;
#ifdef YYLSP_NEEDED
*++yylsp = yylloc;
#endif
yystate = yyn;
goto yynewstate;
}
#line 1181 "parse.y"
// Generic error messages.
static void
yyerror (char *s)
{
char *line = current_input_line;
int err_col = current_input_column - 1;
ostrstream output_buf;
if (reading_fcn_file || reading_script_file)
output_buf << "parse error near line " << input_line_number
<< " of file " << curr_fcn_file_name << ".m:";
else
output_buf << "parse error:";
if (s && strcmp (s, "parse error") != 0)
output_buf << "\n\n " << s;
output_buf << "\n\n";
if (line)
{
int len = strlen (line);
if (line[len-1] == '\n')
{
len--;
line[len] = '\0';
}
// Print the line, maybe with a pointer near the error token.
output_buf << ">>> " << line << "\n";
if (err_col == 0)
err_col = len;
for (int i = 0; i < err_col + 3; i++)
output_buf << " ";
output_buf << "^";
}
output_buf << "\n" << ends;
char *msg = output_buf.str ();
parse_error ("%s", msg);
delete [] msg;
}
// Error mesages for mismatched end tokens.
static void
end_error (char *type, token::end_tok_type ettype, int l, int c)
{
static char *fmt = "`%s' command matched by `%s' near line %d column %d";
switch (ettype)
{
case token::simple_end:
error (fmt, type, "end", l, c);
break;
case token::for_end:
error (fmt, type, "endfor", l, c);
break;
case token::function_end:
error (fmt, type, "endfunction", l, c);
break;
case token::if_end:
error (fmt, type, "endif", l, c);
break;
case token::while_end:
error (fmt, type, "endwhile", l, c);
break;
default:
panic_impossible ();
break;
}
}
// Check to see that end tokens are properly matched.
static int
check_end (token *tok, token::end_tok_type expected)
{
token::end_tok_type ettype = tok->ettype ();
if (ettype != expected && ettype != token::simple_end)
{
yyerror ("parse error");
int l = tok->line ();
int c = tok->column ();
switch (expected)
{
case token::for_end:
end_error ("for", ettype, l, c);
break;
case token::function_end:
end_error ("function", ettype, l, c);
break;
case token::if_end:
end_error ("if", ettype, l, c);
break;
case token::while_end:
end_error ("while", ettype, l, c);
break;
default:
panic_impossible ();
break;
}
return 1;
}
else
return 0;
}
// Try to figure out early if an expression should become an
// assignment to the builtin variable ans.
//
// Need to make sure that the expression isn't already an identifier
// that has a name, or an assignment expression.
//
// Note that an expression can't be just an identifier anymore -- it
// must at least be an index expression (see the definition of the
// non-terminal `variable' above).
//
// XXX FIXME XXX. This isn't quite sufficient. For example, try the
// command `x = 4, x' for `x' previously undefined.
//
// XXX FIXME XXX -- we should probably delay doing this until eval-time.
static tree_expression *
maybe_convert_to_ans_assign (tree_expression *expr)
{
if (expr->is_index_expression ())
{
expr->mark_for_possible_ans_assign ();
return expr;
}
else if (expr->is_assignment_expression ()
|| expr->is_prefix_expression ())
{
return expr;
}
else
{
symbol_record *sr = global_sym_tab->lookup ("ans", 1, 0);
assert (sr);
tree_identifier *ans = new tree_identifier (sr);
return new tree_simple_assignment_expression (ans, expr, 0, 1);
}
}
// Maybe print a warning if an assignment expression is used as the
// test in a logical expression.
static void
maybe_warn_assign_as_truth_value (tree_expression *expr)
{
if (user_pref.warn_assign_as_truth_value
&& expr->is_assignment_expression ()
&& expr->in_parens < 2)
{
warning ("suggest parenthesis around assignment used as truth value");
}
}
// Build a binary expression.
static tree_expression *
make_binary_op (int op, tree_expression *op1, token *tok_val,
tree_expression *op2)
{
tree_expression::type t;
switch (op)
{
case POW:
t = tree_expression::power;
break;
case EPOW:
t = tree_expression::elem_pow;
break;
case '+':
t = tree_expression::add;
break;
case '-':
t = tree_expression::subtract;
break;
case '*':
t = tree_expression::multiply;
break;
case '/':
t = tree_expression::divide;
break;
case EMUL:
t = tree_expression::el_mul;
break;
case EDIV:
t = tree_expression::el_div;
break;
case LEFTDIV:
t = tree_expression::leftdiv;
break;
case ELEFTDIV:
t = tree_expression::el_leftdiv;
break;
case EXPR_LT:
t = tree_expression::cmp_lt;
break;
case EXPR_LE:
t = tree_expression::cmp_le;
break;
case EXPR_EQ:
t = tree_expression::cmp_eq;
break;
case EXPR_GE:
t = tree_expression::cmp_ge;
break;
case EXPR_GT:
t = tree_expression::cmp_gt;
break;
case EXPR_NE:
t = tree_expression::cmp_ne;
break;
case EXPR_AND_AND:
t = tree_expression::and_and;
break;
case EXPR_OR_OR:
t = tree_expression::or_or;
break;
case EXPR_AND:
t = tree_expression::and;
break;
case EXPR_OR:
t = tree_expression::or;
break;
default:
panic_impossible ();
break;
}
int l = tok_val->line ();
int c = tok_val->column ();
return new tree_binary_expression (op1, op2, t, l, c);
}
// Build a prefix expression.
static tree_expression *
make_prefix_op (int op, tree_identifier *op1, token *tok_val)
{
tree_expression::type t;
switch (op)
{
case PLUS_PLUS:
t = tree_expression::increment;
break;
case MINUS_MINUS:
t = tree_expression::decrement;
break;
default:
panic_impossible ();
break;
}
int l = tok_val->line ();
int c = tok_val->column ();
return new tree_prefix_expression (op1, t, l, c);
}
// Build a postfix expression.
static tree_expression *
make_postfix_op (int op, tree_identifier *op1, token *tok_val)
{
tree_expression::type t;
switch (op)
{
case PLUS_PLUS:
t = tree_expression::increment;
break;
case MINUS_MINUS:
t = tree_expression::decrement;
break;
default:
panic_impossible ();
break;
}
int l = tok_val->line ();
int c = tok_val->column ();
return new tree_postfix_expression (op1, t, l, c);
}
// Build a unary expression.
static tree_expression *
make_unary_op (int op, tree_expression *op1, token *tok_val)
{
tree_expression::type t;
switch (op)
{
case QUOTE:
t = tree_expression::hermitian;
break;
case TRANSPOSE:
t = tree_expression::transpose;
break;
case EXPR_NOT:
t = tree_expression::not;
break;
case '-':
t = tree_expression::uminus;
break;
default:
panic_impossible ();
break;
}
int l = tok_val->line ();
int c = tok_val->column ();
return new tree_unary_expression (op1, t, l, c);
}
// Make an expression that handles assignment of multiple values.
static tree_expression *
make_multi_val_ret (tree_expression *rhs, int l, int c)
{
// Convert the matrix list to a list of identifiers. If that fails,
// we can abort here, without losing anything -- no other possible
// syntax is valid if we've seen the equals sign as the next token
// after the `]'.
tree_expression *retval = 0;
maybe_screwed_again--;
tree_matrix *tmp = ml.pop ();
tmp = tmp->reverse ();
tree_return_list *id_list = tmp->to_return_list ();
if (id_list)
{
int list_len = id_list->length ();
if (list_len == 1)
{
tree_index_expression *lhs = id_list->remove_front ();
retval = new tree_simple_assignment_expression (lhs, rhs,
0, 0, l, c);
}
else if (list_len > 1)
{
if (rhs->is_multi_val_ret_expression ())
{
tree_multi_val_ret *t = (tree_multi_val_ret *) rhs;
retval = new tree_multi_assignment_expression (id_list, t, l, c);
}
else
yyerror ("RHS must be an expression that returns multiple values");
}
else
panic_impossible ();
}
else
yyerror ("invalid identifier list for assignment");
return retval;
}
static tree_index_expression *
make_index_expression (tree_indirect_ref *indir, tree_argument_list *args)
{
tree_index_expression *retval = 0;
int l = indir->line ();
int c = indir->column ();
if (indir->is_identifier_only ())
{
indir->preserve_identifier ();
retval = new tree_index_expression (indir->ident (), args, l, c);
delete indir;
}
else
retval = new tree_index_expression (indir, args, l, c);
return retval;
}