mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 16:53:02 +00:00
grammar: record the kind of %define variable values
Provide a means to tell the difference between "keyword" values (e.g.,
%define api.pull both), "string" values (e.g., %define file.name
"foo"), and "code" values (e.g., %define api.namespace {calc}).
Suggested by Joel E. Denny.
http://lists.gnu.org/archive/html/bison-patches/2013-03/msg00016.html
* src/muscle-tab.h, src/muscle-tab.c (muscle_kind, muscle_kind_new)
(muscle_kind_string): New.
(muscle_percent_define_insert): Take the kind as new argument.
Insert it in the muscle table.
Adjust callers.
* src/getargs.c: Adjust callers.
* src/parse-gram.y: Ditto.
(content.opt): Remove, replaced by...
(value): this new non-terminal, whose semantics value is stored
in the new "value" union member.
Provide a printer.
Support values in braces in additions to keyword and string values.
fuse me
This commit is contained in:
@@ -24,12 +24,29 @@
|
||||
|
||||
# include "location.h"
|
||||
|
||||
/* The kind of value associated to this muscle, depending on the
|
||||
syntax of the value: keyword (no delimiter, e.g., true), string
|
||||
(double quotes, e.g., "foo.h"), or code (braces, e.g., {int}). */
|
||||
typedef enum
|
||||
{
|
||||
muscle_code,
|
||||
muscle_keyword,
|
||||
muscle_string
|
||||
} muscle_kind;
|
||||
|
||||
/* Conversion from string. */
|
||||
muscle_kind muscle_kind_new (char const *k);
|
||||
|
||||
/* Conversion to string. */
|
||||
char const *muscle_kind_string (muscle_kind k);
|
||||
|
||||
|
||||
/* Create the MUSCLE_TABLE, and initialize it with default values.
|
||||
Also set up the MUSCLE_OBSTACK. */
|
||||
void muscle_init (void);
|
||||
|
||||
/* Insert (KEY, VALUE). If KEY already existed, overwrite the
|
||||
previous value. */
|
||||
previous value. Otherwise create as a muscle_string type. */
|
||||
void muscle_insert (char const *key, char const *value);
|
||||
|
||||
/* Find the value of muscle KEY. Unlike MUSCLE_FIND, this is always
|
||||
@@ -124,6 +141,7 @@ typedef enum {
|
||||
this as a user occurrence of VARIABLE by invoking
|
||||
muscle_user_name_list_grow. */
|
||||
void muscle_percent_define_insert (char const *variable, location variable_loc,
|
||||
muscle_kind kind,
|
||||
char const *value,
|
||||
muscle_percent_define_how how);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user