mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 15:23:02 +00:00
(<chars>): Renamed from <string>.
This commit is contained in:
@@ -30,15 +30,16 @@
|
|||||||
|
|
||||||
%{
|
%{
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
#include "complain.h"
|
#include "complain.h"
|
||||||
#include "muscle_tab.h"
|
#include "conflicts.h"
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
#include "getargs.h"
|
#include "getargs.h"
|
||||||
#include "output.h"
|
|
||||||
#include "symlist.h"
|
|
||||||
#include "gram.h"
|
#include "gram.h"
|
||||||
|
#include "muscle_tab.h"
|
||||||
|
#include "output.h"
|
||||||
#include "reader.h"
|
#include "reader.h"
|
||||||
#include "conflicts.h"
|
#include "symlist.h"
|
||||||
|
|
||||||
/* Produce verbose syntax errors. */
|
/* Produce verbose syntax errors. */
|
||||||
#define YYERROR_VERBOSE 1
|
#define YYERROR_VERBOSE 1
|
||||||
@@ -51,33 +52,33 @@ static YYLTYPE lloc_default (YYLTYPE const *, int);
|
|||||||
#undef yyerror
|
#undef yyerror
|
||||||
#define yyerror(Msg) \
|
#define yyerror(Msg) \
|
||||||
gram_error (&yylloc, Msg)
|
gram_error (&yylloc, Msg)
|
||||||
static void gram_error (location_t const *, char const *);
|
static void gram_error (location const *, char const *);
|
||||||
|
|
||||||
#define YYPRINT(File, Type, Value) \
|
#define YYPRINT(File, Type, Value) \
|
||||||
print_token_value (File, Type, &Value)
|
print_token_value (File, Type, &Value)
|
||||||
static void print_token_value (FILE *, int, YYSTYPE const *);
|
static void print_token_value (FILE *, int, YYSTYPE const *);
|
||||||
|
|
||||||
static void add_param (char const *, char const *, location_t);
|
static void add_param (char const *, char const *, location);
|
||||||
|
|
||||||
symbol_class current_class = unknown_sym;
|
symbol_class current_class = unknown_sym;
|
||||||
struniq_t current_type = 0;
|
uniqstr current_type = 0;
|
||||||
symbol_t *current_lhs;
|
symbol *current_lhs;
|
||||||
location_t current_lhs_location;
|
location current_lhs_location;
|
||||||
assoc_t current_assoc;
|
assoc current_assoc;
|
||||||
int current_prec = 0;
|
int current_prec = 0;
|
||||||
braced_code_t current_braced_code = action_braced_code;
|
braced_code current_braced_code = action_braced_code;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
/* Only NUMBERS have a value. */
|
/* Only NUMBERS have a value. */
|
||||||
%union
|
%union
|
||||||
{
|
{
|
||||||
symbol_t *symbol;
|
symbol *symbol;
|
||||||
symbol_list_t *list;
|
symbol_list *list;
|
||||||
int integer;
|
int integer;
|
||||||
char *string;
|
char *chars;
|
||||||
assoc_t assoc;
|
assoc assoc;
|
||||||
struniq_t struniq;
|
uniqstr uniqstr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Define the tokens together with their human representation. */
|
/* Define the tokens together with their human representation. */
|
||||||
@@ -141,10 +142,10 @@ braced_code_t current_braced_code = action_braced_code;
|
|||||||
%token BRACED_CODE "{...}"
|
%token BRACED_CODE "{...}"
|
||||||
|
|
||||||
|
|
||||||
%type <string> STRING string_content
|
%type <chars> STRING string_content
|
||||||
BRACED_CODE code_content action
|
BRACED_CODE code_content action
|
||||||
PROLOGUE EPILOGUE
|
PROLOGUE EPILOGUE
|
||||||
%type <struniq> TYPE
|
%type <uniqstr> TYPE
|
||||||
%type <integer> INT
|
%type <integer> INT
|
||||||
%type <symbol> ID ID_COLON symbol string_as_id
|
%type <symbol> ID ID_COLON symbol string_as_id
|
||||||
%type <assoc> precedence_declarator
|
%type <assoc> precedence_declarator
|
||||||
@@ -206,7 +207,7 @@ grammar_declaration:
|
|||||||
{ current_braced_code = destructor_braced_code; }
|
{ current_braced_code = destructor_braced_code; }
|
||||||
BRACED_CODE symbols.1
|
BRACED_CODE symbols.1
|
||||||
{
|
{
|
||||||
symbol_list_t *list;
|
symbol_list *list;
|
||||||
for (list = $4; list; list = list->next)
|
for (list = $4; list; list = list->next)
|
||||||
symbol_destructor_set (list->sym, $3, @3);
|
symbol_destructor_set (list->sym, $3, @3);
|
||||||
symbol_list_free ($4);
|
symbol_list_free ($4);
|
||||||
@@ -216,7 +217,7 @@ grammar_declaration:
|
|||||||
{ current_braced_code = printer_braced_code; }
|
{ current_braced_code = printer_braced_code; }
|
||||||
BRACED_CODE symbols.1
|
BRACED_CODE symbols.1
|
||||||
{
|
{
|
||||||
symbol_list_t *list;
|
symbol_list *list;
|
||||||
for (list = $4; list; list = list->next)
|
for (list = $4; list; list = list->next)
|
||||||
symbol_printer_set (list->sym, $3, list->location);
|
symbol_printer_set (list->sym, $3, list->location);
|
||||||
symbol_list_free ($4);
|
symbol_list_free ($4);
|
||||||
@@ -237,7 +238,7 @@ symbol_declaration:
|
|||||||
}
|
}
|
||||||
| "%type" TYPE symbols.1
|
| "%type" TYPE symbols.1
|
||||||
{
|
{
|
||||||
symbol_list_t *list;
|
symbol_list *list;
|
||||||
for (list = $3; list; list = list->next)
|
for (list = $3; list; list = list->next)
|
||||||
symbol_type_set (list->sym, $2, @2);
|
symbol_type_set (list->sym, $2, @2);
|
||||||
symbol_list_free ($3);
|
symbol_list_free ($3);
|
||||||
@@ -247,7 +248,7 @@ symbol_declaration:
|
|||||||
precedence_declaration:
|
precedence_declaration:
|
||||||
precedence_declarator type.opt symbols.1
|
precedence_declarator type.opt symbols.1
|
||||||
{
|
{
|
||||||
symbol_list_t *list;
|
symbol_list *list;
|
||||||
++current_prec;
|
++current_prec;
|
||||||
for (list = $3; list; list = list->next)
|
for (list = $3; list; list = list->next)
|
||||||
{
|
{
|
||||||
@@ -448,7 +449,7 @@ lloc_default (YYLTYPE const *rhs, int n)
|
|||||||
declaration DECL and location LOC. */
|
declaration DECL and location LOC. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_param (char const *type, char const *decl, location_t loc)
|
add_param (char const *type, char const *decl, location loc)
|
||||||
{
|
{
|
||||||
static char const alphanum[] =
|
static char const alphanum[] =
|
||||||
"0123456789"
|
"0123456789"
|
||||||
@@ -504,17 +505,17 @@ print_token_value (FILE *file, int type, YYSTYPE const *value)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case STRING:
|
case STRING:
|
||||||
fprintf (file, " = \"%s\"", value->string);
|
fprintf (file, " = \"%s\"", value->chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE:
|
case TYPE:
|
||||||
fprintf (file, " = <%s>", value->struniq);
|
fprintf (file, " = <%s>", value->uniqstr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BRACED_CODE:
|
case BRACED_CODE:
|
||||||
case PROLOGUE:
|
case PROLOGUE:
|
||||||
case EPILOGUE:
|
case EPILOGUE:
|
||||||
fprintf (file, " = {{ %s }}", value->string);
|
fprintf (file, " = {{ %s }}", value->chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -524,7 +525,7 @@ print_token_value (FILE *file, int type, YYSTYPE const *value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gram_error (location_t const *loc, char const *msg)
|
gram_error (location const *loc, char const *msg)
|
||||||
{
|
{
|
||||||
complain_at (*loc, "%s", msg);
|
complain_at (*loc, "%s", msg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user