Move comma_terminates global to parser_state

This moves the comma_terminates global to parser_state.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* rust-exp.y (rustyylex, rust_lex_tests): Update.
	* parser-defs.h (struct parser_state) <parser_state>: Add new
	parameter.
	<comma_terminates>: New member.
	(comma_terminates): Don't declare global.
	* parse.c (comma_terminates): Remove global.
	(parse_exp_in_context): Update.
	* p-exp.y (yylex): Update.
	* m2-exp.y (yylex): Update.
	* go-exp.y (lex_one_token): Update.
	* f-exp.y (yylex): Update.
	* d-exp.y (lex_one_token): Update.
	* c-exp.y (lex_one_token): Update.
	* ada-lex.l: Update.
This commit is contained in:
Tom Tromey
2019-03-24 18:07:00 -06:00
parent 28aaf3fdf9
commit 8621b685bf
11 changed files with 36 additions and 19 deletions

View File

@@ -88,10 +88,12 @@ struct parser_state : public expr_builder
parser_state (const struct language_defn *lang,
struct gdbarch *gdbarch,
const struct block *context_block,
CORE_ADDR context_pc)
CORE_ADDR context_pc,
int comma)
: expr_builder (lang, gdbarch),
expression_context_block (context_block),
expression_context_pc (context_pc)
expression_context_pc (context_pc),
comma_terminates (comma)
{
}
@@ -108,6 +110,10 @@ struct parser_state : public expr_builder
at, and then look up the macro definitions active at that
point. */
const CORE_ADDR expression_context_pc;
/* Nonzero means stop parsing on first comma (if not within parentheses). */
int comma_terminates;
};
/* When parsing expressions we track the innermost block that was
@@ -355,10 +361,6 @@ extern const char *lexptr;
/* After a token has been recognized, this variable points to it.
Currently used only for error reporting. */
extern const char *prev_lexptr;
/* Nonzero means stop parsing on first comma (if not within parentheses). */
extern int comma_terminates;
/* These codes indicate operator precedences for expression printing,
least tightly binding first. */