2002-12-06 Andrew Cagney <ac131313@redhat.com>
[deliverable/binutils-gdb.git] / gdb / ch-exp.c
CommitLineData
db034ac5
AC
1// OBSOLETE /* Parser for GNU CHILL (CCITT High-Level Language) -*- C -*-
2// OBSOLETE Copyright 1992, 1993, 1995, 1996, 1997, 1999, 2000, 2001
3// OBSOLETE Free Software Foundation, Inc.
4// OBSOLETE
5// OBSOLETE This file is part of GDB.
6// OBSOLETE
7// OBSOLETE This program is free software; you can redistribute it and/or modify
8// OBSOLETE it under the terms of the GNU General Public License as published by
9// OBSOLETE the Free Software Foundation; either version 2 of the License, or
10// OBSOLETE (at your option) any later version.
11// OBSOLETE
12// OBSOLETE This program is distributed in the hope that it will be useful,
13// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
14// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// OBSOLETE GNU General Public License for more details.
16// OBSOLETE
17// OBSOLETE You should have received a copy of the GNU General Public License
18// OBSOLETE along with this program; if not, write to the Free Software
19// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
20// OBSOLETE Boston, MA 02111-1307, USA. */
21// OBSOLETE
22// OBSOLETE /* Parse a Chill expression from text in a string,
23// OBSOLETE and return the result as a struct expression pointer.
24// OBSOLETE That structure contains arithmetic operations in reverse polish,
25// OBSOLETE with constants represented by operations that are followed by special data.
26// OBSOLETE See expression.h for the details of the format.
27// OBSOLETE What is important here is that it can be built up sequentially
28// OBSOLETE during the process of parsing; the lower levels of the tree always
29// OBSOLETE come first in the result.
30// OBSOLETE
31// OBSOLETE Note that the language accepted by this parser is more liberal
32// OBSOLETE than the one accepted by an actual Chill compiler. For example, the
33// OBSOLETE language rule that a simple name string can not be one of the reserved
34// OBSOLETE simple name strings is not enforced (e.g "case" is not treated as a
35// OBSOLETE reserved name). Another example is that Chill is a strongly typed
36// OBSOLETE language, and certain expressions that violate the type constraints
37// OBSOLETE may still be evaluated if gdb can do so in a meaningful manner, while
38// OBSOLETE such expressions would be rejected by the compiler. The reason for
39// OBSOLETE this more liberal behavior is the philosophy that the debugger
40// OBSOLETE is intended to be a tool that is used by the programmer when things
41// OBSOLETE go wrong, and as such, it should provide as few artificial barriers
42// OBSOLETE to it's use as possible. If it can do something meaningful, even
43// OBSOLETE something that violates language contraints that are enforced by the
44// OBSOLETE compiler, it should do so without complaint.
45// OBSOLETE
46// OBSOLETE */
47// OBSOLETE
48// OBSOLETE #include "defs.h"
49// OBSOLETE #include "gdb_string.h"
50// OBSOLETE #include <ctype.h>
51// OBSOLETE #include "expression.h"
52// OBSOLETE #include "language.h"
53// OBSOLETE #include "value.h"
54// OBSOLETE #include "parser-defs.h"
55// OBSOLETE #include "ch-lang.h"
56// OBSOLETE #include "bfd.h" /* Required by objfiles.h. */
57// OBSOLETE #include "symfile.h" /* Required by objfiles.h. */
58// OBSOLETE #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
59// OBSOLETE
60// OBSOLETE #ifdef __GNUC__
61// OBSOLETE #define INLINE __inline__
62// OBSOLETE #endif
63// OBSOLETE
64// OBSOLETE typedef union
65// OBSOLETE
66// OBSOLETE {
67// OBSOLETE LONGEST lval;
68// OBSOLETE ULONGEST ulval;
69// OBSOLETE struct
70// OBSOLETE {
71// OBSOLETE LONGEST val;
72// OBSOLETE struct type *type;
73// OBSOLETE }
74// OBSOLETE typed_val;
75// OBSOLETE double dval;
76// OBSOLETE struct symbol *sym;
77// OBSOLETE struct type *tval;
78// OBSOLETE struct stoken sval;
79// OBSOLETE struct ttype tsym;
80// OBSOLETE struct symtoken ssym;
81// OBSOLETE }
82// OBSOLETE YYSTYPE;
83// OBSOLETE
84// OBSOLETE enum ch_terminal
85// OBSOLETE {
86// OBSOLETE END_TOKEN = 0,
87// OBSOLETE /* '\001' ... '\xff' come first. */
88// OBSOLETE OPEN_PAREN = '(',
89// OBSOLETE TOKEN_NOT_READ = 999,
90// OBSOLETE INTEGER_LITERAL,
91// OBSOLETE BOOLEAN_LITERAL,
92// OBSOLETE CHARACTER_LITERAL,
93// OBSOLETE FLOAT_LITERAL,
94// OBSOLETE GENERAL_PROCEDURE_NAME,
95// OBSOLETE LOCATION_NAME,
96// OBSOLETE EMPTINESS_LITERAL,
97// OBSOLETE CHARACTER_STRING_LITERAL,
98// OBSOLETE BIT_STRING_LITERAL,
99// OBSOLETE TYPENAME,
100// OBSOLETE DOT_FIELD_NAME, /* '.' followed by <field name> */
101// OBSOLETE CASE,
102// OBSOLETE OF,
103// OBSOLETE ESAC,
104// OBSOLETE LOGIOR,
105// OBSOLETE ORIF,
106// OBSOLETE LOGXOR,
107// OBSOLETE LOGAND,
108// OBSOLETE ANDIF,
109// OBSOLETE NOTEQUAL,
110// OBSOLETE GEQ,
111// OBSOLETE LEQ,
112// OBSOLETE IN,
113// OBSOLETE SLASH_SLASH,
114// OBSOLETE MOD,
115// OBSOLETE REM,
116// OBSOLETE NOT,
117// OBSOLETE POINTER,
118// OBSOLETE RECEIVE,
119// OBSOLETE UP,
120// OBSOLETE IF,
121// OBSOLETE THEN,
122// OBSOLETE ELSE,
123// OBSOLETE FI,
124// OBSOLETE ELSIF,
125// OBSOLETE ILLEGAL_TOKEN,
126// OBSOLETE NUM,
127// OBSOLETE PRED,
128// OBSOLETE SUCC,
129// OBSOLETE ABS,
130// OBSOLETE CARD,
131// OBSOLETE MAX_TOKEN,
132// OBSOLETE MIN_TOKEN,
133// OBSOLETE ADDR_TOKEN,
134// OBSOLETE SIZE,
135// OBSOLETE UPPER,
136// OBSOLETE LOWER,
137// OBSOLETE LENGTH,
138// OBSOLETE ARRAY,
139// OBSOLETE GDB_VARIABLE,
140// OBSOLETE GDB_ASSIGNMENT
141// OBSOLETE };
142// OBSOLETE
143// OBSOLETE /* Forward declarations. */
144// OBSOLETE
145// OBSOLETE static void write_lower_upper_value (enum exp_opcode, struct type *);
146// OBSOLETE static enum ch_terminal match_bitstring_literal (void);
147// OBSOLETE static enum ch_terminal match_integer_literal (void);
148// OBSOLETE static enum ch_terminal match_character_literal (void);
149// OBSOLETE static enum ch_terminal match_string_literal (void);
150// OBSOLETE static enum ch_terminal match_float_literal (void);
151// OBSOLETE static int decode_integer_literal (LONGEST *, char **);
152// OBSOLETE static int decode_integer_value (int, char **, LONGEST *);
153// OBSOLETE static char *match_simple_name_string (void);
154// OBSOLETE static void growbuf_by_size (int);
155// OBSOLETE static void parse_case_label (void);
156// OBSOLETE static void parse_untyped_expr (void);
157// OBSOLETE static void parse_if_expression (void);
158// OBSOLETE static void parse_if_expression_body (void);
159// OBSOLETE static void parse_else_alternative (void);
160// OBSOLETE static void parse_then_alternative (void);
161// OBSOLETE static void parse_expr (void);
162// OBSOLETE static void parse_operand0 (void);
163// OBSOLETE static void parse_operand1 (void);
164// OBSOLETE static void parse_operand2 (void);
165// OBSOLETE static void parse_operand3 (void);
166// OBSOLETE static void parse_operand4 (void);
167// OBSOLETE static void parse_operand5 (void);
168// OBSOLETE static void parse_operand6 (void);
169// OBSOLETE static void parse_primval (void);
170// OBSOLETE static void parse_tuple (struct type *);
171// OBSOLETE static void parse_opt_element_list (struct type *);
172// OBSOLETE static void parse_tuple_element (struct type *);
173// OBSOLETE static void parse_named_record_element (void);
174// OBSOLETE static void parse_call (void);
175// OBSOLETE static struct type *parse_mode_or_normal_call (void);
176// OBSOLETE #if 0
177// OBSOLETE static struct type *parse_mode_call (void);
178// OBSOLETE #endif
179// OBSOLETE static void parse_unary_call (void);
180// OBSOLETE static int parse_opt_untyped_expr (void);
181// OBSOLETE static int expect (enum ch_terminal, char *);
182// OBSOLETE static enum ch_terminal ch_lex (void);
183// OBSOLETE INLINE static enum ch_terminal PEEK_TOKEN (void);
184// OBSOLETE static enum ch_terminal peek_token_ (int);
185// OBSOLETE static void forward_token_ (void);
186// OBSOLETE static void require (enum ch_terminal);
187// OBSOLETE static int check_token (enum ch_terminal);
188// OBSOLETE
189// OBSOLETE #define MAX_LOOK_AHEAD 2
190// OBSOLETE static enum ch_terminal terminal_buffer[MAX_LOOK_AHEAD + 1] =
191// OBSOLETE {
192// OBSOLETE TOKEN_NOT_READ, TOKEN_NOT_READ, TOKEN_NOT_READ};
193// OBSOLETE static YYSTYPE yylval;
194// OBSOLETE static YYSTYPE val_buffer[MAX_LOOK_AHEAD + 1];
195// OBSOLETE
196// OBSOLETE /*int current_token, lookahead_token; */
197// OBSOLETE
198// OBSOLETE INLINE static enum ch_terminal
199// OBSOLETE PEEK_TOKEN (void)
200// OBSOLETE {
201// OBSOLETE if (terminal_buffer[0] == TOKEN_NOT_READ)
202// OBSOLETE {
203// OBSOLETE terminal_buffer[0] = ch_lex ();
204// OBSOLETE val_buffer[0] = yylval;
205// OBSOLETE }
206// OBSOLETE return terminal_buffer[0];
207// OBSOLETE }
208// OBSOLETE #define PEEK_LVAL() val_buffer[0]
209// OBSOLETE #define PEEK_TOKEN1() peek_token_(1)
210// OBSOLETE #define PEEK_TOKEN2() peek_token_(2)
211// OBSOLETE static enum ch_terminal
212// OBSOLETE peek_token_ (int i)
213// OBSOLETE {
214// OBSOLETE if (i > MAX_LOOK_AHEAD)
215// OBSOLETE internal_error (__FILE__, __LINE__,
216// OBSOLETE "too much lookahead");
217// OBSOLETE if (terminal_buffer[i] == TOKEN_NOT_READ)
218// OBSOLETE {
219// OBSOLETE terminal_buffer[i] = ch_lex ();
220// OBSOLETE val_buffer[i] = yylval;
221// OBSOLETE }
222// OBSOLETE return terminal_buffer[i];
223// OBSOLETE }
224// OBSOLETE
225// OBSOLETE #if 0
226// OBSOLETE
227// OBSOLETE static void
228// OBSOLETE pushback_token (enum ch_terminal code, YYSTYPE node)
229// OBSOLETE {
230// OBSOLETE int i;
231// OBSOLETE if (terminal_buffer[MAX_LOOK_AHEAD] != TOKEN_NOT_READ)
232// OBSOLETE internal_error (__FILE__, __LINE__,
233// OBSOLETE "cannot pushback token");
234// OBSOLETE for (i = MAX_LOOK_AHEAD; i > 0; i--)
235// OBSOLETE {
236// OBSOLETE terminal_buffer[i] = terminal_buffer[i - 1];
237// OBSOLETE val_buffer[i] = val_buffer[i - 1];
238// OBSOLETE }
239// OBSOLETE terminal_buffer[0] = code;
240// OBSOLETE val_buffer[0] = node;
241// OBSOLETE }
242// OBSOLETE
243// OBSOLETE #endif
244// OBSOLETE
245// OBSOLETE static void
246// OBSOLETE forward_token_ (void)
247// OBSOLETE {
248// OBSOLETE int i;
249// OBSOLETE for (i = 0; i < MAX_LOOK_AHEAD; i++)
250// OBSOLETE {
251// OBSOLETE terminal_buffer[i] = terminal_buffer[i + 1];
252// OBSOLETE val_buffer[i] = val_buffer[i + 1];
253// OBSOLETE }
254// OBSOLETE terminal_buffer[MAX_LOOK_AHEAD] = TOKEN_NOT_READ;
255// OBSOLETE }
256// OBSOLETE #define FORWARD_TOKEN() forward_token_()
257// OBSOLETE
258// OBSOLETE /* Skip the next token.
259// OBSOLETE if it isn't TOKEN, the parser is broken. */
260// OBSOLETE
261// OBSOLETE static void
262// OBSOLETE require (enum ch_terminal token)
263// OBSOLETE {
264// OBSOLETE if (PEEK_TOKEN () != token)
265// OBSOLETE {
266// OBSOLETE internal_error (__FILE__, __LINE__,
267// OBSOLETE "expected token %d", (int) token);
268// OBSOLETE }
269// OBSOLETE FORWARD_TOKEN ();
270// OBSOLETE }
271// OBSOLETE
272// OBSOLETE static int
273// OBSOLETE check_token (enum ch_terminal token)
274// OBSOLETE {
275// OBSOLETE if (PEEK_TOKEN () != token)
276// OBSOLETE return 0;
277// OBSOLETE FORWARD_TOKEN ();
278// OBSOLETE return 1;
279// OBSOLETE }
280// OBSOLETE
281// OBSOLETE /* return 0 if expected token was not found,
282// OBSOLETE else return 1.
283// OBSOLETE */
284// OBSOLETE static int
285// OBSOLETE expect (enum ch_terminal token, char *message)
286// OBSOLETE {
287// OBSOLETE if (PEEK_TOKEN () != token)
288// OBSOLETE {
289// OBSOLETE if (message)
290// OBSOLETE error (message);
291// OBSOLETE else if (token < 256)
292// OBSOLETE error ("syntax error - expected a '%c' here \"%s\"", token, lexptr);
293// OBSOLETE else
294// OBSOLETE error ("syntax error");
295// OBSOLETE return 0;
296// OBSOLETE }
297// OBSOLETE else
298// OBSOLETE FORWARD_TOKEN ();
299// OBSOLETE return 1;
300// OBSOLETE }
301// OBSOLETE
302// OBSOLETE #if 0
303// OBSOLETE /* Parse a name string. If ALLOW_ALL is 1, ALL is allowed as a postfix. */
304// OBSOLETE
305// OBSOLETE static tree
306// OBSOLETE parse_opt_name_string (int allow_all)
307// OBSOLETE {
308// OBSOLETE int token = PEEK_TOKEN ();
309// OBSOLETE tree name;
310// OBSOLETE if (token != NAME)
311// OBSOLETE {
312// OBSOLETE if (token == ALL && allow_all)
313// OBSOLETE {
314// OBSOLETE FORWARD_TOKEN ();
315// OBSOLETE return ALL_POSTFIX;
316// OBSOLETE }
317// OBSOLETE return NULL_TREE;
318// OBSOLETE }
319// OBSOLETE name = PEEK_LVAL ();
320// OBSOLETE for (;;)
321// OBSOLETE {
322// OBSOLETE FORWARD_TOKEN ();
323// OBSOLETE token = PEEK_TOKEN ();
324// OBSOLETE if (token != '!')
325// OBSOLETE return name;
326// OBSOLETE FORWARD_TOKEN ();
327// OBSOLETE token = PEEK_TOKEN ();
328// OBSOLETE if (token == ALL && allow_all)
329// OBSOLETE return get_identifier3 (IDENTIFIER_POINTER (name), "!", "*");
330// OBSOLETE if (token != NAME)
331// OBSOLETE {
332// OBSOLETE if (pass == 1)
333// OBSOLETE error ("'%s!' is not followed by an identifier",
334// OBSOLETE IDENTIFIER_POINTER (name));
335// OBSOLETE return name;
336// OBSOLETE }
337// OBSOLETE name = get_identifier3 (IDENTIFIER_POINTER (name),
338// OBSOLETE "!", IDENTIFIER_POINTER (PEEK_LVAL ()));
339// OBSOLETE }
340// OBSOLETE }
341// OBSOLETE
342// OBSOLETE static tree
343// OBSOLETE parse_simple_name_string (void)
344// OBSOLETE {
345// OBSOLETE int token = PEEK_TOKEN ();
346// OBSOLETE tree name;
347// OBSOLETE if (token != NAME)
348// OBSOLETE {
349// OBSOLETE error ("expected a name here");
350// OBSOLETE return error_mark_node;
351// OBSOLETE }
352// OBSOLETE name = PEEK_LVAL ();
353// OBSOLETE FORWARD_TOKEN ();
354// OBSOLETE return name;
355// OBSOLETE }
356// OBSOLETE
357// OBSOLETE static tree
358// OBSOLETE parse_name_string (void)
359// OBSOLETE {
360// OBSOLETE tree name = parse_opt_name_string (0);
361// OBSOLETE if (name)
362// OBSOLETE return name;
363// OBSOLETE if (pass == 1)
364// OBSOLETE error ("expected a name string here");
365// OBSOLETE return error_mark_node;
366// OBSOLETE }
367// OBSOLETE
368// OBSOLETE /* Matches: <name_string>
369// OBSOLETE Returns if pass 1: the identifier.
370// OBSOLETE Returns if pass 2: a decl or value for identifier. */
371// OBSOLETE
372// OBSOLETE static tree
373// OBSOLETE parse_name (void)
374// OBSOLETE {
375// OBSOLETE tree name = parse_name_string ();
376// OBSOLETE if (pass == 1 || ignoring)
377// OBSOLETE return name;
378// OBSOLETE else
379// OBSOLETE {
380// OBSOLETE tree decl = lookup_name (name);
381// OBSOLETE if (decl == NULL_TREE)
382// OBSOLETE {
383// OBSOLETE error ("`%s' undeclared", IDENTIFIER_POINTER (name));
384// OBSOLETE return error_mark_node;
385// OBSOLETE }
386// OBSOLETE else if (TREE_CODE (TREE_TYPE (decl)) == ERROR_MARK)
387// OBSOLETE return error_mark_node;
388// OBSOLETE else if (TREE_CODE (decl) == CONST_DECL)
389// OBSOLETE return DECL_INITIAL (decl);
390// OBSOLETE else if (TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE)
391// OBSOLETE return convert_from_reference (decl);
392// OBSOLETE else
393// OBSOLETE return decl;
394// OBSOLETE }
395// OBSOLETE }
396// OBSOLETE #endif
397// OBSOLETE
398// OBSOLETE #if 0
399// OBSOLETE static void
400// OBSOLETE pushback_paren_expr (tree expr)
401// OBSOLETE {
402// OBSOLETE if (pass == 1 && !ignoring)
403// OBSOLETE expr = build1 (PAREN_EXPR, NULL_TREE, expr);
404// OBSOLETE pushback_token (EXPR, expr);
405// OBSOLETE }
406// OBSOLETE #endif
407// OBSOLETE
408// OBSOLETE /* Matches: <case label> */
409// OBSOLETE
410// OBSOLETE static void
411// OBSOLETE parse_case_label (void)
412// OBSOLETE {
413// OBSOLETE if (check_token (ELSE))
414// OBSOLETE error ("ELSE in tuples labels not implemented");
415// OBSOLETE /* Does not handle the case of a mode name. FIXME */
416// OBSOLETE parse_expr ();
417// OBSOLETE if (check_token (':'))
418// OBSOLETE {
419// OBSOLETE parse_expr ();
420// OBSOLETE write_exp_elt_opcode (BINOP_RANGE);
421// OBSOLETE }
422// OBSOLETE }
423// OBSOLETE
424// OBSOLETE static int
425// OBSOLETE parse_opt_untyped_expr (void)
426// OBSOLETE {
427// OBSOLETE switch (PEEK_TOKEN ())
428// OBSOLETE {
429// OBSOLETE case ',':
430// OBSOLETE case ':':
431// OBSOLETE case ')':
432// OBSOLETE return 0;
433// OBSOLETE default:
434// OBSOLETE parse_untyped_expr ();
435// OBSOLETE return 1;
436// OBSOLETE }
437// OBSOLETE }
438// OBSOLETE
439// OBSOLETE static void
440// OBSOLETE parse_unary_call (void)
441// OBSOLETE {
442// OBSOLETE FORWARD_TOKEN ();
443// OBSOLETE expect ('(', NULL);
444// OBSOLETE parse_expr ();
445// OBSOLETE expect (')', NULL);
446// OBSOLETE }
447// OBSOLETE
448// OBSOLETE /* Parse NAME '(' MODENAME ')'. */
449// OBSOLETE
450// OBSOLETE #if 0
451// OBSOLETE
452// OBSOLETE static struct type *
453// OBSOLETE parse_mode_call (void)
454// OBSOLETE {
455// OBSOLETE struct type *type;
456// OBSOLETE FORWARD_TOKEN ();
457// OBSOLETE expect ('(', NULL);
458// OBSOLETE if (PEEK_TOKEN () != TYPENAME)
459// OBSOLETE error ("expect MODENAME here `%s'", lexptr);
460// OBSOLETE type = PEEK_LVAL ().tsym.type;
461// OBSOLETE FORWARD_TOKEN ();
462// OBSOLETE expect (')', NULL);
463// OBSOLETE return type;
464// OBSOLETE }
465// OBSOLETE
466// OBSOLETE #endif
467// OBSOLETE
468// OBSOLETE static struct type *
469// OBSOLETE parse_mode_or_normal_call (void)
470// OBSOLETE {
471// OBSOLETE struct type *type;
472// OBSOLETE FORWARD_TOKEN ();
473// OBSOLETE expect ('(', NULL);
474// OBSOLETE if (PEEK_TOKEN () == TYPENAME)
475// OBSOLETE {
476// OBSOLETE type = PEEK_LVAL ().tsym.type;
477// OBSOLETE FORWARD_TOKEN ();
478// OBSOLETE }
479// OBSOLETE else
480// OBSOLETE {
481// OBSOLETE parse_expr ();
482// OBSOLETE type = NULL;
483// OBSOLETE }
484// OBSOLETE expect (')', NULL);
485// OBSOLETE return type;
486// OBSOLETE }
487// OBSOLETE
488// OBSOLETE /* Parse something that looks like a function call.
489// OBSOLETE Assume we have parsed the function, and are at the '('. */
490// OBSOLETE
491// OBSOLETE static void
492// OBSOLETE parse_call (void)
493// OBSOLETE {
494// OBSOLETE int arg_count;
495// OBSOLETE require ('(');
496// OBSOLETE /* This is to save the value of arglist_len
497// OBSOLETE being accumulated for each dimension. */
498// OBSOLETE start_arglist ();
499// OBSOLETE if (parse_opt_untyped_expr ())
500// OBSOLETE {
501// OBSOLETE int tok = PEEK_TOKEN ();
502// OBSOLETE arglist_len = 1;
503// OBSOLETE if (tok == UP || tok == ':')
504// OBSOLETE {
505// OBSOLETE FORWARD_TOKEN ();
506// OBSOLETE parse_expr ();
507// OBSOLETE expect (')', "expected ')' to terminate slice");
508// OBSOLETE end_arglist ();
509// OBSOLETE write_exp_elt_opcode (tok == UP ? TERNOP_SLICE_COUNT
510// OBSOLETE : TERNOP_SLICE);
511// OBSOLETE return;
512// OBSOLETE }
513// OBSOLETE while (check_token (','))
514// OBSOLETE {
515// OBSOLETE parse_untyped_expr ();
516// OBSOLETE arglist_len++;
517// OBSOLETE }
518// OBSOLETE }
519// OBSOLETE else
520// OBSOLETE arglist_len = 0;
521// OBSOLETE expect (')', NULL);
522// OBSOLETE arg_count = end_arglist ();
523// OBSOLETE write_exp_elt_opcode (MULTI_SUBSCRIPT);
524// OBSOLETE write_exp_elt_longcst (arg_count);
525// OBSOLETE write_exp_elt_opcode (MULTI_SUBSCRIPT);
526// OBSOLETE }
527// OBSOLETE
528// OBSOLETE static void
529// OBSOLETE parse_named_record_element (void)
530// OBSOLETE {
531// OBSOLETE struct stoken label;
532// OBSOLETE char buf[256];
533// OBSOLETE
534// OBSOLETE label = PEEK_LVAL ().sval;
535// OBSOLETE sprintf (buf, "expected a field name here `%s'", lexptr);
536// OBSOLETE expect (DOT_FIELD_NAME, buf);
537// OBSOLETE if (check_token (','))
538// OBSOLETE parse_named_record_element ();
539// OBSOLETE else if (check_token (':'))
540// OBSOLETE parse_expr ();
541// OBSOLETE else
542// OBSOLETE error ("syntax error near `%s' in named record tuple element", lexptr);
543// OBSOLETE write_exp_elt_opcode (OP_LABELED);
544// OBSOLETE write_exp_string (label);
545// OBSOLETE write_exp_elt_opcode (OP_LABELED);
546// OBSOLETE }
547// OBSOLETE
548// OBSOLETE /* Returns one or more TREE_LIST nodes, in reverse order. */
549// OBSOLETE
550// OBSOLETE static void
551// OBSOLETE parse_tuple_element (struct type *type)
552// OBSOLETE {
553// OBSOLETE if (PEEK_TOKEN () == DOT_FIELD_NAME)
554// OBSOLETE {
555// OBSOLETE /* Parse a labelled structure tuple. */
556// OBSOLETE parse_named_record_element ();
557// OBSOLETE return;
558// OBSOLETE }
559// OBSOLETE
560// OBSOLETE if (check_token ('('))
561// OBSOLETE {
562// OBSOLETE if (check_token ('*'))
563// OBSOLETE {
564// OBSOLETE expect (')', "missing ')' after '*' case label list");
565// OBSOLETE if (type)
566// OBSOLETE {
567// OBSOLETE if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
568// OBSOLETE {
569// OBSOLETE /* do this as a range from low to high */
570// OBSOLETE struct type *range_type = TYPE_FIELD_TYPE (type, 0);
571// OBSOLETE LONGEST low_bound, high_bound;
572// OBSOLETE if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
573// OBSOLETE error ("cannot determine bounds for (*)");
574// OBSOLETE /* lower bound */
575// OBSOLETE write_exp_elt_opcode (OP_LONG);
576// OBSOLETE write_exp_elt_type (range_type);
577// OBSOLETE write_exp_elt_longcst (low_bound);
578// OBSOLETE write_exp_elt_opcode (OP_LONG);
579// OBSOLETE /* upper bound */
580// OBSOLETE write_exp_elt_opcode (OP_LONG);
581// OBSOLETE write_exp_elt_type (range_type);
582// OBSOLETE write_exp_elt_longcst (high_bound);
583// OBSOLETE write_exp_elt_opcode (OP_LONG);
584// OBSOLETE write_exp_elt_opcode (BINOP_RANGE);
585// OBSOLETE }
586// OBSOLETE else
587// OBSOLETE error ("(*) in invalid context");
588// OBSOLETE }
589// OBSOLETE else
590// OBSOLETE error ("(*) only possible with modename in front of tuple (mode[..])");
591// OBSOLETE }
592// OBSOLETE else
593// OBSOLETE {
594// OBSOLETE parse_case_label ();
595// OBSOLETE while (check_token (','))
596// OBSOLETE {
597// OBSOLETE parse_case_label ();
598// OBSOLETE write_exp_elt_opcode (BINOP_COMMA);
599// OBSOLETE }
600// OBSOLETE expect (')', NULL);
601// OBSOLETE }
602// OBSOLETE }
603// OBSOLETE else
604// OBSOLETE parse_untyped_expr ();
605// OBSOLETE if (check_token (':'))
606// OBSOLETE {
607// OBSOLETE /* A powerset range or a labeled Array. */
608// OBSOLETE parse_untyped_expr ();
609// OBSOLETE write_exp_elt_opcode (BINOP_RANGE);
610// OBSOLETE }
611// OBSOLETE }
612// OBSOLETE
613// OBSOLETE /* Matches: a COMMA-separated list of tuple elements.
614// OBSOLETE Returns a list (of TREE_LIST nodes). */
615// OBSOLETE static void
616// OBSOLETE parse_opt_element_list (struct type *type)
617// OBSOLETE {
618// OBSOLETE arglist_len = 0;
619// OBSOLETE if (PEEK_TOKEN () == ']')
620// OBSOLETE return;
621// OBSOLETE for (;;)
622// OBSOLETE {
623// OBSOLETE parse_tuple_element (type);
624// OBSOLETE arglist_len++;
625// OBSOLETE if (PEEK_TOKEN () == ']')
626// OBSOLETE break;
627// OBSOLETE if (!check_token (','))
628// OBSOLETE error ("bad syntax in tuple");
629// OBSOLETE }
630// OBSOLETE }
631// OBSOLETE
632// OBSOLETE /* Parses: '[' elements ']'
633// OBSOLETE If modename is non-NULL it prefixed the tuple. */
634// OBSOLETE
635// OBSOLETE static void
636// OBSOLETE parse_tuple (struct type *mode)
637// OBSOLETE {
638// OBSOLETE struct type *type;
639// OBSOLETE if (mode)
640// OBSOLETE type = check_typedef (mode);
641// OBSOLETE else
642// OBSOLETE type = 0;
643// OBSOLETE require ('[');
644// OBSOLETE start_arglist ();
645// OBSOLETE parse_opt_element_list (type);
646// OBSOLETE expect (']', "missing ']' after tuple");
647// OBSOLETE write_exp_elt_opcode (OP_ARRAY);
648// OBSOLETE write_exp_elt_longcst ((LONGEST) 0);
649// OBSOLETE write_exp_elt_longcst ((LONGEST) end_arglist () - 1);
650// OBSOLETE write_exp_elt_opcode (OP_ARRAY);
651// OBSOLETE if (type)
652// OBSOLETE {
653// OBSOLETE if (TYPE_CODE (type) != TYPE_CODE_ARRAY
654// OBSOLETE && TYPE_CODE (type) != TYPE_CODE_STRUCT
655// OBSOLETE && TYPE_CODE (type) != TYPE_CODE_SET)
656// OBSOLETE error ("invalid tuple mode");
657// OBSOLETE write_exp_elt_opcode (UNOP_CAST);
658// OBSOLETE write_exp_elt_type (mode);
659// OBSOLETE write_exp_elt_opcode (UNOP_CAST);
660// OBSOLETE }
661// OBSOLETE }
662// OBSOLETE
663// OBSOLETE static void
664// OBSOLETE parse_primval (void)
665// OBSOLETE {
666// OBSOLETE struct type *type;
667// OBSOLETE enum exp_opcode op;
668// OBSOLETE char *op_name;
669// OBSOLETE switch (PEEK_TOKEN ())
670// OBSOLETE {
671// OBSOLETE case INTEGER_LITERAL:
672// OBSOLETE case CHARACTER_LITERAL:
673// OBSOLETE write_exp_elt_opcode (OP_LONG);
674// OBSOLETE write_exp_elt_type (PEEK_LVAL ().typed_val.type);
675// OBSOLETE write_exp_elt_longcst (PEEK_LVAL ().typed_val.val);
676// OBSOLETE write_exp_elt_opcode (OP_LONG);
677// OBSOLETE FORWARD_TOKEN ();
678// OBSOLETE break;
679// OBSOLETE case BOOLEAN_LITERAL:
680// OBSOLETE write_exp_elt_opcode (OP_BOOL);
681// OBSOLETE write_exp_elt_longcst ((LONGEST) PEEK_LVAL ().ulval);
682// OBSOLETE write_exp_elt_opcode (OP_BOOL);
683// OBSOLETE FORWARD_TOKEN ();
684// OBSOLETE break;
685// OBSOLETE case FLOAT_LITERAL:
686// OBSOLETE write_exp_elt_opcode (OP_DOUBLE);
687// OBSOLETE write_exp_elt_type (builtin_type_double);
688// OBSOLETE write_exp_elt_dblcst (PEEK_LVAL ().dval);
689// OBSOLETE write_exp_elt_opcode (OP_DOUBLE);
690// OBSOLETE FORWARD_TOKEN ();
691// OBSOLETE break;
692// OBSOLETE case EMPTINESS_LITERAL:
693// OBSOLETE write_exp_elt_opcode (OP_LONG);
694// OBSOLETE write_exp_elt_type (lookup_pointer_type (builtin_type_void));
695// OBSOLETE write_exp_elt_longcst (0);
696// OBSOLETE write_exp_elt_opcode (OP_LONG);
697// OBSOLETE FORWARD_TOKEN ();
698// OBSOLETE break;
699// OBSOLETE case CHARACTER_STRING_LITERAL:
700// OBSOLETE write_exp_elt_opcode (OP_STRING);
701// OBSOLETE write_exp_string (PEEK_LVAL ().sval);
702// OBSOLETE write_exp_elt_opcode (OP_STRING);
703// OBSOLETE FORWARD_TOKEN ();
704// OBSOLETE break;
705// OBSOLETE case BIT_STRING_LITERAL:
706// OBSOLETE write_exp_elt_opcode (OP_BITSTRING);
707// OBSOLETE write_exp_bitstring (PEEK_LVAL ().sval);
708// OBSOLETE write_exp_elt_opcode (OP_BITSTRING);
709// OBSOLETE FORWARD_TOKEN ();
710// OBSOLETE break;
711// OBSOLETE case ARRAY:
712// OBSOLETE FORWARD_TOKEN ();
713// OBSOLETE /* This is pseudo-Chill, similar to C's '(TYPE[])EXPR'
714// OBSOLETE which casts to an artificial array. */
715// OBSOLETE expect ('(', NULL);
716// OBSOLETE expect (')', NULL);
717// OBSOLETE if (PEEK_TOKEN () != TYPENAME)
718// OBSOLETE error ("missing MODENAME after ARRAY()");
719// OBSOLETE type = PEEK_LVAL ().tsym.type;
720// OBSOLETE FORWARD_TOKEN ();
721// OBSOLETE expect ('(', NULL);
722// OBSOLETE parse_expr ();
723// OBSOLETE expect (')', "missing right parenthesis");
724// OBSOLETE type = create_array_type ((struct type *) NULL, type,
725// OBSOLETE create_range_type ((struct type *) NULL,
726// OBSOLETE builtin_type_int, 0, 0));
727// OBSOLETE TYPE_ARRAY_UPPER_BOUND_TYPE (type) = BOUND_CANNOT_BE_DETERMINED;
728// OBSOLETE write_exp_elt_opcode (UNOP_CAST);
729// OBSOLETE write_exp_elt_type (type);
730// OBSOLETE write_exp_elt_opcode (UNOP_CAST);
731// OBSOLETE break;
732// OBSOLETE #if 0
733// OBSOLETE case CONST:
734// OBSOLETE case EXPR:
735// OBSOLETE val = PEEK_LVAL ();
736// OBSOLETE FORWARD_TOKEN ();
737// OBSOLETE break;
738// OBSOLETE #endif
739// OBSOLETE case '(':
740// OBSOLETE FORWARD_TOKEN ();
741// OBSOLETE parse_expr ();
742// OBSOLETE expect (')', "missing right parenthesis");
743// OBSOLETE break;
744// OBSOLETE case '[':
745// OBSOLETE parse_tuple (NULL);
746// OBSOLETE break;
747// OBSOLETE case GENERAL_PROCEDURE_NAME:
748// OBSOLETE case LOCATION_NAME:
749// OBSOLETE write_exp_elt_opcode (OP_VAR_VALUE);
750// OBSOLETE write_exp_elt_block (NULL);
751// OBSOLETE write_exp_elt_sym (PEEK_LVAL ().ssym.sym);
752// OBSOLETE write_exp_elt_opcode (OP_VAR_VALUE);
753// OBSOLETE FORWARD_TOKEN ();
754// OBSOLETE break;
755// OBSOLETE case GDB_VARIABLE: /* gdb specific */
756// OBSOLETE FORWARD_TOKEN ();
757// OBSOLETE break;
758// OBSOLETE case NUM:
759// OBSOLETE parse_unary_call ();
760// OBSOLETE write_exp_elt_opcode (UNOP_CAST);
761// OBSOLETE write_exp_elt_type (builtin_type_int);
762// OBSOLETE write_exp_elt_opcode (UNOP_CAST);
763// OBSOLETE break;
764// OBSOLETE case CARD:
765// OBSOLETE parse_unary_call ();
766// OBSOLETE write_exp_elt_opcode (UNOP_CARD);
767// OBSOLETE break;
768// OBSOLETE case MAX_TOKEN:
769// OBSOLETE parse_unary_call ();
770// OBSOLETE write_exp_elt_opcode (UNOP_CHMAX);
771// OBSOLETE break;
772// OBSOLETE case MIN_TOKEN:
773// OBSOLETE parse_unary_call ();
774// OBSOLETE write_exp_elt_opcode (UNOP_CHMIN);
775// OBSOLETE break;
776// OBSOLETE case PRED:
777// OBSOLETE op_name = "PRED";
778// OBSOLETE goto unimplemented_unary_builtin;
779// OBSOLETE case SUCC:
780// OBSOLETE op_name = "SUCC";
781// OBSOLETE goto unimplemented_unary_builtin;
782// OBSOLETE case ABS:
783// OBSOLETE op_name = "ABS";
784// OBSOLETE goto unimplemented_unary_builtin;
785// OBSOLETE unimplemented_unary_builtin:
786// OBSOLETE parse_unary_call ();
787// OBSOLETE error ("not implemented: %s builtin function", op_name);
788// OBSOLETE break;
789// OBSOLETE case ADDR_TOKEN:
790// OBSOLETE parse_unary_call ();
791// OBSOLETE write_exp_elt_opcode (UNOP_ADDR);
792// OBSOLETE break;
793// OBSOLETE case SIZE:
794// OBSOLETE type = parse_mode_or_normal_call ();
795// OBSOLETE if (type)
796// OBSOLETE {
797// OBSOLETE write_exp_elt_opcode (OP_LONG);
798// OBSOLETE write_exp_elt_type (builtin_type_int);
799// OBSOLETE CHECK_TYPEDEF (type);
800// OBSOLETE write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (type));
801// OBSOLETE write_exp_elt_opcode (OP_LONG);
802// OBSOLETE }
803// OBSOLETE else
804// OBSOLETE write_exp_elt_opcode (UNOP_SIZEOF);
805// OBSOLETE break;
806// OBSOLETE case LOWER:
807// OBSOLETE op = UNOP_LOWER;
808// OBSOLETE goto lower_upper;
809// OBSOLETE case UPPER:
810// OBSOLETE op = UNOP_UPPER;
811// OBSOLETE goto lower_upper;
812// OBSOLETE lower_upper:
813// OBSOLETE type = parse_mode_or_normal_call ();
814// OBSOLETE write_lower_upper_value (op, type);
815// OBSOLETE break;
816// OBSOLETE case LENGTH:
817// OBSOLETE parse_unary_call ();
818// OBSOLETE write_exp_elt_opcode (UNOP_LENGTH);
819// OBSOLETE break;
820// OBSOLETE case TYPENAME:
821// OBSOLETE type = PEEK_LVAL ().tsym.type;
822// OBSOLETE FORWARD_TOKEN ();
823// OBSOLETE switch (PEEK_TOKEN ())
824// OBSOLETE {
825// OBSOLETE case '[':
826// OBSOLETE parse_tuple (type);
827// OBSOLETE break;
828// OBSOLETE case '(':
829// OBSOLETE FORWARD_TOKEN ();
830// OBSOLETE parse_expr ();
831// OBSOLETE expect (')', "missing right parenthesis");
832// OBSOLETE write_exp_elt_opcode (UNOP_CAST);
833// OBSOLETE write_exp_elt_type (type);
834// OBSOLETE write_exp_elt_opcode (UNOP_CAST);
835// OBSOLETE break;
836// OBSOLETE default:
837// OBSOLETE error ("typename in invalid context");
838// OBSOLETE }
839// OBSOLETE break;
840// OBSOLETE
841// OBSOLETE default:
842// OBSOLETE error ("invalid expression syntax at `%s'", lexptr);
843// OBSOLETE }
844// OBSOLETE for (;;)
845// OBSOLETE {
846// OBSOLETE switch (PEEK_TOKEN ())
847// OBSOLETE {
848// OBSOLETE case DOT_FIELD_NAME:
849// OBSOLETE write_exp_elt_opcode (STRUCTOP_STRUCT);
850// OBSOLETE write_exp_string (PEEK_LVAL ().sval);
851// OBSOLETE write_exp_elt_opcode (STRUCTOP_STRUCT);
852// OBSOLETE FORWARD_TOKEN ();
853// OBSOLETE continue;
854// OBSOLETE case POINTER:
855// OBSOLETE FORWARD_TOKEN ();
856// OBSOLETE if (PEEK_TOKEN () == TYPENAME)
857// OBSOLETE {
858// OBSOLETE type = PEEK_LVAL ().tsym.type;
859// OBSOLETE write_exp_elt_opcode (UNOP_CAST);
860// OBSOLETE write_exp_elt_type (lookup_pointer_type (type));
861// OBSOLETE write_exp_elt_opcode (UNOP_CAST);
862// OBSOLETE FORWARD_TOKEN ();
863// OBSOLETE }
864// OBSOLETE write_exp_elt_opcode (UNOP_IND);
865// OBSOLETE continue;
866// OBSOLETE case OPEN_PAREN:
867// OBSOLETE parse_call ();
868// OBSOLETE continue;
869// OBSOLETE case CHARACTER_STRING_LITERAL:
870// OBSOLETE case CHARACTER_LITERAL:
871// OBSOLETE case BIT_STRING_LITERAL:
872// OBSOLETE /* Handle string repetition. (See comment in parse_operand5.) */
873// OBSOLETE parse_primval ();
874// OBSOLETE write_exp_elt_opcode (MULTI_SUBSCRIPT);
875// OBSOLETE write_exp_elt_longcst (1);
876// OBSOLETE write_exp_elt_opcode (MULTI_SUBSCRIPT);
877// OBSOLETE continue;
878// OBSOLETE case END_TOKEN:
879// OBSOLETE case TOKEN_NOT_READ:
880// OBSOLETE case INTEGER_LITERAL:
881// OBSOLETE case BOOLEAN_LITERAL:
882// OBSOLETE case FLOAT_LITERAL:
883// OBSOLETE case GENERAL_PROCEDURE_NAME:
884// OBSOLETE case LOCATION_NAME:
885// OBSOLETE case EMPTINESS_LITERAL:
886// OBSOLETE case TYPENAME:
887// OBSOLETE case CASE:
888// OBSOLETE case OF:
889// OBSOLETE case ESAC:
890// OBSOLETE case LOGIOR:
891// OBSOLETE case ORIF:
892// OBSOLETE case LOGXOR:
893// OBSOLETE case LOGAND:
894// OBSOLETE case ANDIF:
895// OBSOLETE case NOTEQUAL:
896// OBSOLETE case GEQ:
897// OBSOLETE case LEQ:
898// OBSOLETE case IN:
899// OBSOLETE case SLASH_SLASH:
900// OBSOLETE case MOD:
901// OBSOLETE case REM:
902// OBSOLETE case NOT:
903// OBSOLETE case RECEIVE:
904// OBSOLETE case UP:
905// OBSOLETE case IF:
906// OBSOLETE case THEN:
907// OBSOLETE case ELSE:
908// OBSOLETE case FI:
909// OBSOLETE case ELSIF:
910// OBSOLETE case ILLEGAL_TOKEN:
911// OBSOLETE case NUM:
912// OBSOLETE case PRED:
913// OBSOLETE case SUCC:
914// OBSOLETE case ABS:
915// OBSOLETE case CARD:
916// OBSOLETE case MAX_TOKEN:
917// OBSOLETE case MIN_TOKEN:
918// OBSOLETE case ADDR_TOKEN:
919// OBSOLETE case SIZE:
920// OBSOLETE case UPPER:
921// OBSOLETE case LOWER:
922// OBSOLETE case LENGTH:
923// OBSOLETE case ARRAY:
924// OBSOLETE case GDB_VARIABLE:
925// OBSOLETE case GDB_ASSIGNMENT:
926// OBSOLETE break;
927// OBSOLETE }
928// OBSOLETE break;
929// OBSOLETE }
930// OBSOLETE return;
931// OBSOLETE }
932// OBSOLETE
933// OBSOLETE static void
934// OBSOLETE parse_operand6 (void)
935// OBSOLETE {
936// OBSOLETE if (check_token (RECEIVE))
937// OBSOLETE {
938// OBSOLETE parse_primval ();
939// OBSOLETE error ("not implemented: RECEIVE expression");
940// OBSOLETE }
941// OBSOLETE else if (check_token (POINTER))
942// OBSOLETE {
943// OBSOLETE parse_primval ();
944// OBSOLETE write_exp_elt_opcode (UNOP_ADDR);
945// OBSOLETE }
946// OBSOLETE else
947// OBSOLETE parse_primval ();
948// OBSOLETE }
949// OBSOLETE
950// OBSOLETE static void
951// OBSOLETE parse_operand5 (void)
952// OBSOLETE {
953// OBSOLETE enum exp_opcode op;
954// OBSOLETE /* We are supposed to be looking for a <string repetition operator>,
955// OBSOLETE but in general we can't distinguish that from a parenthesized
956// OBSOLETE expression. This is especially difficult if we allow the
957// OBSOLETE string operand to be a constant expression (as requested by
958// OBSOLETE some users), and not just a string literal.
959// OBSOLETE Consider: LPRN expr RPRN LPRN expr RPRN
960// OBSOLETE Is that a function call or string repetition?
961// OBSOLETE Instead, we handle string repetition in parse_primval,
962// OBSOLETE and build_generalized_call. */
963// OBSOLETE switch (PEEK_TOKEN ())
964// OBSOLETE {
965// OBSOLETE case NOT:
966// OBSOLETE op = UNOP_LOGICAL_NOT;
967// OBSOLETE break;
968// OBSOLETE case '-':
969// OBSOLETE op = UNOP_NEG;
970// OBSOLETE break;
971// OBSOLETE default:
972// OBSOLETE op = OP_NULL;
973// OBSOLETE }
974// OBSOLETE if (op != OP_NULL)
975// OBSOLETE FORWARD_TOKEN ();
976// OBSOLETE parse_operand6 ();
977// OBSOLETE if (op != OP_NULL)
978// OBSOLETE write_exp_elt_opcode (op);
979// OBSOLETE }
980// OBSOLETE
981// OBSOLETE static void
982// OBSOLETE parse_operand4 (void)
983// OBSOLETE {
984// OBSOLETE enum exp_opcode op;
985// OBSOLETE parse_operand5 ();
986// OBSOLETE for (;;)
987// OBSOLETE {
988// OBSOLETE switch (PEEK_TOKEN ())
989// OBSOLETE {
990// OBSOLETE case '*':
991// OBSOLETE op = BINOP_MUL;
992// OBSOLETE break;
993// OBSOLETE case '/':
994// OBSOLETE op = BINOP_DIV;
995// OBSOLETE break;
996// OBSOLETE case MOD:
997// OBSOLETE op = BINOP_MOD;
998// OBSOLETE break;
999// OBSOLETE case REM:
1000// OBSOLETE op = BINOP_REM;
1001// OBSOLETE break;
1002// OBSOLETE default:
1003// OBSOLETE return;
1004// OBSOLETE }
1005// OBSOLETE FORWARD_TOKEN ();
1006// OBSOLETE parse_operand5 ();
1007// OBSOLETE write_exp_elt_opcode (op);
1008// OBSOLETE }
1009// OBSOLETE }
1010// OBSOLETE
1011// OBSOLETE static void
1012// OBSOLETE parse_operand3 (void)
1013// OBSOLETE {
1014// OBSOLETE enum exp_opcode op;
1015// OBSOLETE parse_operand4 ();
1016// OBSOLETE for (;;)
1017// OBSOLETE {
1018// OBSOLETE switch (PEEK_TOKEN ())
1019// OBSOLETE {
1020// OBSOLETE case '+':
1021// OBSOLETE op = BINOP_ADD;
1022// OBSOLETE break;
1023// OBSOLETE case '-':
1024// OBSOLETE op = BINOP_SUB;
1025// OBSOLETE break;
1026// OBSOLETE case SLASH_SLASH:
1027// OBSOLETE op = BINOP_CONCAT;
1028// OBSOLETE break;
1029// OBSOLETE default:
1030// OBSOLETE return;
1031// OBSOLETE }
1032// OBSOLETE FORWARD_TOKEN ();
1033// OBSOLETE parse_operand4 ();
1034// OBSOLETE write_exp_elt_opcode (op);
1035// OBSOLETE }
1036// OBSOLETE }
1037// OBSOLETE
1038// OBSOLETE static void
1039// OBSOLETE parse_operand2 (void)
1040// OBSOLETE {
1041// OBSOLETE enum exp_opcode op;
1042// OBSOLETE parse_operand3 ();
1043// OBSOLETE for (;;)
1044// OBSOLETE {
1045// OBSOLETE if (check_token (IN))
1046// OBSOLETE {
1047// OBSOLETE parse_operand3 ();
1048// OBSOLETE write_exp_elt_opcode (BINOP_IN);
1049// OBSOLETE }
1050// OBSOLETE else
1051// OBSOLETE {
1052// OBSOLETE switch (PEEK_TOKEN ())
1053// OBSOLETE {
1054// OBSOLETE case '>':
1055// OBSOLETE op = BINOP_GTR;
1056// OBSOLETE break;
1057// OBSOLETE case GEQ:
1058// OBSOLETE op = BINOP_GEQ;
1059// OBSOLETE break;
1060// OBSOLETE case '<':
1061// OBSOLETE op = BINOP_LESS;
1062// OBSOLETE break;
1063// OBSOLETE case LEQ:
1064// OBSOLETE op = BINOP_LEQ;
1065// OBSOLETE break;
1066// OBSOLETE case '=':
1067// OBSOLETE op = BINOP_EQUAL;
1068// OBSOLETE break;
1069// OBSOLETE case NOTEQUAL:
1070// OBSOLETE op = BINOP_NOTEQUAL;
1071// OBSOLETE break;
1072// OBSOLETE default:
1073// OBSOLETE return;
1074// OBSOLETE }
1075// OBSOLETE FORWARD_TOKEN ();
1076// OBSOLETE parse_operand3 ();
1077// OBSOLETE write_exp_elt_opcode (op);
1078// OBSOLETE }
1079// OBSOLETE }
1080// OBSOLETE }
1081// OBSOLETE
1082// OBSOLETE static void
1083// OBSOLETE parse_operand1 (void)
1084// OBSOLETE {
1085// OBSOLETE enum exp_opcode op;
1086// OBSOLETE parse_operand2 ();
1087// OBSOLETE for (;;)
1088// OBSOLETE {
1089// OBSOLETE switch (PEEK_TOKEN ())
1090// OBSOLETE {
1091// OBSOLETE case LOGAND:
1092// OBSOLETE op = BINOP_BITWISE_AND;
1093// OBSOLETE break;
1094// OBSOLETE case ANDIF:
1095// OBSOLETE op = BINOP_LOGICAL_AND;
1096// OBSOLETE break;
1097// OBSOLETE default:
1098// OBSOLETE return;
1099// OBSOLETE }
1100// OBSOLETE FORWARD_TOKEN ();
1101// OBSOLETE parse_operand2 ();
1102// OBSOLETE write_exp_elt_opcode (op);
1103// OBSOLETE }
1104// OBSOLETE }
1105// OBSOLETE
1106// OBSOLETE static void
1107// OBSOLETE parse_operand0 (void)
1108// OBSOLETE {
1109// OBSOLETE enum exp_opcode op;
1110// OBSOLETE parse_operand1 ();
1111// OBSOLETE for (;;)
1112// OBSOLETE {
1113// OBSOLETE switch (PEEK_TOKEN ())
1114// OBSOLETE {
1115// OBSOLETE case LOGIOR:
1116// OBSOLETE op = BINOP_BITWISE_IOR;
1117// OBSOLETE break;
1118// OBSOLETE case LOGXOR:
1119// OBSOLETE op = BINOP_BITWISE_XOR;
1120// OBSOLETE break;
1121// OBSOLETE case ORIF:
1122// OBSOLETE op = BINOP_LOGICAL_OR;
1123// OBSOLETE break;
1124// OBSOLETE default:
1125// OBSOLETE return;
1126// OBSOLETE }
1127// OBSOLETE FORWARD_TOKEN ();
1128// OBSOLETE parse_operand1 ();
1129// OBSOLETE write_exp_elt_opcode (op);
1130// OBSOLETE }
1131// OBSOLETE }
1132// OBSOLETE
1133// OBSOLETE static void
1134// OBSOLETE parse_expr (void)
1135// OBSOLETE {
1136// OBSOLETE parse_operand0 ();
1137// OBSOLETE if (check_token (GDB_ASSIGNMENT))
1138// OBSOLETE {
1139// OBSOLETE parse_expr ();
1140// OBSOLETE write_exp_elt_opcode (BINOP_ASSIGN);
1141// OBSOLETE }
1142// OBSOLETE }
1143// OBSOLETE
1144// OBSOLETE static void
1145// OBSOLETE parse_then_alternative (void)
1146// OBSOLETE {
1147// OBSOLETE expect (THEN, "missing 'THEN' in 'IF' expression");
1148// OBSOLETE parse_expr ();
1149// OBSOLETE }
1150// OBSOLETE
1151// OBSOLETE static void
1152// OBSOLETE parse_else_alternative (void)
1153// OBSOLETE {
1154// OBSOLETE if (check_token (ELSIF))
1155// OBSOLETE parse_if_expression_body ();
1156// OBSOLETE else if (check_token (ELSE))
1157// OBSOLETE parse_expr ();
1158// OBSOLETE else
1159// OBSOLETE error ("missing ELSE/ELSIF in IF expression");
1160// OBSOLETE }
1161// OBSOLETE
1162// OBSOLETE /* Matches: <boolean expression> <then alternative> <else alternative> */
1163// OBSOLETE
1164// OBSOLETE static void
1165// OBSOLETE parse_if_expression_body (void)
1166// OBSOLETE {
1167// OBSOLETE parse_expr ();
1168// OBSOLETE parse_then_alternative ();
1169// OBSOLETE parse_else_alternative ();
1170// OBSOLETE write_exp_elt_opcode (TERNOP_COND);
1171// OBSOLETE }
1172// OBSOLETE
1173// OBSOLETE static void
1174// OBSOLETE parse_if_expression (void)
1175// OBSOLETE {
1176// OBSOLETE require (IF);
1177// OBSOLETE parse_if_expression_body ();
1178// OBSOLETE expect (FI, "missing 'FI' at end of conditional expression");
1179// OBSOLETE }
1180// OBSOLETE
1181// OBSOLETE /* An <untyped_expr> is a superset of <expr>. It also includes
1182// OBSOLETE <conditional expressions> and untyped <tuples>, whose types
1183// OBSOLETE are not given by their constituents. Hence, these are only
1184// OBSOLETE allowed in certain contexts that expect a certain type.
1185// OBSOLETE You should call convert() to fix up the <untyped_expr>. */
1186// OBSOLETE
1187// OBSOLETE static void
1188// OBSOLETE parse_untyped_expr (void)
1189// OBSOLETE {
1190// OBSOLETE switch (PEEK_TOKEN ())
1191// OBSOLETE {
1192// OBSOLETE case IF:
1193// OBSOLETE parse_if_expression ();
1194// OBSOLETE return;
1195// OBSOLETE case CASE:
1196// OBSOLETE error ("not implemented: CASE expression");
1197// OBSOLETE case '(':
1198// OBSOLETE switch (PEEK_TOKEN1 ())
1199// OBSOLETE {
1200// OBSOLETE case IF:
1201// OBSOLETE case CASE:
1202// OBSOLETE goto skip_lprn;
1203// OBSOLETE case '[':
1204// OBSOLETE skip_lprn:
1205// OBSOLETE FORWARD_TOKEN ();
1206// OBSOLETE parse_untyped_expr ();
1207// OBSOLETE expect (')', "missing ')'");
1208// OBSOLETE return;
1209// OBSOLETE default:;
1210// OBSOLETE /* fall through */
1211// OBSOLETE }
1212// OBSOLETE default:
1213// OBSOLETE parse_operand0 ();
1214// OBSOLETE }
1215// OBSOLETE }
1216// OBSOLETE
1217// OBSOLETE int
1218// OBSOLETE chill_parse (void)
1219// OBSOLETE {
1220// OBSOLETE terminal_buffer[0] = TOKEN_NOT_READ;
1221// OBSOLETE if (PEEK_TOKEN () == TYPENAME && PEEK_TOKEN1 () == END_TOKEN)
1222// OBSOLETE {
1223// OBSOLETE write_exp_elt_opcode (OP_TYPE);
1224// OBSOLETE write_exp_elt_type (PEEK_LVAL ().tsym.type);
1225// OBSOLETE write_exp_elt_opcode (OP_TYPE);
1226// OBSOLETE FORWARD_TOKEN ();
1227// OBSOLETE }
1228// OBSOLETE else
1229// OBSOLETE parse_expr ();
1230// OBSOLETE if (terminal_buffer[0] != END_TOKEN)
1231// OBSOLETE {
1232// OBSOLETE if (comma_terminates && terminal_buffer[0] == ',')
1233// OBSOLETE lexptr--; /* Put the comma back. */
1234// OBSOLETE else
1235// OBSOLETE error ("Junk after end of expression.");
1236// OBSOLETE }
1237// OBSOLETE return 0;
1238// OBSOLETE }
1239// OBSOLETE
1240// OBSOLETE
1241// OBSOLETE /* Implementation of a dynamically expandable buffer for processing input
1242// OBSOLETE characters acquired through lexptr and building a value to return in
1243// OBSOLETE yylval. */
1244// OBSOLETE
1245// OBSOLETE static char *tempbuf; /* Current buffer contents */
1246// OBSOLETE static int tempbufsize; /* Size of allocated buffer */
1247// OBSOLETE static int tempbufindex; /* Current index into buffer */
1248// OBSOLETE
1249// OBSOLETE #define GROWBY_MIN_SIZE 64 /* Minimum amount to grow buffer by */
1250// OBSOLETE
1251// OBSOLETE #define CHECKBUF(size) \
1252// OBSOLETE do { \
1253// OBSOLETE if (tempbufindex + (size) >= tempbufsize) \
1254// OBSOLETE { \
1255// OBSOLETE growbuf_by_size (size); \
1256// OBSOLETE } \
1257// OBSOLETE } while (0);
1258// OBSOLETE
1259// OBSOLETE /* Grow the static temp buffer if necessary, including allocating the first one
1260// OBSOLETE on demand. */
1261// OBSOLETE
1262// OBSOLETE static void
1263// OBSOLETE growbuf_by_size (int count)
1264// OBSOLETE {
1265// OBSOLETE int growby;
1266// OBSOLETE
1267// OBSOLETE growby = max (count, GROWBY_MIN_SIZE);
1268// OBSOLETE tempbufsize += growby;
1269// OBSOLETE if (tempbuf == NULL)
1270// OBSOLETE {
1271// OBSOLETE tempbuf = (char *) xmalloc (tempbufsize);
1272// OBSOLETE }
1273// OBSOLETE else
1274// OBSOLETE {
1275// OBSOLETE tempbuf = (char *) xrealloc (tempbuf, tempbufsize);
1276// OBSOLETE }
1277// OBSOLETE }
1278// OBSOLETE
1279// OBSOLETE /* Try to consume a simple name string token. If successful, returns
1280// OBSOLETE a pointer to a nullbyte terminated copy of the name that can be used
1281// OBSOLETE in symbol table lookups. If not successful, returns NULL. */
1282// OBSOLETE
1283// OBSOLETE static char *
1284// OBSOLETE match_simple_name_string (void)
1285// OBSOLETE {
1286// OBSOLETE char *tokptr = lexptr;
1287// OBSOLETE
1288// OBSOLETE if (isalpha (*tokptr) || *tokptr == '_')
1289// OBSOLETE {
1290// OBSOLETE char *result;
1291// OBSOLETE do
1292// OBSOLETE {
1293// OBSOLETE tokptr++;
1294// OBSOLETE }
1295// OBSOLETE while (isalnum (*tokptr) || (*tokptr == '_'));
1296// OBSOLETE yylval.sval.ptr = lexptr;
1297// OBSOLETE yylval.sval.length = tokptr - lexptr;
1298// OBSOLETE lexptr = tokptr;
1299// OBSOLETE result = copy_name (yylval.sval);
1300// OBSOLETE return result;
1301// OBSOLETE }
1302// OBSOLETE return (NULL);
1303// OBSOLETE }
1304// OBSOLETE
1305// OBSOLETE /* Start looking for a value composed of valid digits as set by the base
1306// OBSOLETE in use. Note that '_' characters are valid anywhere, in any quantity,
1307// OBSOLETE and are simply ignored. Since we must find at least one valid digit,
1308// OBSOLETE or reject this token as an integer literal, we keep track of how many
1309// OBSOLETE digits we have encountered. */
1310// OBSOLETE
1311// OBSOLETE static int
1312// OBSOLETE decode_integer_value (int base, char **tokptrptr, LONGEST *ivalptr)
1313// OBSOLETE {
1314// OBSOLETE char *tokptr = *tokptrptr;
1315// OBSOLETE int temp;
1316// OBSOLETE int digits = 0;
1317// OBSOLETE
1318// OBSOLETE while (*tokptr != '\0')
1319// OBSOLETE {
1320// OBSOLETE temp = *tokptr;
1321// OBSOLETE if (isupper (temp))
1322// OBSOLETE temp = tolower (temp);
1323// OBSOLETE tokptr++;
1324// OBSOLETE switch (temp)
1325// OBSOLETE {
1326// OBSOLETE case '_':
1327// OBSOLETE continue;
1328// OBSOLETE case '0':
1329// OBSOLETE case '1':
1330// OBSOLETE case '2':
1331// OBSOLETE case '3':
1332// OBSOLETE case '4':
1333// OBSOLETE case '5':
1334// OBSOLETE case '6':
1335// OBSOLETE case '7':
1336// OBSOLETE case '8':
1337// OBSOLETE case '9':
1338// OBSOLETE temp -= '0';
1339// OBSOLETE break;
1340// OBSOLETE case 'a':
1341// OBSOLETE case 'b':
1342// OBSOLETE case 'c':
1343// OBSOLETE case 'd':
1344// OBSOLETE case 'e':
1345// OBSOLETE case 'f':
1346// OBSOLETE temp -= 'a';
1347// OBSOLETE temp += 10;
1348// OBSOLETE break;
1349// OBSOLETE default:
1350// OBSOLETE temp = base;
1351// OBSOLETE break;
1352// OBSOLETE }
1353// OBSOLETE if (temp < base)
1354// OBSOLETE {
1355// OBSOLETE digits++;
1356// OBSOLETE *ivalptr *= base;
1357// OBSOLETE *ivalptr += temp;
1358// OBSOLETE }
1359// OBSOLETE else
1360// OBSOLETE {
1361// OBSOLETE /* Found something not in domain for current base. */
1362// OBSOLETE tokptr--; /* Unconsume what gave us indigestion. */
1363// OBSOLETE break;
1364// OBSOLETE }
1365// OBSOLETE }
1366// OBSOLETE
1367// OBSOLETE /* If we didn't find any digits, then we don't have a valid integer
1368// OBSOLETE value, so reject the entire token. Otherwise, update the lexical
1369// OBSOLETE scan pointer, and return non-zero for success. */
1370// OBSOLETE
1371// OBSOLETE if (digits == 0)
1372// OBSOLETE {
1373// OBSOLETE return (0);
1374// OBSOLETE }
1375// OBSOLETE else
1376// OBSOLETE {
1377// OBSOLETE *tokptrptr = tokptr;
1378// OBSOLETE return (1);
1379// OBSOLETE }
1380// OBSOLETE }
1381// OBSOLETE
1382// OBSOLETE static int
1383// OBSOLETE decode_integer_literal (LONGEST *valptr, char **tokptrptr)
1384// OBSOLETE {
1385// OBSOLETE char *tokptr = *tokptrptr;
1386// OBSOLETE int base = 0;
1387// OBSOLETE LONGEST ival = 0;
1388// OBSOLETE int explicit_base = 0;
1389// OBSOLETE
1390// OBSOLETE /* Look for an explicit base specifier, which is optional. */
1391// OBSOLETE
1392// OBSOLETE switch (*tokptr)
1393// OBSOLETE {
1394// OBSOLETE case 'd':
1395// OBSOLETE case 'D':
1396// OBSOLETE explicit_base++;
1397// OBSOLETE base = 10;
1398// OBSOLETE tokptr++;
1399// OBSOLETE break;
1400// OBSOLETE case 'b':
1401// OBSOLETE case 'B':
1402// OBSOLETE explicit_base++;
1403// OBSOLETE base = 2;
1404// OBSOLETE tokptr++;
1405// OBSOLETE break;
1406// OBSOLETE case 'h':
1407// OBSOLETE case 'H':
1408// OBSOLETE explicit_base++;
1409// OBSOLETE base = 16;
1410// OBSOLETE tokptr++;
1411// OBSOLETE break;
1412// OBSOLETE case 'o':
1413// OBSOLETE case 'O':
1414// OBSOLETE explicit_base++;
1415// OBSOLETE base = 8;
1416// OBSOLETE tokptr++;
1417// OBSOLETE break;
1418// OBSOLETE default:
1419// OBSOLETE base = 10;
1420// OBSOLETE break;
1421// OBSOLETE }
1422// OBSOLETE
1423// OBSOLETE /* If we found an explicit base ensure that the character after the
1424// OBSOLETE explicit base is a single quote. */
1425// OBSOLETE
1426// OBSOLETE if (explicit_base && (*tokptr++ != '\''))
1427// OBSOLETE {
1428// OBSOLETE return (0);
1429// OBSOLETE }
1430// OBSOLETE
1431// OBSOLETE /* Attempt to decode whatever follows as an integer value in the
1432// OBSOLETE indicated base, updating the token pointer in the process and
1433// OBSOLETE computing the value into ival. Also, if we have an explicit
1434// OBSOLETE base, then the next character must not be a single quote, or we
1435// OBSOLETE have a bitstring literal, so reject the entire token in this case.
1436// OBSOLETE Otherwise, update the lexical scan pointer, and return non-zero
1437// OBSOLETE for success. */
1438// OBSOLETE
1439// OBSOLETE if (!decode_integer_value (base, &tokptr, &ival))
1440// OBSOLETE {
1441// OBSOLETE return (0);
1442// OBSOLETE }
1443// OBSOLETE else if (explicit_base && (*tokptr == '\''))
1444// OBSOLETE {
1445// OBSOLETE return (0);
1446// OBSOLETE }
1447// OBSOLETE else
1448// OBSOLETE {
1449// OBSOLETE *valptr = ival;
1450// OBSOLETE *tokptrptr = tokptr;
1451// OBSOLETE return (1);
1452// OBSOLETE }
1453// OBSOLETE }
1454// OBSOLETE
1455// OBSOLETE /* If it wasn't for the fact that floating point values can contain '_'
1456// OBSOLETE characters, we could just let strtod do all the hard work by letting it
1457// OBSOLETE try to consume as much of the current token buffer as possible and
1458// OBSOLETE find a legal conversion. Unfortunately we need to filter out the '_'
1459// OBSOLETE characters before calling strtod, which we do by copying the other
1460// OBSOLETE legal chars to a local buffer to be converted. However since we also
1461// OBSOLETE need to keep track of where the last unconsumed character in the input
1462// OBSOLETE buffer is, we have transfer only as many characters as may compose a
1463// OBSOLETE legal floating point value. */
1464// OBSOLETE
1465// OBSOLETE static enum ch_terminal
1466// OBSOLETE match_float_literal (void)
1467// OBSOLETE {
1468// OBSOLETE char *tokptr = lexptr;
1469// OBSOLETE char *buf;
1470// OBSOLETE char *copy;
1471// OBSOLETE double dval;
1472// OBSOLETE extern double strtod ();
1473// OBSOLETE
1474// OBSOLETE /* Make local buffer in which to build the string to convert. This is
1475// OBSOLETE required because underscores are valid in chill floating point numbers
1476// OBSOLETE but not in the string passed to strtod to convert. The string will be
1477// OBSOLETE no longer than our input string. */
1478// OBSOLETE
1479// OBSOLETE copy = buf = (char *) alloca (strlen (tokptr) + 1);
1480// OBSOLETE
1481// OBSOLETE /* Transfer all leading digits to the conversion buffer, discarding any
1482// OBSOLETE underscores. */
1483// OBSOLETE
1484// OBSOLETE while (isdigit (*tokptr) || *tokptr == '_')
1485// OBSOLETE {
1486// OBSOLETE if (*tokptr != '_')
1487// OBSOLETE {
1488// OBSOLETE *copy++ = *tokptr;
1489// OBSOLETE }
1490// OBSOLETE tokptr++;
1491// OBSOLETE }
1492// OBSOLETE
1493// OBSOLETE /* Now accept either a '.', or one of [eEdD]. Dot is legal regardless
1494// OBSOLETE of whether we found any leading digits, and we simply accept it and
1495// OBSOLETE continue on to look for the fractional part and/or exponent. One of
1496// OBSOLETE [eEdD] is legal only if we have seen digits, and means that there
1497// OBSOLETE is no fractional part. If we find neither of these, then this is
1498// OBSOLETE not a floating point number, so return failure. */
1499// OBSOLETE
1500// OBSOLETE switch (*tokptr++)
1501// OBSOLETE {
1502// OBSOLETE case '.':
1503// OBSOLETE /* Accept and then look for fractional part and/or exponent. */
1504// OBSOLETE *copy++ = '.';
1505// OBSOLETE break;
1506// OBSOLETE
1507// OBSOLETE case 'e':
1508// OBSOLETE case 'E':
1509// OBSOLETE case 'd':
1510// OBSOLETE case 'D':
1511// OBSOLETE if (copy == buf)
1512// OBSOLETE {
1513// OBSOLETE return (0);
1514// OBSOLETE }
1515// OBSOLETE *copy++ = 'e';
1516// OBSOLETE goto collect_exponent;
1517// OBSOLETE break;
1518// OBSOLETE
1519// OBSOLETE default:
1520// OBSOLETE return (0);
1521// OBSOLETE break;
1522// OBSOLETE }
1523// OBSOLETE
1524// OBSOLETE /* We found a '.', copy any fractional digits to the conversion buffer, up
1525// OBSOLETE to the first nondigit, non-underscore character. */
1526// OBSOLETE
1527// OBSOLETE while (isdigit (*tokptr) || *tokptr == '_')
1528// OBSOLETE {
1529// OBSOLETE if (*tokptr != '_')
1530// OBSOLETE {
1531// OBSOLETE *copy++ = *tokptr;
1532// OBSOLETE }
1533// OBSOLETE tokptr++;
1534// OBSOLETE }
1535// OBSOLETE
1536// OBSOLETE /* Look for an exponent, which must start with one of [eEdD]. If none
1537// OBSOLETE is found, jump directly to trying to convert what we have collected
1538// OBSOLETE so far. */
1539// OBSOLETE
1540// OBSOLETE switch (*tokptr)
1541// OBSOLETE {
1542// OBSOLETE case 'e':
1543// OBSOLETE case 'E':
1544// OBSOLETE case 'd':
1545// OBSOLETE case 'D':
1546// OBSOLETE *copy++ = 'e';
1547// OBSOLETE tokptr++;
1548// OBSOLETE break;
1549// OBSOLETE default:
1550// OBSOLETE goto convert_float;
1551// OBSOLETE break;
1552// OBSOLETE }
1553// OBSOLETE
1554// OBSOLETE /* Accept an optional '-' or '+' following one of [eEdD]. */
1555// OBSOLETE
1556// OBSOLETE collect_exponent:
1557// OBSOLETE if (*tokptr == '+' || *tokptr == '-')
1558// OBSOLETE {
1559// OBSOLETE *copy++ = *tokptr++;
1560// OBSOLETE }
1561// OBSOLETE
1562// OBSOLETE /* Now copy an exponent into the conversion buffer. Note that at the
1563// OBSOLETE moment underscores are *not* allowed in exponents. */
1564// OBSOLETE
1565// OBSOLETE while (isdigit (*tokptr))
1566// OBSOLETE {
1567// OBSOLETE *copy++ = *tokptr++;
1568// OBSOLETE }
1569// OBSOLETE
1570// OBSOLETE /* If we transfered any chars to the conversion buffer, try to interpret its
1571// OBSOLETE contents as a floating point value. If any characters remain, then we
1572// OBSOLETE must not have a valid floating point string. */
1573// OBSOLETE
1574// OBSOLETE convert_float:
1575// OBSOLETE *copy = '\0';
1576// OBSOLETE if (copy != buf)
1577// OBSOLETE {
1578// OBSOLETE dval = strtod (buf, &copy);
1579// OBSOLETE if (*copy == '\0')
1580// OBSOLETE {
1581// OBSOLETE yylval.dval = dval;
1582// OBSOLETE lexptr = tokptr;
1583// OBSOLETE return (FLOAT_LITERAL);
1584// OBSOLETE }
1585// OBSOLETE }
1586// OBSOLETE return (0);
1587// OBSOLETE }
1588// OBSOLETE
1589// OBSOLETE /* Recognize a string literal. A string literal is a sequence
1590// OBSOLETE of characters enclosed in matching single or double quotes, except that
1591// OBSOLETE a single character inside single quotes is a character literal, which
1592// OBSOLETE we reject as a string literal. To embed the terminator character inside
1593// OBSOLETE a string, it is simply doubled (I.E. "this""is""one""string") */
1594// OBSOLETE
1595// OBSOLETE static enum ch_terminal
1596// OBSOLETE match_string_literal (void)
1597// OBSOLETE {
1598// OBSOLETE char *tokptr = lexptr;
1599// OBSOLETE int in_ctrlseq = 0;
1600// OBSOLETE LONGEST ival;
1601// OBSOLETE
1602// OBSOLETE for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
1603// OBSOLETE {
1604// OBSOLETE CHECKBUF (1);
1605// OBSOLETE tryagain:;
1606// OBSOLETE if (in_ctrlseq)
1607// OBSOLETE {
1608// OBSOLETE /* skip possible whitespaces */
1609// OBSOLETE while ((*tokptr == ' ' || *tokptr == '\t') && *tokptr)
1610// OBSOLETE tokptr++;
1611// OBSOLETE if (*tokptr == ')')
1612// OBSOLETE {
1613// OBSOLETE in_ctrlseq = 0;
1614// OBSOLETE tokptr++;
1615// OBSOLETE goto tryagain;
1616// OBSOLETE }
1617// OBSOLETE else if (*tokptr != ',')
1618// OBSOLETE error ("Invalid control sequence");
1619// OBSOLETE tokptr++;
1620// OBSOLETE /* skip possible whitespaces */
1621// OBSOLETE while ((*tokptr == ' ' || *tokptr == '\t') && *tokptr)
1622// OBSOLETE tokptr++;
1623// OBSOLETE if (!decode_integer_literal (&ival, &tokptr))
1624// OBSOLETE error ("Invalid control sequence");
1625// OBSOLETE tokptr--;
1626// OBSOLETE }
1627// OBSOLETE else if (*tokptr == *lexptr)
1628// OBSOLETE {
1629// OBSOLETE if (*(tokptr + 1) == *lexptr)
1630// OBSOLETE {
1631// OBSOLETE ival = *tokptr++;
1632// OBSOLETE }
1633// OBSOLETE else
1634// OBSOLETE {
1635// OBSOLETE break;
1636// OBSOLETE }
1637// OBSOLETE }
1638// OBSOLETE else if (*tokptr == '^')
1639// OBSOLETE {
1640// OBSOLETE if (*(tokptr + 1) == '(')
1641// OBSOLETE {
1642// OBSOLETE in_ctrlseq = 1;
1643// OBSOLETE tokptr += 2;
1644// OBSOLETE if (!decode_integer_literal (&ival, &tokptr))
1645// OBSOLETE error ("Invalid control sequence");
1646// OBSOLETE tokptr--;
1647// OBSOLETE }
1648// OBSOLETE else if (*(tokptr + 1) == '^')
1649// OBSOLETE ival = *tokptr++;
1650// OBSOLETE else
1651// OBSOLETE error ("Invalid control sequence");
1652// OBSOLETE }
1653// OBSOLETE else
1654// OBSOLETE ival = *tokptr;
1655// OBSOLETE tempbuf[tempbufindex++] = ival;
1656// OBSOLETE }
1657// OBSOLETE if (in_ctrlseq)
1658// OBSOLETE error ("Invalid control sequence");
1659// OBSOLETE
1660// OBSOLETE if (*tokptr == '\0' /* no terminator */
1661// OBSOLETE || (tempbufindex == 1 && *tokptr == '\'')) /* char literal */
1662// OBSOLETE {
1663// OBSOLETE return (0);
1664// OBSOLETE }
1665// OBSOLETE else
1666// OBSOLETE {
1667// OBSOLETE tempbuf[tempbufindex] = '\0';
1668// OBSOLETE yylval.sval.ptr = tempbuf;
1669// OBSOLETE yylval.sval.length = tempbufindex;
1670// OBSOLETE lexptr = ++tokptr;
1671// OBSOLETE return (CHARACTER_STRING_LITERAL);
1672// OBSOLETE }
1673// OBSOLETE }
1674// OBSOLETE
1675// OBSOLETE /* Recognize a character literal. A character literal is single character
1676// OBSOLETE or a control sequence, enclosed in single quotes. A control sequence
1677// OBSOLETE is a comma separated list of one or more integer literals, enclosed
1678// OBSOLETE in parenthesis and introduced with a circumflex character.
1679// OBSOLETE
1680// OBSOLETE EX: 'a' '^(7)' '^(7,8)'
1681// OBSOLETE
1682// OBSOLETE As a GNU chill extension, the syntax C'xx' is also recognized as a
1683// OBSOLETE character literal, where xx is a hex value for the character.
1684// OBSOLETE
1685// OBSOLETE Note that more than a single character, enclosed in single quotes, is
1686// OBSOLETE a string literal.
1687// OBSOLETE
1688// OBSOLETE Returns CHARACTER_LITERAL if a match is found.
1689// OBSOLETE */
1690// OBSOLETE
1691// OBSOLETE static enum ch_terminal
1692// OBSOLETE match_character_literal (void)
1693// OBSOLETE {
1694// OBSOLETE char *tokptr = lexptr;
1695// OBSOLETE LONGEST ival = 0;
1696// OBSOLETE
1697// OBSOLETE if ((*tokptr == 'c' || *tokptr == 'C') && (*(tokptr + 1) == '\''))
1698// OBSOLETE {
1699// OBSOLETE /* We have a GNU chill extension form, so skip the leading "C'",
1700// OBSOLETE decode the hex value, and then ensure that we have a trailing
1701// OBSOLETE single quote character. */
1702// OBSOLETE tokptr += 2;
1703// OBSOLETE if (!decode_integer_value (16, &tokptr, &ival) || (*tokptr != '\''))
1704// OBSOLETE {
1705// OBSOLETE return (0);
1706// OBSOLETE }
1707// OBSOLETE tokptr++;
1708// OBSOLETE }
1709// OBSOLETE else if (*tokptr == '\'')
1710// OBSOLETE {
1711// OBSOLETE tokptr++;
1712// OBSOLETE
1713// OBSOLETE /* Determine which form we have, either a control sequence or the
1714// OBSOLETE single character form. */
1715// OBSOLETE
1716// OBSOLETE if (*tokptr == '^')
1717// OBSOLETE {
1718// OBSOLETE if (*(tokptr + 1) == '(')
1719// OBSOLETE {
1720// OBSOLETE /* Match and decode a control sequence. Return zero if we don't
1721// OBSOLETE find a valid integer literal, or if the next unconsumed character
1722// OBSOLETE after the integer literal is not the trailing ')'. */
1723// OBSOLETE tokptr += 2;
1724// OBSOLETE if (!decode_integer_literal (&ival, &tokptr) || (*tokptr++ != ')'))
1725// OBSOLETE {
1726// OBSOLETE return (0);
1727// OBSOLETE }
1728// OBSOLETE }
1729// OBSOLETE else if (*(tokptr + 1) == '^')
1730// OBSOLETE {
1731// OBSOLETE ival = *tokptr;
1732// OBSOLETE tokptr += 2;
1733// OBSOLETE }
1734// OBSOLETE else
1735// OBSOLETE /* fail */
1736// OBSOLETE error ("Invalid control sequence");
1737// OBSOLETE }
1738// OBSOLETE else if (*tokptr == '\'')
1739// OBSOLETE {
1740// OBSOLETE /* this must be duplicated */
1741// OBSOLETE ival = *tokptr;
1742// OBSOLETE tokptr += 2;
1743// OBSOLETE }
1744// OBSOLETE else
1745// OBSOLETE {
1746// OBSOLETE ival = *tokptr++;
1747// OBSOLETE }
1748// OBSOLETE
1749// OBSOLETE /* The trailing quote has not yet been consumed. If we don't find
1750// OBSOLETE it, then we have no match. */
1751// OBSOLETE
1752// OBSOLETE if (*tokptr++ != '\'')
1753// OBSOLETE {
1754// OBSOLETE return (0);
1755// OBSOLETE }
1756// OBSOLETE }
1757// OBSOLETE else
1758// OBSOLETE {
1759// OBSOLETE /* Not a character literal. */
1760// OBSOLETE return (0);
1761// OBSOLETE }
1762// OBSOLETE yylval.typed_val.val = ival;
1763// OBSOLETE yylval.typed_val.type = builtin_type_chill_char;
1764// OBSOLETE lexptr = tokptr;
1765// OBSOLETE return (CHARACTER_LITERAL);
1766// OBSOLETE }
1767// OBSOLETE
1768// OBSOLETE /* Recognize an integer literal, as specified in Z.200 sec 5.2.4.2.
1769// OBSOLETE Note that according to 5.2.4.2, a single "_" is also a valid integer
1770// OBSOLETE literal, however GNU-chill requires there to be at least one "digit"
1771// OBSOLETE in any integer literal. */
1772// OBSOLETE
1773// OBSOLETE static enum ch_terminal
1774// OBSOLETE match_integer_literal (void)
1775// OBSOLETE {
1776// OBSOLETE char *tokptr = lexptr;
1777// OBSOLETE LONGEST ival;
1778// OBSOLETE
1779// OBSOLETE if (!decode_integer_literal (&ival, &tokptr))
1780// OBSOLETE {
1781// OBSOLETE return (0);
1782// OBSOLETE }
1783// OBSOLETE else
1784// OBSOLETE {
1785// OBSOLETE yylval.typed_val.val = ival;
1786// OBSOLETE #if defined(CC_HAS_LONG_LONG)
1787// OBSOLETE if (ival > (LONGEST) 2147483647U || ival < -(LONGEST) 2147483648U)
1788// OBSOLETE yylval.typed_val.type = builtin_type_long_long;
1789// OBSOLETE else
1790// OBSOLETE #endif
1791// OBSOLETE yylval.typed_val.type = builtin_type_int;
1792// OBSOLETE lexptr = tokptr;
1793// OBSOLETE return (INTEGER_LITERAL);
1794// OBSOLETE }
1795// OBSOLETE }
1796// OBSOLETE
1797// OBSOLETE /* Recognize a bit-string literal, as specified in Z.200 sec 5.2.4.8
1798// OBSOLETE Note that according to 5.2.4.8, a single "_" is also a valid bit-string
1799// OBSOLETE literal, however GNU-chill requires there to be at least one "digit"
1800// OBSOLETE in any bit-string literal. */
1801// OBSOLETE
1802// OBSOLETE static enum ch_terminal
1803// OBSOLETE match_bitstring_literal (void)
1804// OBSOLETE {
1805// OBSOLETE register char *tokptr = lexptr;
1806// OBSOLETE int bitoffset = 0;
1807// OBSOLETE int bitcount = 0;
1808// OBSOLETE int bits_per_char;
1809// OBSOLETE int digit;
1810// OBSOLETE
1811// OBSOLETE tempbufindex = 0;
1812// OBSOLETE CHECKBUF (1);
1813// OBSOLETE tempbuf[0] = 0;
1814// OBSOLETE
1815// OBSOLETE /* Look for the required explicit base specifier. */
1816// OBSOLETE
1817// OBSOLETE switch (*tokptr++)
1818// OBSOLETE {
1819// OBSOLETE case 'b':
1820// OBSOLETE case 'B':
1821// OBSOLETE bits_per_char = 1;
1822// OBSOLETE break;
1823// OBSOLETE case 'o':
1824// OBSOLETE case 'O':
1825// OBSOLETE bits_per_char = 3;
1826// OBSOLETE break;
1827// OBSOLETE case 'h':
1828// OBSOLETE case 'H':
1829// OBSOLETE bits_per_char = 4;
1830// OBSOLETE break;
1831// OBSOLETE default:
1832// OBSOLETE return (0);
1833// OBSOLETE break;
1834// OBSOLETE }
1835// OBSOLETE
1836// OBSOLETE /* Ensure that the character after the explicit base is a single quote. */
1837// OBSOLETE
1838// OBSOLETE if (*tokptr++ != '\'')
1839// OBSOLETE {
1840// OBSOLETE return (0);
1841// OBSOLETE }
1842// OBSOLETE
1843// OBSOLETE while (*tokptr != '\0' && *tokptr != '\'')
1844// OBSOLETE {
1845// OBSOLETE digit = *tokptr;
1846// OBSOLETE if (isupper (digit))
1847// OBSOLETE digit = tolower (digit);
1848// OBSOLETE tokptr++;
1849// OBSOLETE switch (digit)
1850// OBSOLETE {
1851// OBSOLETE case '_':
1852// OBSOLETE continue;
1853// OBSOLETE case '0':
1854// OBSOLETE case '1':
1855// OBSOLETE case '2':
1856// OBSOLETE case '3':
1857// OBSOLETE case '4':
1858// OBSOLETE case '5':
1859// OBSOLETE case '6':
1860// OBSOLETE case '7':
1861// OBSOLETE case '8':
1862// OBSOLETE case '9':
1863// OBSOLETE digit -= '0';
1864// OBSOLETE break;
1865// OBSOLETE case 'a':
1866// OBSOLETE case 'b':
1867// OBSOLETE case 'c':
1868// OBSOLETE case 'd':
1869// OBSOLETE case 'e':
1870// OBSOLETE case 'f':
1871// OBSOLETE digit -= 'a';
1872// OBSOLETE digit += 10;
1873// OBSOLETE break;
1874// OBSOLETE default:
1875// OBSOLETE /* this is not a bitstring literal, probably an integer */
1876// OBSOLETE return 0;
1877// OBSOLETE }
1878// OBSOLETE if (digit >= 1 << bits_per_char)
1879// OBSOLETE {
1880// OBSOLETE /* Found something not in domain for current base. */
1881// OBSOLETE error ("Too-large digit in bitstring or integer.");
1882// OBSOLETE }
1883// OBSOLETE else
1884// OBSOLETE {
1885// OBSOLETE /* Extract bits from digit, packing them into the bitstring byte. */
1886// OBSOLETE int k = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? bits_per_char - 1 : 0;
1887// OBSOLETE for (; TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? k >= 0 : k < bits_per_char;
1888// OBSOLETE TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? k-- : k++)
1889// OBSOLETE {
1890// OBSOLETE bitcount++;
1891// OBSOLETE if (digit & (1 << k))
1892// OBSOLETE {
1893// OBSOLETE tempbuf[tempbufindex] |=
1894// OBSOLETE (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
1895// OBSOLETE ? (1 << (HOST_CHAR_BIT - 1 - bitoffset))
1896// OBSOLETE : (1 << bitoffset);
1897// OBSOLETE }
1898// OBSOLETE bitoffset++;
1899// OBSOLETE if (bitoffset == HOST_CHAR_BIT)
1900// OBSOLETE {
1901// OBSOLETE bitoffset = 0;
1902// OBSOLETE tempbufindex++;
1903// OBSOLETE CHECKBUF (1);
1904// OBSOLETE tempbuf[tempbufindex] = 0;
1905// OBSOLETE }
1906// OBSOLETE }
1907// OBSOLETE }
1908// OBSOLETE }
1909// OBSOLETE
1910// OBSOLETE /* Verify that we consumed everything up to the trailing single quote,
1911// OBSOLETE and that we found some bits (IE not just underbars). */
1912// OBSOLETE
1913// OBSOLETE if (*tokptr++ != '\'')
1914// OBSOLETE {
1915// OBSOLETE return (0);
1916// OBSOLETE }
1917// OBSOLETE else
1918// OBSOLETE {
1919// OBSOLETE yylval.sval.ptr = tempbuf;
1920// OBSOLETE yylval.sval.length = bitcount;
1921// OBSOLETE lexptr = tokptr;
1922// OBSOLETE return (BIT_STRING_LITERAL);
1923// OBSOLETE }
1924// OBSOLETE }
1925// OBSOLETE
1926// OBSOLETE struct token
1927// OBSOLETE {
1928// OBSOLETE char *operator;
1929// OBSOLETE int token;
1930// OBSOLETE };
1931// OBSOLETE
1932// OBSOLETE static const struct token idtokentab[] =
1933// OBSOLETE {
1934// OBSOLETE {"array", ARRAY},
1935// OBSOLETE {"length", LENGTH},
1936// OBSOLETE {"lower", LOWER},
1937// OBSOLETE {"upper", UPPER},
1938// OBSOLETE {"andif", ANDIF},
1939// OBSOLETE {"pred", PRED},
1940// OBSOLETE {"succ", SUCC},
1941// OBSOLETE {"card", CARD},
1942// OBSOLETE {"size", SIZE},
1943// OBSOLETE {"orif", ORIF},
1944// OBSOLETE {"num", NUM},
1945// OBSOLETE {"abs", ABS},
1946// OBSOLETE {"max", MAX_TOKEN},
1947// OBSOLETE {"min", MIN_TOKEN},
1948// OBSOLETE {"mod", MOD},
1949// OBSOLETE {"rem", REM},
1950// OBSOLETE {"not", NOT},
1951// OBSOLETE {"xor", LOGXOR},
1952// OBSOLETE {"and", LOGAND},
1953// OBSOLETE {"in", IN},
1954// OBSOLETE {"or", LOGIOR},
1955// OBSOLETE {"up", UP},
1956// OBSOLETE {"addr", ADDR_TOKEN},
1957// OBSOLETE {"null", EMPTINESS_LITERAL}
1958// OBSOLETE };
1959// OBSOLETE
1960// OBSOLETE static const struct token tokentab2[] =
1961// OBSOLETE {
1962// OBSOLETE {":=", GDB_ASSIGNMENT},
1963// OBSOLETE {"//", SLASH_SLASH},
1964// OBSOLETE {"->", POINTER},
1965// OBSOLETE {"/=", NOTEQUAL},
1966// OBSOLETE {"<=", LEQ},
1967// OBSOLETE {">=", GEQ}
1968// OBSOLETE };
1969// OBSOLETE
1970// OBSOLETE /* Read one token, getting characters through lexptr. */
1971// OBSOLETE /* This is where we will check to make sure that the language and the
1972// OBSOLETE operators used are compatible. */
1973// OBSOLETE
1974// OBSOLETE static enum ch_terminal
1975// OBSOLETE ch_lex (void)
1976// OBSOLETE {
1977// OBSOLETE unsigned int i;
1978// OBSOLETE enum ch_terminal token;
1979// OBSOLETE char *inputname;
1980// OBSOLETE struct symbol *sym;
1981// OBSOLETE
1982// OBSOLETE /* Skip over any leading whitespace. */
1983// OBSOLETE while (isspace (*lexptr))
1984// OBSOLETE {
1985// OBSOLETE lexptr++;
1986// OBSOLETE }
1987// OBSOLETE /* Look for special single character cases which can't be the first
1988// OBSOLETE character of some other multicharacter token. */
1989// OBSOLETE switch (*lexptr)
1990// OBSOLETE {
1991// OBSOLETE case '\0':
1992// OBSOLETE return END_TOKEN;
1993// OBSOLETE case ',':
1994// OBSOLETE case '=':
1995// OBSOLETE case ';':
1996// OBSOLETE case '!':
1997// OBSOLETE case '+':
1998// OBSOLETE case '*':
1999// OBSOLETE case '(':
2000// OBSOLETE case ')':
2001// OBSOLETE case '[':
2002// OBSOLETE case ']':
2003// OBSOLETE return (*lexptr++);
2004// OBSOLETE }
2005// OBSOLETE /* Look for characters which start a particular kind of multicharacter
2006// OBSOLETE token, such as a character literal, register name, convenience
2007// OBSOLETE variable name, string literal, etc. */
2008// OBSOLETE switch (*lexptr)
2009// OBSOLETE {
2010// OBSOLETE case '\'':
2011// OBSOLETE case '\"':
2012// OBSOLETE /* First try to match a string literal, which is any
2013// OBSOLETE sequence of characters enclosed in matching single or double
2014// OBSOLETE quotes, except that a single character inside single quotes
2015// OBSOLETE is a character literal, so we have to catch that case also. */
2016// OBSOLETE token = match_string_literal ();
2017// OBSOLETE if (token != 0)
2018// OBSOLETE {
2019// OBSOLETE return (token);
2020// OBSOLETE }
2021// OBSOLETE if (*lexptr == '\'')
2022// OBSOLETE {
2023// OBSOLETE token = match_character_literal ();
2024// OBSOLETE if (token != 0)
2025// OBSOLETE {
2026// OBSOLETE return (token);
2027// OBSOLETE }
2028// OBSOLETE }
2029// OBSOLETE break;
2030// OBSOLETE case 'C':
2031// OBSOLETE case 'c':
2032// OBSOLETE token = match_character_literal ();
2033// OBSOLETE if (token != 0)
2034// OBSOLETE {
2035// OBSOLETE return (token);
2036// OBSOLETE }
2037// OBSOLETE break;
2038// OBSOLETE case '$':
2039// OBSOLETE yylval.sval.ptr = lexptr;
2040// OBSOLETE do
2041// OBSOLETE {
2042// OBSOLETE lexptr++;
2043// OBSOLETE }
2044// OBSOLETE while (isalnum (*lexptr) || *lexptr == '_' || *lexptr == '$');
2045// OBSOLETE yylval.sval.length = lexptr - yylval.sval.ptr;
2046// OBSOLETE write_dollar_variable (yylval.sval);
2047// OBSOLETE return GDB_VARIABLE;
2048// OBSOLETE break;
2049// OBSOLETE }
2050// OBSOLETE /* See if it is a special token of length 2. */
2051// OBSOLETE for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
2052// OBSOLETE {
2053// OBSOLETE if (STREQN (lexptr, tokentab2[i].operator, 2))
2054// OBSOLETE {
2055// OBSOLETE lexptr += 2;
2056// OBSOLETE return (tokentab2[i].token);
2057// OBSOLETE }
2058// OBSOLETE }
2059// OBSOLETE /* Look for single character cases which which could be the first
2060// OBSOLETE character of some other multicharacter token, but aren't, or we
2061// OBSOLETE would already have found it. */
2062// OBSOLETE switch (*lexptr)
2063// OBSOLETE {
2064// OBSOLETE case '-':
2065// OBSOLETE case ':':
2066// OBSOLETE case '/':
2067// OBSOLETE case '<':
2068// OBSOLETE case '>':
2069// OBSOLETE return (*lexptr++);
2070// OBSOLETE }
2071// OBSOLETE /* Look for a float literal before looking for an integer literal, so
2072// OBSOLETE we match as much of the input stream as possible. */
2073// OBSOLETE token = match_float_literal ();
2074// OBSOLETE if (token != 0)
2075// OBSOLETE {
2076// OBSOLETE return (token);
2077// OBSOLETE }
2078// OBSOLETE token = match_bitstring_literal ();
2079// OBSOLETE if (token != 0)
2080// OBSOLETE {
2081// OBSOLETE return (token);
2082// OBSOLETE }
2083// OBSOLETE token = match_integer_literal ();
2084// OBSOLETE if (token != 0)
2085// OBSOLETE {
2086// OBSOLETE return (token);
2087// OBSOLETE }
2088// OBSOLETE
2089// OBSOLETE /* Try to match a simple name string, and if a match is found, then
2090// OBSOLETE further classify what sort of name it is and return an appropriate
2091// OBSOLETE token. Note that attempting to match a simple name string consumes
2092// OBSOLETE the token from lexptr, so we can't back out if we later find that
2093// OBSOLETE we can't classify what sort of name it is. */
2094// OBSOLETE
2095// OBSOLETE inputname = match_simple_name_string ();
2096// OBSOLETE
2097// OBSOLETE if (inputname != NULL)
2098// OBSOLETE {
2099// OBSOLETE char *simplename = (char *) alloca (strlen (inputname) + 1);
2100// OBSOLETE
2101// OBSOLETE char *dptr = simplename, *sptr = inputname;
2102// OBSOLETE for (; *sptr; sptr++)
2103// OBSOLETE *dptr++ = isupper (*sptr) ? tolower (*sptr) : *sptr;
2104// OBSOLETE *dptr = '\0';
2105// OBSOLETE
2106// OBSOLETE /* See if it is a reserved identifier. */
2107// OBSOLETE for (i = 0; i < sizeof (idtokentab) / sizeof (idtokentab[0]); i++)
2108// OBSOLETE {
2109// OBSOLETE if (STREQ (simplename, idtokentab[i].operator))
2110// OBSOLETE {
2111// OBSOLETE return (idtokentab[i].token);
2112// OBSOLETE }
2113// OBSOLETE }
2114// OBSOLETE
2115// OBSOLETE /* Look for other special tokens. */
2116// OBSOLETE if (STREQ (simplename, "true"))
2117// OBSOLETE {
2118// OBSOLETE yylval.ulval = 1;
2119// OBSOLETE return (BOOLEAN_LITERAL);
2120// OBSOLETE }
2121// OBSOLETE if (STREQ (simplename, "false"))
2122// OBSOLETE {
2123// OBSOLETE yylval.ulval = 0;
2124// OBSOLETE return (BOOLEAN_LITERAL);
2125// OBSOLETE }
2126// OBSOLETE
2127// OBSOLETE sym = lookup_symbol (inputname, expression_context_block,
2128// OBSOLETE VAR_NAMESPACE, (int *) NULL,
2129// OBSOLETE (struct symtab **) NULL);
2130// OBSOLETE if (sym == NULL && strcmp (inputname, simplename) != 0)
2131// OBSOLETE {
2132// OBSOLETE sym = lookup_symbol (simplename, expression_context_block,
2133// OBSOLETE VAR_NAMESPACE, (int *) NULL,
2134// OBSOLETE (struct symtab **) NULL);
2135// OBSOLETE }
2136// OBSOLETE if (sym != NULL)
2137// OBSOLETE {
2138// OBSOLETE yylval.ssym.stoken.ptr = NULL;
2139// OBSOLETE yylval.ssym.stoken.length = 0;
2140// OBSOLETE yylval.ssym.sym = sym;
2141// OBSOLETE yylval.ssym.is_a_field_of_this = 0; /* FIXME, C++'ism */
2142// OBSOLETE switch (SYMBOL_CLASS (sym))
2143// OBSOLETE {
2144// OBSOLETE case LOC_BLOCK:
2145// OBSOLETE /* Found a procedure name. */
2146// OBSOLETE return (GENERAL_PROCEDURE_NAME);
2147// OBSOLETE case LOC_STATIC:
2148// OBSOLETE /* Found a global or local static variable. */
2149// OBSOLETE return (LOCATION_NAME);
2150// OBSOLETE case LOC_REGISTER:
2151// OBSOLETE case LOC_ARG:
2152// OBSOLETE case LOC_REF_ARG:
2153// OBSOLETE case LOC_REGPARM:
2154// OBSOLETE case LOC_REGPARM_ADDR:
2155// OBSOLETE case LOC_LOCAL:
2156// OBSOLETE case LOC_LOCAL_ARG:
2157// OBSOLETE case LOC_BASEREG:
2158// OBSOLETE case LOC_BASEREG_ARG:
2159// OBSOLETE if (innermost_block == NULL
2160// OBSOLETE || contained_in (block_found, innermost_block))
2161// OBSOLETE {
2162// OBSOLETE innermost_block = block_found;
2163// OBSOLETE }
2164// OBSOLETE return (LOCATION_NAME);
2165// OBSOLETE break;
2166// OBSOLETE case LOC_CONST:
2167// OBSOLETE case LOC_LABEL:
2168// OBSOLETE return (LOCATION_NAME);
2169// OBSOLETE break;
2170// OBSOLETE case LOC_TYPEDEF:
2171// OBSOLETE yylval.tsym.type = SYMBOL_TYPE (sym);
2172// OBSOLETE return TYPENAME;
2173// OBSOLETE case LOC_UNDEF:
2174// OBSOLETE case LOC_CONST_BYTES:
2175// OBSOLETE case LOC_OPTIMIZED_OUT:
2176// OBSOLETE error ("Symbol \"%s\" names no location.", inputname);
2177// OBSOLETE break;
2178// OBSOLETE default:
2179// OBSOLETE internal_error (__FILE__, __LINE__,
2180// OBSOLETE "unhandled SYMBOL_CLASS in ch_lex()");
2181// OBSOLETE break;
2182// OBSOLETE }
2183// OBSOLETE }
2184// OBSOLETE else if (!have_full_symbols () && !have_partial_symbols ())
2185// OBSOLETE {
2186// OBSOLETE error ("No symbol table is loaded. Use the \"file\" command.");
2187// OBSOLETE }
2188// OBSOLETE else
2189// OBSOLETE {
2190// OBSOLETE error ("No symbol \"%s\" in current context.", inputname);
2191// OBSOLETE }
2192// OBSOLETE }
2193// OBSOLETE
2194// OBSOLETE /* Catch single character tokens which are not part of some
2195// OBSOLETE longer token. */
2196// OBSOLETE
2197// OBSOLETE switch (*lexptr)
2198// OBSOLETE {
2199// OBSOLETE case '.': /* Not float for example. */
2200// OBSOLETE lexptr++;
2201// OBSOLETE while (isspace (*lexptr))
2202// OBSOLETE lexptr++;
2203// OBSOLETE inputname = match_simple_name_string ();
2204// OBSOLETE if (!inputname)
2205// OBSOLETE return '.';
2206// OBSOLETE return DOT_FIELD_NAME;
2207// OBSOLETE }
2208// OBSOLETE
2209// OBSOLETE return (ILLEGAL_TOKEN);
2210// OBSOLETE }
2211// OBSOLETE
2212// OBSOLETE static void
2213// OBSOLETE write_lower_upper_value (enum exp_opcode opcode, /* Either UNOP_LOWER or UNOP_UPPER */
2214// OBSOLETE struct type *type)
2215// OBSOLETE {
2216// OBSOLETE if (type == NULL)
2217// OBSOLETE write_exp_elt_opcode (opcode);
2218// OBSOLETE else
2219// OBSOLETE {
2220// OBSOLETE struct type *result_type;
2221// OBSOLETE LONGEST val = type_lower_upper (opcode, type, &result_type);
2222// OBSOLETE write_exp_elt_opcode (OP_LONG);
2223// OBSOLETE write_exp_elt_type (result_type);
2224// OBSOLETE write_exp_elt_longcst (val);
2225// OBSOLETE write_exp_elt_opcode (OP_LONG);
2226// OBSOLETE }
2227// OBSOLETE }
2228// OBSOLETE
2229// OBSOLETE void
2230// OBSOLETE chill_error (char *msg)
2231// OBSOLETE {
2232// OBSOLETE /* Never used. */
2233// OBSOLETE }
This page took 0.360918 seconds and 4 git commands to generate.