1 /* YACC grammar for Modula-2 expressions, for GDB.
2 Copyright (C) 1986-2016 Free Software Foundation, Inc.
3 Generated from expread.y (now c-exp.y) and contributed by the Department
4 of Computer Science at the State University of New York at Buffalo, 1991.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 /* Parse a Modula-2 expression from text in a string,
22 and return the result as a struct expression pointer.
23 That structure contains arithmetic operations in reverse polish,
24 with constants represented by operations that are followed by special data.
25 See expression.h for the details of the format.
26 What is important here is that it can be built up sequentially
27 during the process of parsing; the lower levels of the tree always
28 come first in the result.
30 Note that malloc's and realloc's in this file are transformed to
31 xmalloc and xrealloc respectively by the same sed command in the
32 makefile that remaps any other malloc/realloc inserted by the parser
33 generator. Doing this with #defines and trying to control the interaction
34 with include files (<malloc.h> and <stdlib.h> for example) just became
35 too messy, particularly when such includes can be inserted at random
36 times by the parser generator. */
41 #include "expression.h"
44 #include "parser-defs.h"
46 #include "bfd.h" /* Required by objfiles.h. */
47 #include "symfile.h" /* Required by objfiles.h. */
48 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
51 #define parse_type(ps) builtin_type (parse_gdbarch (ps))
52 #define parse_m2_type(ps) builtin_m2_type (parse_gdbarch (ps))
54 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
55 as well as gratuitiously global symbol names, so we can have multiple
56 yacc generated parsers in gdb. Note that these are only the variables
57 produced by yacc. If other parser generators (bison, byacc, etc) produce
58 additional global names that conflict at link time, then those parser
59 generators need to be fixed instead of adding those names to this list. */
61 #define yymaxdepth m2_maxdepth
62 #define yyparse m2_parse_internal
64 #define yyerror m2_error
65 #define yylval m2_lval
66 #define yychar m2_char
67 #define yydebug m2_debug
68 #define yypact m2_pact
75 #define yyexca m2_exca
76 #define yyerrflag m2_errflag
77 #define yynerrs m2_nerrs
82 #define yystate m2_state
87 #define yylloc m2_lloc
88 #define yyreds m2_reds /* With YYDEBUG defined */
89 #define yytoks m2_toks /* With YYDEBUG defined */
90 #define yyname m2_name /* With YYDEBUG defined */
91 #define yyrule m2_rule /* With YYDEBUG defined */
92 #define yylhs m2_yylhs
93 #define yylen m2_yylen
94 #define yydefred m2_yydefred
95 #define yydgoto m2_yydgoto
96 #define yysindex m2_yysindex
97 #define yyrindex m2_yyrindex
98 #define yygindex m2_yygindex
99 #define yytable m2_yytable
100 #define yycheck m2_yycheck
102 #define yysslim m2_yysslim
103 #define yyssp m2_yyssp
104 #define yystacksize m2_yystacksize
106 #define yyvsp m2_yyvsp
109 #define YYDEBUG 1 /* Default to yydebug support */
112 #define YYFPRINTF parser_fprintf
114 /* The state of the parser, used internally when we are parsing the
117 static struct parser_state *pstate = NULL;
121 static int yylex (void);
123 void yyerror (char *);
125 static int parse_number (int);
127 /* The sign of the number being parsed. */
128 static int number_sign = 1;
132 /* Although the yacc "value" of an expression is not used,
133 since the result is stored in the structure being created,
134 other node types do have values. */
145 const struct block *bval;
146 enum exp_opcode opcode;
147 struct internalvar *ivar;
153 %type <voidval> exp type_exp start set
154 %type <voidval> variable
159 %token <lval> INT HEX ERROR
160 %token <ulval> UINT M2_TRUE M2_FALSE CHAR
163 /* Both NAME and TYPENAME tokens represent symbols in the input,
164 and both convey their data as strings.
165 But a TYPENAME is a string that happens to be defined as a typedef
166 or builtin type name (such as int or char)
167 and a NAME is any other symbol.
169 Contexts where this distinction is not important can use the
170 nonterminal "name", which matches either NAME or TYPENAME. */
173 %token <sval> NAME BLOCKNAME IDENT VARNAME
174 %token <sval> TYPENAME
176 %token SIZE CAP ORD HIGH ABS MIN_FUNC MAX_FUNC FLOAT_FUNC VAL CHR ODD TRUNC
178 %token INC DEC INCL EXCL
180 /* The GDB scope operator */
183 %token <voidval> INTERNAL_VAR
189 %left '<' '>' LEQ GEQ '=' NOTEQUAL '#' IN
191 %left LOGICAL_AND '&'
194 %left '*' '/' DIV MOD
196 %right '^' DOT '[' '('
199 /* This is not an actual token ; it is used for precedence.
211 { write_exp_elt_opcode (pstate, OP_TYPE);
212 write_exp_elt_type (pstate, $1);
213 write_exp_elt_opcode (pstate, OP_TYPE);
219 exp : exp '^' %prec UNARY
220 { write_exp_elt_opcode (pstate, UNOP_IND); }
224 { number_sign = -1; }
227 write_exp_elt_opcode (pstate, UNOP_NEG); }
230 exp : '+' exp %prec UNARY
231 { write_exp_elt_opcode (pstate, UNOP_PLUS); }
234 exp : not_exp exp %prec UNARY
235 { write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); }
242 exp : CAP '(' exp ')'
243 { write_exp_elt_opcode (pstate, UNOP_CAP); }
246 exp : ORD '(' exp ')'
247 { write_exp_elt_opcode (pstate, UNOP_ORD); }
250 exp : ABS '(' exp ')'
251 { write_exp_elt_opcode (pstate, UNOP_ABS); }
254 exp : HIGH '(' exp ')'
255 { write_exp_elt_opcode (pstate, UNOP_HIGH); }
258 exp : MIN_FUNC '(' type ')'
259 { write_exp_elt_opcode (pstate, UNOP_MIN);
260 write_exp_elt_type (pstate, $3);
261 write_exp_elt_opcode (pstate, UNOP_MIN); }
264 exp : MAX_FUNC '(' type ')'
265 { write_exp_elt_opcode (pstate, UNOP_MAX);
266 write_exp_elt_type (pstate, $3);
267 write_exp_elt_opcode (pstate, UNOP_MAX); }
270 exp : FLOAT_FUNC '(' exp ')'
271 { write_exp_elt_opcode (pstate, UNOP_FLOAT); }
274 exp : VAL '(' type ',' exp ')'
275 { write_exp_elt_opcode (pstate, BINOP_VAL);
276 write_exp_elt_type (pstate, $3);
277 write_exp_elt_opcode (pstate, BINOP_VAL); }
280 exp : CHR '(' exp ')'
281 { write_exp_elt_opcode (pstate, UNOP_CHR); }
284 exp : ODD '(' exp ')'
285 { write_exp_elt_opcode (pstate, UNOP_ODD); }
288 exp : TRUNC '(' exp ')'
289 { write_exp_elt_opcode (pstate, UNOP_TRUNC); }
292 exp : TSIZE '(' exp ')'
293 { write_exp_elt_opcode (pstate, UNOP_SIZEOF); }
296 exp : SIZE exp %prec UNARY
297 { write_exp_elt_opcode (pstate, UNOP_SIZEOF); }
301 exp : INC '(' exp ')'
302 { write_exp_elt_opcode (pstate, UNOP_PREINCREMENT); }
305 exp : INC '(' exp ',' exp ')'
306 { write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY);
307 write_exp_elt_opcode (pstate, BINOP_ADD);
308 write_exp_elt_opcode (pstate,
309 BINOP_ASSIGN_MODIFY); }
312 exp : DEC '(' exp ')'
313 { write_exp_elt_opcode (pstate, UNOP_PREDECREMENT);}
316 exp : DEC '(' exp ',' exp ')'
317 { write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY);
318 write_exp_elt_opcode (pstate, BINOP_SUB);
319 write_exp_elt_opcode (pstate,
320 BINOP_ASSIGN_MODIFY); }
324 { write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
325 write_exp_string (pstate, $3);
326 write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
333 { error (_("Sets are not implemented."));}
336 exp : INCL '(' exp ',' exp ')'
337 { error (_("Sets are not implemented."));}
340 exp : EXCL '(' exp ',' exp ')'
341 { error (_("Sets are not implemented."));}
344 set : '{' arglist '}'
345 { error (_("Sets are not implemented."));}
346 | type '{' arglist '}'
347 { error (_("Sets are not implemented."));}
351 /* Modula-2 array subscript notation [a,b,c...] */
353 /* This function just saves the number of arguments
354 that follow in the list. It is *not* specific to
357 non_empty_arglist ']' %prec DOT
358 { write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT);
359 write_exp_elt_longcst (pstate,
360 (LONGEST) end_arglist());
361 write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT); }
364 exp : exp '[' exp ']'
365 { write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); }
369 /* This is to save the value of arglist_len
370 being accumulated by an outer function call. */
371 { start_arglist (); }
372 arglist ')' %prec DOT
373 { write_exp_elt_opcode (pstate, OP_FUNCALL);
374 write_exp_elt_longcst (pstate,
375 (LONGEST) end_arglist ());
376 write_exp_elt_opcode (pstate, OP_FUNCALL); }
386 arglist : arglist ',' exp %prec ABOVE_COMMA
396 : non_empty_arglist ',' exp %prec ABOVE_COMMA
401 exp : '{' type '}' exp %prec UNARY
402 { write_exp_elt_opcode (pstate, UNOP_MEMVAL);
403 write_exp_elt_type (pstate, $2);
404 write_exp_elt_opcode (pstate, UNOP_MEMVAL); }
407 exp : type '(' exp ')' %prec UNARY
408 { write_exp_elt_opcode (pstate, UNOP_CAST);
409 write_exp_elt_type (pstate, $1);
410 write_exp_elt_opcode (pstate, UNOP_CAST); }
417 /* Binary operators in order of decreasing precedence. Note that some
418 of these operators are overloaded! (ie. sets) */
422 { write_exp_elt_opcode (pstate, BINOP_REPEAT); }
426 { write_exp_elt_opcode (pstate, BINOP_MUL); }
430 { write_exp_elt_opcode (pstate, BINOP_DIV); }
434 { write_exp_elt_opcode (pstate, BINOP_INTDIV); }
438 { write_exp_elt_opcode (pstate, BINOP_REM); }
442 { write_exp_elt_opcode (pstate, BINOP_ADD); }
446 { write_exp_elt_opcode (pstate, BINOP_SUB); }
450 { write_exp_elt_opcode (pstate, BINOP_EQUAL); }
453 exp : exp NOTEQUAL exp
454 { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); }
456 { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); }
460 { write_exp_elt_opcode (pstate, BINOP_LEQ); }
464 { write_exp_elt_opcode (pstate, BINOP_GEQ); }
468 { write_exp_elt_opcode (pstate, BINOP_LESS); }
472 { write_exp_elt_opcode (pstate, BINOP_GTR); }
475 exp : exp LOGICAL_AND exp
476 { write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); }
480 { write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); }
484 { write_exp_elt_opcode (pstate, BINOP_ASSIGN); }
491 { write_exp_elt_opcode (pstate, OP_BOOL);
492 write_exp_elt_longcst (pstate, (LONGEST) $1);
493 write_exp_elt_opcode (pstate, OP_BOOL); }
497 { write_exp_elt_opcode (pstate, OP_BOOL);
498 write_exp_elt_longcst (pstate, (LONGEST) $1);
499 write_exp_elt_opcode (pstate, OP_BOOL); }
503 { write_exp_elt_opcode (pstate, OP_LONG);
504 write_exp_elt_type (pstate,
505 parse_m2_type (pstate)->builtin_int);
506 write_exp_elt_longcst (pstate, (LONGEST) $1);
507 write_exp_elt_opcode (pstate, OP_LONG); }
512 write_exp_elt_opcode (pstate, OP_LONG);
513 write_exp_elt_type (pstate,
514 parse_m2_type (pstate)
516 write_exp_elt_longcst (pstate, (LONGEST) $1);
517 write_exp_elt_opcode (pstate, OP_LONG);
522 { write_exp_elt_opcode (pstate, OP_LONG);
523 write_exp_elt_type (pstate,
524 parse_m2_type (pstate)
526 write_exp_elt_longcst (pstate, (LONGEST) $1);
527 write_exp_elt_opcode (pstate, OP_LONG); }
532 { write_exp_elt_opcode (pstate, OP_DOUBLE);
533 write_exp_elt_type (pstate,
534 parse_m2_type (pstate)
536 write_exp_elt_dblcst (pstate, $1);
537 write_exp_elt_opcode (pstate, OP_DOUBLE); }
543 exp : SIZE '(' type ')' %prec UNARY
544 { write_exp_elt_opcode (pstate, OP_LONG);
545 write_exp_elt_type (pstate,
546 parse_type (pstate)->builtin_int);
547 write_exp_elt_longcst (pstate,
548 (LONGEST) TYPE_LENGTH ($3));
549 write_exp_elt_opcode (pstate, OP_LONG); }
553 { write_exp_elt_opcode (pstate, OP_M2_STRING);
554 write_exp_string (pstate, $1);
555 write_exp_elt_opcode (pstate, OP_M2_STRING); }
558 /* This will be used for extensions later. Like adding modules. */
560 { $$ = SYMBOL_BLOCK_VALUE($1); }
565 = lookup_symbol (copy_name ($1),
566 expression_context_block,
567 VAR_DOMAIN, 0).symbol;
572 /* GDB scope operator */
573 fblock : block COLONCOLON BLOCKNAME
575 = lookup_symbol (copy_name ($3), $1,
576 VAR_DOMAIN, 0).symbol;
577 if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
578 error (_("No function \"%s\" in specified context."),
584 /* Useful for assigning to PROCEDURE variables */
586 { write_exp_elt_opcode (pstate, OP_VAR_VALUE);
587 write_exp_elt_block (pstate, NULL);
588 write_exp_elt_sym (pstate, $1);
589 write_exp_elt_opcode (pstate, OP_VAR_VALUE); }
592 /* GDB internal ($foo) variable */
593 variable: INTERNAL_VAR
596 /* GDB scope operator */
597 variable: block COLONCOLON NAME
598 { struct block_symbol sym
599 = lookup_symbol (copy_name ($3), $1,
603 error (_("No symbol \"%s\" in specified context."),
605 if (symbol_read_needs_frame (sym.symbol))
607 if (innermost_block == 0
608 || contained_in (sym.block,
610 innermost_block = sym.block;
613 write_exp_elt_opcode (pstate, OP_VAR_VALUE);
614 write_exp_elt_block (pstate, sym.block);
615 write_exp_elt_sym (pstate, sym.symbol);
616 write_exp_elt_opcode (pstate, OP_VAR_VALUE); }
619 /* Base case for variables. */
621 { struct block_symbol sym;
622 struct field_of_this_result is_a_field_of_this;
624 sym = lookup_symbol (copy_name ($1),
625 expression_context_block,
627 &is_a_field_of_this);
631 if (symbol_read_needs_frame (sym.symbol))
633 if (innermost_block == 0 ||
634 contained_in (sym.block,
636 innermost_block = sym.block;
639 write_exp_elt_opcode (pstate, OP_VAR_VALUE);
640 write_exp_elt_block (pstate, sym.block);
641 write_exp_elt_sym (pstate, sym.symbol);
642 write_exp_elt_opcode (pstate, OP_VAR_VALUE);
646 struct bound_minimal_symbol msymbol;
647 char *arg = copy_name ($1);
650 lookup_bound_minimal_symbol (arg);
651 if (msymbol.minsym != NULL)
652 write_exp_msymbol (pstate, msymbol);
653 else if (!have_full_symbols () && !have_partial_symbols ())
654 error (_("No symbol table is loaded. Use the \"symbol-file\" command."));
656 error (_("No symbol \"%s\" in current context."),
664 { $$ = lookup_typename (parse_language (pstate),
665 parse_gdbarch (pstate),
667 expression_context_block, 0); }
673 /* Take care of parsing a number (anything that starts with a digit).
674 Set yylval and return the token type; update lexptr.
675 LEN is the number of characters in it. */
677 /*** Needs some error checking for the float case ***/
680 parse_number (int olen)
682 const char *p = lexptr;
686 int base = input_radix;
688 int unsigned_p = number_sign == 1 ? 1 : 0;
695 else if(p[len-1] == 'C' || p[len-1] == 'B')
698 ischar = p[len-1] == 'C';
702 /* Scan the number */
703 for (c = 0; c < len; c++)
705 if (p[c] == '.' && base == 10)
707 /* It's a float since it contains a point. */
708 yylval.dval = atof (p);
712 if (p[c] == '.' && base != 10)
713 error (_("Floating point numbers must be base 10."));
714 if (base == 10 && (p[c] < '0' || p[c] > '9'))
715 error (_("Invalid digit \'%c\' in number."),p[c]);
722 if( base == 8 && (c == '8' || c == '9'))
723 error (_("Invalid digit \'%c\' in octal number."),c);
724 if (c >= '0' && c <= '9')
728 if (base == 16 && c >= 'A' && c <= 'F')
736 if(!unsigned_p && number_sign == 1 && (prevn >= n))
737 unsigned_p=1; /* Try something unsigned */
738 /* Don't do the range check if n==i and i==0, since that special
739 case will give an overflow error. */
740 if(RANGE_CHECK && n!=i && i)
742 if((unsigned_p && (unsigned)prevn >= (unsigned)n) ||
743 ((!unsigned_p && number_sign==-1) && -prevn <= -n))
744 range_error (_("Overflow on numeric constant."));
750 if(*p == 'B' || *p == 'C' || *p == 'H')
751 lexptr++; /* Advance past B,C or H */
758 else if ( unsigned_p && number_sign == 1)
763 else if((unsigned_p && (n<0))) {
764 range_error (_("Overflow on numeric constant -- number too large."));
765 /* But, this can return if range_check == range_warn. */
780 { {'<', '>'}, NOTEQUAL },
781 { {':', '='}, ASSIGN },
784 { {':', ':'}, COLONCOLON },
788 /* Some specific keywords */
795 static struct keyword keytab[] =
798 {"IN", IN },/* Note space after IN */
799 {"AND", LOGICAL_AND},
817 {"FLOAT", FLOAT_FUNC },
823 /* Read one token, getting characters through lexptr. */
825 /* This is where we will check to make sure that the language and the
826 operators used are compatible */
834 const char *tokstart;
839 prev_lexptr = lexptr;
844 /* See if it is a special token of length 2 */
845 for( i = 0 ; i < (int) (sizeof tokentab2 / sizeof tokentab2[0]) ; i++)
846 if (strncmp (tokentab2[i].name, tokstart, 2) == 0)
849 return tokentab2[i].token;
852 switch (c = *tokstart)
869 if (paren_depth == 0)
876 if (comma_terminates && paren_depth == 0)
882 /* Might be a floating point number. */
883 if (lexptr[1] >= '0' && lexptr[1] <= '9')
884 break; /* Falls into number code. */
891 /* These are character tokens that appear as-is in the YACC grammar */
914 for (namelen = 1; (c = tokstart[namelen]) != quote && c != '\0'; namelen++)
917 c = tokstart[++namelen];
918 if (c >= '0' && c <= '9')
920 c = tokstart[++namelen];
921 if (c >= '0' && c <= '9')
922 c = tokstart[++namelen];
926 error (_("Unterminated string or character constant."));
927 yylval.sval.ptr = tokstart + 1;
928 yylval.sval.length = namelen - 1;
929 lexptr += namelen + 1;
931 if(namelen == 2) /* Single character */
933 yylval.ulval = tokstart[1];
940 /* Is it a number? */
941 /* Note: We have already dealt with the case of the token '.'.
942 See case '.' above. */
943 if ((c >= '0' && c <= '9'))
946 int got_dot = 0, got_e = 0;
947 const char *p = tokstart;
952 if (!got_e && (*p == 'e' || *p == 'E'))
954 else if (!got_dot && *p == '.')
956 else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
957 && (*p == '-' || *p == '+'))
958 /* This is the sign of the exponent, not the end of the
961 else if ((*p < '0' || *p > '9') &&
962 (*p < 'A' || *p > 'F') &&
963 (*p != 'H')) /* Modula-2 hexadecimal number */
966 toktype = parse_number (p - tokstart);
967 if (toktype == ERROR)
969 char *err_copy = (char *) alloca (p - tokstart + 1);
971 memcpy (err_copy, tokstart, p - tokstart);
972 err_copy[p - tokstart] = 0;
973 error (_("Invalid number \"%s\"."), err_copy);
979 if (!(c == '_' || c == '$'
980 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
981 /* We must have come across a bad character (e.g. ';'). */
982 error (_("Invalid character '%c' in expression."), c);
984 /* It's a name. See how long it is. */
986 for (c = tokstart[namelen];
987 (c == '_' || c == '$' || (c >= '0' && c <= '9')
988 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
989 c = tokstart[++namelen])
992 /* The token "if" terminates the expression and is NOT
993 removed from the input stream. */
994 if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
1001 /* Lookup special keywords */
1002 for(i = 0 ; i < (int) (sizeof(keytab) / sizeof(keytab[0])) ; i++)
1003 if (namelen == strlen (keytab[i].keyw)
1004 && strncmp (tokstart, keytab[i].keyw, namelen) == 0)
1005 return keytab[i].token;
1007 yylval.sval.ptr = tokstart;
1008 yylval.sval.length = namelen;
1010 if (*tokstart == '$')
1012 write_dollar_variable (pstate, yylval.sval);
1013 return INTERNAL_VAR;
1016 /* Use token-type BLOCKNAME for symbols that happen to be defined as
1017 functions. If this is not so, then ...
1018 Use token-type TYPENAME for symbols that happen to be defined
1019 currently as names of types; NAME for other symbols.
1020 The caller is not constrained to care about the distinction. */
1024 char *tmp = copy_name (yylval.sval);
1027 if (lookup_symtab (tmp))
1029 sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, 0).symbol;
1030 if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
1032 if (lookup_typename (parse_language (pstate), parse_gdbarch (pstate),
1033 copy_name (yylval.sval),
1034 expression_context_block, 1))
1039 switch(SYMBOL_CLASS (sym))
1045 case LOC_REGPARM_ADDR:
1048 case LOC_CONST_BYTES:
1049 case LOC_OPTIMIZED_OUT:
1060 error (_("internal: Undefined class in m2lex()"));
1063 case LOC_UNRESOLVED:
1064 error (_("internal: Unforseen case in m2lex()"));
1067 error (_("unhandled token in m2lex()"));
1073 /* Built-in BOOLEAN type. This is sort of a hack. */
1074 if (strncmp (tokstart, "TRUE", 4) == 0)
1079 else if (strncmp (tokstart, "FALSE", 5) == 0)
1086 /* Must be another type of name... */
1092 m2_parse (struct parser_state *par_state)
1095 struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
1097 /* Setting up the parser state. */
1098 gdb_assert (par_state != NULL);
1101 result = yyparse ();
1111 lexptr = prev_lexptr;
1113 error (_("A %s in expression, near `%s'."), (msg ? msg : "error"), lexptr);