mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-29 04:25:17 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8c9212bbd | ||
|
|
d992a222af | ||
|
|
86a2a43854 | ||
|
|
d8de391c38 | ||
|
|
f8a710c6f4 | ||
|
|
2d8fc07778 | ||
|
|
a910d26cfb |
@@ -2,6 +2,32 @@ GNU Bison NEWS
|
||||
|
||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||
|
||||
** New syntax: partial-order precedence relationships
|
||||
|
||||
Formerly, the precedence order of tokens was linear, depending only on the
|
||||
order in which they were declared. With the new syntax, all the tokens are
|
||||
not necessarily comparable. It is possible to declare a group of tokens with
|
||||
no links outside of the group, and to later on add only those needed.
|
||||
The uncomparability of tokens would allow for more feedback on new conflicts
|
||||
silently resolved via precedence.
|
||||
|
||||
An example of the new syntax applied to arithmetic and boolean operators,
|
||||
with '^' serving as both numerical power and boolean XOR:
|
||||
|
||||
%gprec arith {
|
||||
%left '+' '-'
|
||||
%left '*' '/'
|
||||
}
|
||||
%gprec bool {
|
||||
%left OR
|
||||
%left AND
|
||||
}
|
||||
%gprec { %right '^' }
|
||||
|
||||
%precr '^' > arith
|
||||
%precr OR AND > '^'
|
||||
|
||||
Here, AND is not comparable with '+', but '^' > '+' and AND > '^'
|
||||
|
||||
* Noteworthy changes in release 3.0 (2013-07-25) [stable]
|
||||
|
||||
|
||||
@@ -740,7 +740,7 @@ AnnotationList__computeDominantContribution (AnnotationList const *self,
|
||||
if (reduce_precedence
|
||||
&& (reduce_precedence < shift_precedence
|
||||
|| (reduce_precedence == shift_precedence
|
||||
&& token->content->assoc == right_assoc)))
|
||||
&& token->content->prec_node->assoc == right_assoc)))
|
||||
continue;
|
||||
if (!AnnotationList__stateMakesContribution (self, nitems, ci,
|
||||
lookaheads))
|
||||
@@ -748,7 +748,7 @@ AnnotationList__computeDominantContribution (AnnotationList const *self,
|
||||
/* This uneliminated reduction contributes, so see if it can cause
|
||||
an error action. */
|
||||
if (reduce_precedence == shift_precedence
|
||||
&& token->content->assoc == non_assoc)
|
||||
&& token->content->prec_node->assoc == non_assoc)
|
||||
{
|
||||
/* It's not possible to find split-stable domination over
|
||||
shift after a potential %nonassoc. */
|
||||
|
||||
+35
-173
@@ -46,28 +46,11 @@ typedef enum
|
||||
} severity;
|
||||
|
||||
|
||||
/** Struct to sort the warnings according to location. */
|
||||
typedef struct
|
||||
{
|
||||
location *loc;
|
||||
char *message;
|
||||
} warning;
|
||||
|
||||
warning **warning_list;
|
||||
|
||||
struct obstack obstack_warning;
|
||||
|
||||
#define WARNING_LIST_INCREMENT 100
|
||||
|
||||
int warning_count = 0;
|
||||
|
||||
/** For each warning type, its severity. */
|
||||
static severity warnings_flag[warnings_size];
|
||||
|
||||
static unsigned *indent_ptr = 0;
|
||||
|
||||
static const location *complain_loc;
|
||||
|
||||
/*------------------------.
|
||||
| --warnings's handling. |
|
||||
`------------------------*/
|
||||
@@ -193,9 +176,6 @@ complain_init (void)
|
||||
warnings_flag[b] = (1 << b & warnings_default
|
||||
? severity_warning
|
||||
: severity_unset);
|
||||
|
||||
warning_list = xmalloc (WARNING_LIST_INCREMENT * sizeof (*warning_list));
|
||||
obstack_init (&obstack_warning);
|
||||
}
|
||||
|
||||
static severity
|
||||
@@ -231,7 +211,7 @@ warning_is_unset (warnings flags)
|
||||
/** Display a "[-Wyacc]" like message on \a f. */
|
||||
|
||||
static void
|
||||
warnings_print_categories (warnings warn_flags, struct obstack *obs)
|
||||
warnings_print_categories (warnings warn_flags, FILE *f)
|
||||
{
|
||||
/* Display only the first match, the second is "-Wall". */
|
||||
size_t i;
|
||||
@@ -239,79 +219,13 @@ warnings_print_categories (warnings warn_flags, struct obstack *obs)
|
||||
if (warn_flags & warnings_types[i])
|
||||
{
|
||||
severity s = warning_severity (warnings_types[i]);
|
||||
obstack_printf (obs, " [-W%s%s]",
|
||||
fprintf (f, " [-W%s%s]",
|
||||
s == severity_error ? "error=" : "",
|
||||
warnings_args[i]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
start_error (const location *loc, warnings flags, const char *prefix,
|
||||
const char *message, va_list args)
|
||||
{
|
||||
unsigned pos = 0;
|
||||
|
||||
if (loc)
|
||||
pos += location_obstack_print (*loc, &obstack_warning);
|
||||
else
|
||||
pos += obstack_printf (&obstack_warning, "%s", current_file ? current_file
|
||||
: program_name);
|
||||
pos += obstack_printf (&obstack_warning, ": ");
|
||||
|
||||
if (indent_ptr)
|
||||
{
|
||||
if (*indent_ptr)
|
||||
prefix = NULL;
|
||||
if (!*indent_ptr)
|
||||
*indent_ptr = pos;
|
||||
else if (*indent_ptr > pos)
|
||||
obstack_printf (&obstack_warning, "%*s", *indent_ptr - pos, "");
|
||||
indent_ptr = 0;
|
||||
}
|
||||
|
||||
if (prefix)
|
||||
obstack_printf (&obstack_warning, "%s: ", prefix);
|
||||
|
||||
obstack_vprintf (&obstack_warning, message, args);
|
||||
if (! (flags & silent))
|
||||
warnings_print_categories (flags, &obstack_warning);
|
||||
{
|
||||
size_t l = strlen (message);
|
||||
if (l < 2 || message[l - 2] != ':' || message[l - 1] != ' ')
|
||||
{
|
||||
obstack_1grow (&obstack_warning, '\n');
|
||||
if (loc && feature_flag & feature_caret && !(flags & no_caret))
|
||||
location_obstack_caret (*loc, &obstack_warning);
|
||||
}
|
||||
}
|
||||
|
||||
if (!complain_loc)
|
||||
complain_loc = loc;
|
||||
}
|
||||
|
||||
void
|
||||
finish_complaint (void)
|
||||
{
|
||||
|
||||
if (!((warning_count + 1) % WARNING_LIST_INCREMENT))
|
||||
warning_list = xnrealloc (warning_list, warning_count + 1
|
||||
+ WARNING_LIST_INCREMENT, sizeof (*warning_list));
|
||||
warning_list[warning_count] = xmalloc (sizeof **warning_list);
|
||||
warning *w = warning_list[warning_count];
|
||||
if (complain_loc)
|
||||
{
|
||||
w->loc = xmalloc (sizeof *w->loc);
|
||||
*w->loc = *complain_loc;
|
||||
}
|
||||
else
|
||||
w->loc = NULL;
|
||||
complain_loc = NULL;
|
||||
w->message = obstack_finish0 (&obstack_warning);
|
||||
warning_count ++;
|
||||
}
|
||||
|
||||
|
||||
/** Report an error message.
|
||||
*
|
||||
* \param loc the location, defaulting to the current file,
|
||||
@@ -329,37 +243,43 @@ void
|
||||
error_message (const location *loc, warnings flags, const char *prefix,
|
||||
const char *message, va_list args)
|
||||
{
|
||||
start_error (loc, flags, prefix, message, args);
|
||||
finish_complaint ();
|
||||
}
|
||||
unsigned pos = 0;
|
||||
|
||||
if (loc)
|
||||
pos += location_print (*loc, stderr);
|
||||
else
|
||||
pos += fprintf (stderr, "%s", current_file ? current_file : program_name);
|
||||
pos += fprintf (stderr, ": ");
|
||||
|
||||
/** Start an error message, but don't conclude it. That can be a fatal error,
|
||||
an error or just a warning. */
|
||||
|
||||
static void
|
||||
start_complains (const location *loc, warnings flags, const char *message,
|
||||
va_list args)
|
||||
{
|
||||
severity s = warning_severity (flags);
|
||||
if ((flags & complaint) && complaint_status < status_complaint)
|
||||
complaint_status = status_complaint;
|
||||
|
||||
if (severity_warning <= s)
|
||||
if (indent_ptr)
|
||||
{
|
||||
const char* prefix =
|
||||
s == severity_fatal ? _("fatal error")
|
||||
: s == severity_error ? _("error")
|
||||
: _("warning");
|
||||
if (severity_error <= s && ! complaint_status)
|
||||
complaint_status = status_warning_as_error;
|
||||
start_error (loc, flags, prefix, message, args);
|
||||
if (*indent_ptr)
|
||||
prefix = NULL;
|
||||
if (!*indent_ptr)
|
||||
*indent_ptr = pos;
|
||||
else if (*indent_ptr > pos)
|
||||
fprintf (stderr, "%*s", *indent_ptr - pos, "");
|
||||
indent_ptr = 0;
|
||||
}
|
||||
|
||||
if (flags & fatal)
|
||||
print_warnings_and_exit (stderr, EXIT_FAILURE);
|
||||
}
|
||||
if (prefix)
|
||||
fprintf (stderr, "%s: ", prefix);
|
||||
|
||||
vfprintf (stderr, message, args);
|
||||
if (! (flags & silent))
|
||||
warnings_print_categories (flags, stderr);
|
||||
{
|
||||
size_t l = strlen (message);
|
||||
if (l < 2 || message[l - 2] != ':' || message[l - 1] != ' ')
|
||||
{
|
||||
putc ('\n', stderr);
|
||||
fflush (stderr);
|
||||
if (loc && feature_flag & feature_caret && !(flags & no_caret))
|
||||
location_caret (*loc, stderr);
|
||||
}
|
||||
}
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
/** Raise a complaint. That can be a fatal error, an error or just a
|
||||
warning. */
|
||||
@@ -384,7 +304,7 @@ complains (const location *loc, warnings flags, const char *message,
|
||||
}
|
||||
|
||||
if (flags & fatal)
|
||||
print_warnings_and_exit (stderr, EXIT_FAILURE);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -396,15 +316,6 @@ complain (location const *loc, warnings flags, const char *message, ...)
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
start_complain (location const *loc, warnings flags, const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, message);
|
||||
start_complains (loc, flags, message, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
complain_indent (location const *loc, warnings flags, unsigned *indent,
|
||||
const char *message, ...)
|
||||
@@ -416,17 +327,6 @@ complain_indent (location const *loc, warnings flags, unsigned *indent,
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
start_complain_indent (location const *loc, warnings flags, unsigned *indent,
|
||||
const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
indent_ptr = indent;
|
||||
va_start (args, message);
|
||||
start_complains (loc, flags, message, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
complain_args (location const *loc, warnings w, unsigned *indent,
|
||||
int argc, char *argv[])
|
||||
@@ -473,45 +373,7 @@ duplicate_directive (char const *directive,
|
||||
location first, location second)
|
||||
{
|
||||
unsigned i = 0;
|
||||
start_complain (&second, complaint, _("only one %s allowed per rule"), directive);
|
||||
complain (&second, complaint, _("only one %s allowed per rule"), directive);
|
||||
i += SUB_INDENT;
|
||||
complain_indent (&first, complaint, &i, _("previous declaration"));
|
||||
}
|
||||
|
||||
/** Compare warnings, to sort them. */
|
||||
static int
|
||||
warning_cmp (void const *a, void const *b)
|
||||
{
|
||||
warning *wa = *(warning * const *)a, *wb = *(warning * const *)b;
|
||||
if (wa->loc && wb->loc)
|
||||
return location_cmp (*wa->loc, *wb->loc);
|
||||
/* Undefined location/line number at the end. */
|
||||
else if (wa->loc)
|
||||
return -1;
|
||||
else if (wb->loc)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
print_warnings (FILE *f)
|
||||
{
|
||||
if (obstack_object_size (&obstack_warning))
|
||||
finish_complaint ();
|
||||
qsort (warning_list, warning_count, sizeof *warning_list, warning_cmp);
|
||||
for (int i = 0; i < warning_count; ++i)
|
||||
{
|
||||
fprintf (f, "%s", warning_list[i]->message);
|
||||
free (warning_list[i]->loc);
|
||||
free (warning_list[i]);
|
||||
}
|
||||
free (warning_list);
|
||||
obstack_free (&obstack_warning, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
print_warnings_and_exit (FILE *f, int exit_status)
|
||||
{
|
||||
print_warnings (f);
|
||||
exit (exit_status);
|
||||
}
|
||||
|
||||
@@ -106,12 +106,6 @@ typedef enum
|
||||
(Never enabled, never disabled). */
|
||||
bool warning_is_unset (warnings flags);
|
||||
|
||||
/** Start a complaint, with maybe a location, but don't finish it until a
|
||||
normal complaint or a call to finish_complaint. */
|
||||
void start_complain (location const *loc, warnings flags, char const *message,
|
||||
...)
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
|
||||
/** Make a complaint, with maybe a location. */
|
||||
void complain (location const *loc, warnings flags, char const *message, ...)
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
@@ -120,19 +114,11 @@ void complain (location const *loc, warnings flags, char const *message, ...)
|
||||
void complain_args (location const *loc, warnings w, unsigned *indent,
|
||||
int argc, char *arg[]);
|
||||
|
||||
/** Start a complaint message with location and some indentation, but don't
|
||||
finish it until a normal complaint or a call to finish_complaint. */
|
||||
void start_complain_indent (location const *loc, warnings flags, unsigned *indent,
|
||||
char const *message, ...)
|
||||
__attribute__ ((__format__ (__printf__, 4, 5)));
|
||||
|
||||
/** Make a complaint with location and some indentation. */
|
||||
void complain_indent (location const *loc, warnings flags, unsigned *indent,
|
||||
char const *message, ...)
|
||||
__attribute__ ((__format__ (__printf__, 4, 5)));
|
||||
|
||||
/** Finish the current complaint. */
|
||||
void finish_complaint (void);
|
||||
|
||||
/** Report an obsolete syntax, suggest the updated one. */
|
||||
void deprecated_directive (location const *loc,
|
||||
@@ -155,10 +141,4 @@ typedef enum
|
||||
/** Whether an error was reported. */
|
||||
extern err_status complaint_status;
|
||||
|
||||
/** Sort and print warnings, and free them. */
|
||||
void print_warnings (FILE *f);
|
||||
|
||||
/** Sort and print warnings, free them, then exit. */
|
||||
void print_warnings_and_exit (FILE *f, int exit_status);
|
||||
|
||||
#endif /* !COMPLAIN_H_ */
|
||||
|
||||
+77
-56
@@ -53,7 +53,8 @@ enum conflict_resolution
|
||||
reduce_resolution,
|
||||
left_resolution,
|
||||
right_resolution,
|
||||
nonassoc_resolution
|
||||
nonassoc_resolution,
|
||||
uncomparable_resolution
|
||||
};
|
||||
|
||||
|
||||
@@ -90,6 +91,7 @@ log_resolution (rule *r, symbol_number token,
|
||||
break;
|
||||
|
||||
case nonassoc_resolution:
|
||||
case uncomparable_resolution:
|
||||
obstack_printf (&solved_conflicts_obstack,
|
||||
_(" Conflict between rule %d and token %s"
|
||||
" resolved as an error"),
|
||||
@@ -132,6 +134,12 @@ log_resolution (rule *r, symbol_number token,
|
||||
" (%%nonassoc %s)",
|
||||
symbols[token]->tag);
|
||||
break;
|
||||
case uncomparable_resolution:
|
||||
obstack_printf (&solved_conflicts_obstack,
|
||||
" (%s uncomparable with %s)",
|
||||
r->prec->symbol->tag,
|
||||
symbols[token]->tag);
|
||||
break;
|
||||
}
|
||||
|
||||
obstack_sgrow (&solved_conflicts_obstack, ".\n");
|
||||
@@ -161,6 +169,7 @@ log_resolution (rule *r, symbol_number token,
|
||||
xml_escape (symbols[token]->tag));
|
||||
break;
|
||||
|
||||
case uncomparable_resolution:
|
||||
case nonassoc_resolution:
|
||||
obstack_printf (&solved_conflicts_xml_obstack,
|
||||
" <resolution rule=\"%d\" symbol=\"%s\""
|
||||
@@ -203,7 +212,13 @@ log_resolution (rule *r, symbol_number token,
|
||||
obstack_printf (&solved_conflicts_xml_obstack,
|
||||
"%%nonassoc %s",
|
||||
xml_escape (symbols[token]->tag));
|
||||
break;
|
||||
break;
|
||||
case uncomparable_resolution:
|
||||
obstack_printf (&solved_conflicts_xml_obstack,
|
||||
"%s uncomparable with %s",
|
||||
xml_escape_n (0, symbols[token]->tag),
|
||||
xml_escape_n (1, r->prec->symbol->tag));
|
||||
break;
|
||||
}
|
||||
|
||||
obstack_sgrow (&solved_conflicts_xml_obstack, "</resolution>\n");
|
||||
@@ -243,7 +258,6 @@ flush_reduce (bitset lookahead_tokens, int token)
|
||||
bitset_reset (lookahead_tokens, token);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------.
|
||||
| Attempt to resolve shift-reduce conflict for one rule by means of |
|
||||
| precedence declarations. It has already been checked that the |
|
||||
@@ -263,66 +277,73 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors, int *nerrs)
|
||||
reductions *reds = s->reductions;
|
||||
/* Find the rule to reduce by to get precedence of reduction. */
|
||||
rule *redrule = reds->rules[ruleno];
|
||||
int redprec = redrule->prec->prec;
|
||||
prec_node *redprecsym = redrule->prec->prec_node;
|
||||
bitset lookahead_tokens = reds->lookahead_tokens[ruleno];
|
||||
|
||||
for (i = 0; i < ntokens; i++)
|
||||
if (bitset_test (lookahead_tokens, i)
|
||||
&& bitset_test (lookahead_set, i)
|
||||
&& symbols[i]->content->prec)
|
||||
&& bitset_test (lookahead_set, i))
|
||||
{
|
||||
/* Shift-reduce conflict occurs for token number i
|
||||
and it has a precedence.
|
||||
The precedence of shifting is that of token i. */
|
||||
if (symbols[i]->content->prec < redprec)
|
||||
if (redprecsym && symbols[i]->content->prec_node)
|
||||
{
|
||||
register_precedence (redrule->prec->number, i);
|
||||
log_resolution (redrule, i, reduce_resolution);
|
||||
flush_shift (s, i);
|
||||
}
|
||||
else if (symbols[i]->content->prec > redprec)
|
||||
{
|
||||
register_precedence (i, redrule->prec->number);
|
||||
log_resolution (redrule, i, shift_resolution);
|
||||
flush_reduce (lookahead_tokens, i);
|
||||
/* Shift-reduce conflict occurs for token number i
|
||||
and it has a precedence.
|
||||
The precedence of shifting is that of token i. */
|
||||
if (is_prec_superior (redprecsym, symbols[i]->content->prec_node))
|
||||
{
|
||||
register_precedence (redrule->prec->number, i);
|
||||
log_resolution (redrule, i, reduce_resolution);
|
||||
flush_shift (s, i);
|
||||
}
|
||||
else if (is_prec_superior (symbols[i]->content->prec_node,
|
||||
redprecsym))
|
||||
{
|
||||
register_precedence (i, redrule->prec->number);
|
||||
log_resolution (redrule, i, shift_resolution);
|
||||
flush_reduce (lookahead_tokens, i);
|
||||
}
|
||||
else if (is_prec_equal (redprecsym, symbols[i]->content->prec_node))
|
||||
/* Matching precedence levels.
|
||||
For non-defined associativity, keep both: unexpected
|
||||
associativity conflict.
|
||||
For left associativity, keep only the reduction.
|
||||
For right associativity, keep only the shift.
|
||||
For nonassociativity, keep neither. */
|
||||
|
||||
switch (symbols[i]->content->prec_node->assoc)
|
||||
{
|
||||
case undef_assoc:
|
||||
break;
|
||||
|
||||
case precedence_assoc:
|
||||
break;
|
||||
|
||||
case right_assoc:
|
||||
register_assoc (i, redrule->prec->number);
|
||||
log_resolution (redrule, i, right_resolution);
|
||||
flush_reduce (lookahead_tokens, i);
|
||||
break;
|
||||
|
||||
case left_assoc:
|
||||
register_assoc (i, redrule->prec->number);
|
||||
log_resolution (redrule, i, left_resolution);
|
||||
flush_shift (s, i);
|
||||
break;
|
||||
|
||||
case non_assoc:
|
||||
register_assoc (i, redrule->prec->number);
|
||||
log_resolution (redrule, i, nonassoc_resolution);
|
||||
flush_shift (s, i);
|
||||
flush_reduce (lookahead_tokens, i);
|
||||
/* Record an explicit error for this token. */
|
||||
errors[(*nerrs)++] = symbols[i];
|
||||
break;
|
||||
}
|
||||
else
|
||||
log_resolution (redrule, i, uncomparable_resolution);
|
||||
}
|
||||
else
|
||||
/* Matching precedence levels.
|
||||
For non-defined associativity, keep both: unexpected
|
||||
associativity conflict.
|
||||
For left associativity, keep only the reduction.
|
||||
For right associativity, keep only the shift.
|
||||
For nonassociativity, keep neither. */
|
||||
|
||||
switch (symbols[i]->content->assoc)
|
||||
{
|
||||
case undef_assoc:
|
||||
abort ();
|
||||
|
||||
case precedence_assoc:
|
||||
break;
|
||||
|
||||
case right_assoc:
|
||||
register_assoc (i, redrule->prec->number);
|
||||
log_resolution (redrule, i, right_resolution);
|
||||
flush_reduce (lookahead_tokens, i);
|
||||
break;
|
||||
|
||||
case left_assoc:
|
||||
register_assoc (i, redrule->prec->number);
|
||||
log_resolution (redrule, i, left_resolution);
|
||||
flush_shift (s, i);
|
||||
break;
|
||||
|
||||
case non_assoc:
|
||||
register_assoc (i, redrule->prec->number);
|
||||
log_resolution (redrule, i, nonassoc_resolution);
|
||||
flush_shift (s, i);
|
||||
flush_reduce (lookahead_tokens, i);
|
||||
/* Record an explicit error for this token. */
|
||||
errors[(*nerrs)++] = symbols[i];
|
||||
break;
|
||||
}
|
||||
log_resolution (redrule, i, uncomparable_resolution);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,7 +375,7 @@ set_conflicts (state *s, symbol **errors)
|
||||
check for shift-reduce conflict, and try to resolve using
|
||||
precedence. */
|
||||
for (i = 0; i < reds->num; ++i)
|
||||
if (reds->rules[i]->prec && reds->rules[i]->prec->prec
|
||||
if (reds->rules[i]->prec /* && reds->rules[i]->prec->prec */
|
||||
&& !bitset_disjoint_p (reds->lookahead_tokens[i], lookahead_set))
|
||||
resolve_sr_conflict (s, i, errors, &nerrs);
|
||||
|
||||
|
||||
+4
-2
@@ -44,6 +44,8 @@ int nvars = 0;
|
||||
|
||||
symbol_number *token_translations = NULL;
|
||||
|
||||
enum braces_state prec_braces = 0;
|
||||
|
||||
int max_user_token_number = 256;
|
||||
|
||||
bool
|
||||
@@ -239,7 +241,7 @@ grammar_dump (FILE *out, const char *title)
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
fprintf (out, "%5d %5d %5d %s\n",
|
||||
i,
|
||||
symbols[i]->content->prec, symbols[i]->content->assoc,
|
||||
symbols[i]->content->prec, symbols[i]->content->prec_node->assoc,
|
||||
symbols[i]->tag);
|
||||
fprintf (out, "\n\n");
|
||||
}
|
||||
@@ -262,7 +264,7 @@ grammar_dump (FILE *out, const char *title)
|
||||
fprintf (out, "%3d (%2d, %2d, %2d, %2u-%2u) %2d ->",
|
||||
i,
|
||||
rule_i->prec ? rule_i->prec->prec : 0,
|
||||
rule_i->prec ? rule_i->prec->assoc : 0,
|
||||
rule_i->prec ? rule_i->prec->prec_node->assoc : 0,
|
||||
rule_i->useful,
|
||||
rhs_itemno,
|
||||
rhs_itemno + rhs_count - 1,
|
||||
|
||||
+11
@@ -117,6 +117,17 @@ typedef int item_number;
|
||||
extern item_number *ritem;
|
||||
extern unsigned int nritems;
|
||||
|
||||
enum braces_state
|
||||
{
|
||||
default_braces_state,
|
||||
gprec_seen,
|
||||
group_name_seen,
|
||||
braces_seen
|
||||
};
|
||||
|
||||
/* Marker for the lexer and parser, to correctly interpret braces. */
|
||||
extern enum braces_state prec_braces;
|
||||
|
||||
/* There is weird relationship between OT1H item_number and OTOH
|
||||
symbol_number and rule_number: we store the latter in
|
||||
item_number. symbol_number values are stored as-is, while
|
||||
|
||||
-100
@@ -137,48 +137,6 @@ location_print (location loc, FILE *out)
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
location_obstack_print (location loc, struct obstack *obs)
|
||||
{
|
||||
unsigned res = 0;
|
||||
int end_col = 0 != loc.end.column ? loc.end.column - 1 : 0;
|
||||
res += obstack_printf (obs, "%s",
|
||||
quotearg_n_style (3, escape_quoting_style, loc.start.file));
|
||||
if (0 <= loc.start.line)
|
||||
{
|
||||
res += obstack_printf (obs, ":%d", loc.start.line);
|
||||
if (0 <= loc.start.column)
|
||||
res += obstack_printf (obs, ".%d", loc.start.column);
|
||||
}
|
||||
if (loc.start.file != loc.end.file)
|
||||
{
|
||||
res += obstack_printf (obs, "-%s",
|
||||
quotearg_n_style (3, escape_quoting_style,
|
||||
loc.end.file));
|
||||
if (0 <= loc.end.line)
|
||||
{
|
||||
res += obstack_printf (obs, ":%d", loc.end.line);
|
||||
if (0 <= end_col)
|
||||
res += obstack_printf (obs, ".%d", end_col);
|
||||
}
|
||||
}
|
||||
else if (0 <= loc.end.line)
|
||||
{
|
||||
if (loc.start.line < loc.end.line)
|
||||
{
|
||||
res += obstack_printf (obs, "-%d", loc.end.line);
|
||||
if (0 <= end_col)
|
||||
res += obstack_printf (obs, ".%d", end_col);
|
||||
}
|
||||
else if (0 <= end_col && loc.start.column < end_col)
|
||||
res += obstack_printf (obs, "-%d", end_col);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Persistant data used by location_caret to avoid reopening and rereading the
|
||||
same file all over for each error. */
|
||||
struct caret_info
|
||||
@@ -257,64 +215,6 @@ location_caret (location loc, FILE *out)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
location_obstack_caret (location loc, struct obstack *obs)
|
||||
{
|
||||
/* FIXME: find a way to support multifile locations, and only open once each
|
||||
file. That would make the procedure future-proof. */
|
||||
if (! (caret_info.source
|
||||
|| (caret_info.source = fopen (loc.start.file, "r")))
|
||||
|| loc.start.column == -1 || loc.start.line == -1)
|
||||
return;
|
||||
|
||||
/* If the line we want to quote is seekable (the same line as the previous
|
||||
location), just seek it. If it was a previous line, we lost track of it,
|
||||
so return to the start of file. */
|
||||
if (caret_info.line <= loc.start.line)
|
||||
fseek (caret_info.source, caret_info.offset, SEEK_SET);
|
||||
else
|
||||
{
|
||||
caret_info.line = 1;
|
||||
caret_info.offset = 0;
|
||||
fseek (caret_info.source, caret_info.offset, SEEK_SET);
|
||||
}
|
||||
|
||||
/* Advance to the line's position, keeping track of the offset. */
|
||||
while (caret_info.line < loc.start.line)
|
||||
caret_info.line += getc (caret_info.source) == '\n';
|
||||
caret_info.offset = ftell (caret_info.source);
|
||||
|
||||
/* Read the actual line. Don't update the offset, so that we keep a pointer
|
||||
to the start of the line. */
|
||||
{
|
||||
char c = getc (caret_info.source);
|
||||
if (c != EOF)
|
||||
{
|
||||
/* Quote the file, indent by a single column. */
|
||||
obstack_1grow (obs, ' ');
|
||||
do
|
||||
obstack_1grow (obs, c);
|
||||
while ((c = getc (caret_info.source)) != EOF && c != '\n');
|
||||
obstack_1grow (obs, '\n');
|
||||
|
||||
{
|
||||
/* The caret of a multiline location ends with the first line. */
|
||||
size_t len = loc.start.line != loc.end.line
|
||||
? ftell (caret_info.source) - caret_info.offset
|
||||
: loc.end.column;
|
||||
int i;
|
||||
|
||||
/* Print the carets (at least one), with the same indent as above.*/
|
||||
obstack_printf (obs, " %*s", loc.start.column - 1, "");
|
||||
for (i = loc.start.column; i == loc.start.column || i < len; ++i)
|
||||
obstack_1grow (obs, '^');
|
||||
}
|
||||
obstack_1grow (obs, '\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
boundary_set_from_string (boundary *bound, char *loc_str)
|
||||
{
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
# include <stdio.h>
|
||||
# include <string.h> /* strcmp */
|
||||
|
||||
# include "system.h"
|
||||
|
||||
# include "uniqstr.h"
|
||||
|
||||
/* A boundary between two characters. */
|
||||
@@ -109,9 +107,6 @@ void location_compute (location *loc,
|
||||
Warning: uses quotearg's slot 3. */
|
||||
unsigned location_print (location loc, FILE *out);
|
||||
|
||||
/* Same as location_print, only to an obstack. */
|
||||
unsigned location_obstack_print (location loc, struct obstack *obs);
|
||||
|
||||
/* Free any allocated ressources and close any open file handles that are
|
||||
left-over by the usage of location_caret. */
|
||||
void cleanup_caret (void);
|
||||
@@ -119,9 +114,6 @@ void cleanup_caret (void);
|
||||
/* Output to OUT the line and caret corresponding to location LOC. */
|
||||
void location_caret (location loc, FILE *out);
|
||||
|
||||
/* Same as location_caret, only with an obstack. */
|
||||
void location_obstack_caret (location loc, struct obstack *obs);
|
||||
|
||||
/* Return -1, 0, 1, depending whether a is before, equal, or
|
||||
after b. */
|
||||
static inline int
|
||||
|
||||
+1
-3
@@ -203,6 +203,7 @@ main (int argc, char *argv[])
|
||||
contains things such as user actions, prologue, epilogue etc. */
|
||||
gram_scanner_free ();
|
||||
muscle_free ();
|
||||
uniqstrs_free ();
|
||||
code_scanner_free ();
|
||||
skel_scanner_free ();
|
||||
quotearg_free ();
|
||||
@@ -217,9 +218,6 @@ main (int argc, char *argv[])
|
||||
timevar_stop (TV_TOTAL);
|
||||
timevar_print (stderr);
|
||||
|
||||
print_warnings (stderr);
|
||||
|
||||
uniqstrs_free ();
|
||||
cleanup_caret ();
|
||||
|
||||
return complaint_status ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
|
||||
+1
-1
@@ -509,7 +509,7 @@ muscle_percent_define_insert (char const *var, location variable_loc,
|
||||
unsigned i = 0;
|
||||
if (how_old == MUSCLE_PERCENT_DEFINE_F)
|
||||
goto end;
|
||||
start_complain_indent (&variable_loc, complaint, &i,
|
||||
complain_indent (&variable_loc, complaint, &i,
|
||||
_("%%define variable %s redefined"),
|
||||
quote (variable));
|
||||
i += SUB_INDENT;
|
||||
|
||||
+787
-652
File diff suppressed because it is too large
Load Diff
+64
-57
@@ -52,7 +52,7 @@ extern int gram_debug;
|
||||
|
||||
#include "symlist.h"
|
||||
#include "symtab.h"
|
||||
#line 221 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
#line 233 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -61,7 +61,7 @@ extern int gram_debug;
|
||||
param_parse = 1 << 1,
|
||||
param_both = param_lex | param_parse
|
||||
} param_type;
|
||||
#line 645 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
#line 723 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
#include "muscle-tab.h"
|
||||
|
||||
#line 68 "src/parse-gram.h" /* yacc.c:1909 */
|
||||
@@ -84,49 +84,54 @@ extern int gram_debug;
|
||||
PERCENT_PRECEDENCE = 267,
|
||||
PERCENT_PREC = 268,
|
||||
PERCENT_DPREC = 269,
|
||||
PERCENT_MERGE = 270,
|
||||
PERCENT_CODE = 271,
|
||||
PERCENT_DEFAULT_PREC = 272,
|
||||
PERCENT_DEFINE = 273,
|
||||
PERCENT_DEFINES = 274,
|
||||
PERCENT_ERROR_VERBOSE = 275,
|
||||
PERCENT_EXPECT = 276,
|
||||
PERCENT_EXPECT_RR = 277,
|
||||
PERCENT_FLAG = 278,
|
||||
PERCENT_FILE_PREFIX = 279,
|
||||
PERCENT_GLR_PARSER = 280,
|
||||
PERCENT_INITIAL_ACTION = 281,
|
||||
PERCENT_LANGUAGE = 282,
|
||||
PERCENT_NAME_PREFIX = 283,
|
||||
PERCENT_NO_DEFAULT_PREC = 284,
|
||||
PERCENT_NO_LINES = 285,
|
||||
PERCENT_NONDETERMINISTIC_PARSER = 286,
|
||||
PERCENT_OUTPUT = 287,
|
||||
PERCENT_REQUIRE = 288,
|
||||
PERCENT_SKELETON = 289,
|
||||
PERCENT_START = 290,
|
||||
PERCENT_TOKEN_TABLE = 291,
|
||||
PERCENT_VERBOSE = 292,
|
||||
PERCENT_YACC = 293,
|
||||
BRACED_CODE = 294,
|
||||
BRACED_PREDICATE = 295,
|
||||
BRACKETED_ID = 296,
|
||||
CHAR = 297,
|
||||
EPILOGUE = 298,
|
||||
EQUAL = 299,
|
||||
ID = 300,
|
||||
ID_COLON = 301,
|
||||
PERCENT_PERCENT = 302,
|
||||
PIPE = 303,
|
||||
PROLOGUE = 304,
|
||||
SEMICOLON = 305,
|
||||
TAG = 306,
|
||||
TAG_ANY = 307,
|
||||
TAG_NONE = 308,
|
||||
INT = 309,
|
||||
PERCENT_PARAM = 310,
|
||||
PERCENT_UNION = 311,
|
||||
PERCENT_EMPTY = 312
|
||||
PERCENT_GPREC = 270,
|
||||
PERCENT_PRECR = 271,
|
||||
PERCENT_MERGE = 272,
|
||||
PERCENT_CODE = 273,
|
||||
PERCENT_DEFAULT_PREC = 274,
|
||||
PERCENT_DEFINE = 275,
|
||||
PERCENT_DEFINES = 276,
|
||||
PERCENT_ERROR_VERBOSE = 277,
|
||||
PERCENT_EXPECT = 278,
|
||||
PERCENT_EXPECT_RR = 279,
|
||||
PERCENT_FLAG = 280,
|
||||
PERCENT_FILE_PREFIX = 281,
|
||||
PERCENT_GLR_PARSER = 282,
|
||||
PERCENT_INITIAL_ACTION = 283,
|
||||
PERCENT_LANGUAGE = 284,
|
||||
PERCENT_NAME_PREFIX = 285,
|
||||
PERCENT_NO_DEFAULT_PREC = 286,
|
||||
PERCENT_NO_LINES = 287,
|
||||
PERCENT_NONDETERMINISTIC_PARSER = 288,
|
||||
PERCENT_OUTPUT = 289,
|
||||
PERCENT_REQUIRE = 290,
|
||||
PERCENT_SKELETON = 291,
|
||||
PERCENT_START = 292,
|
||||
PERCENT_TOKEN_TABLE = 293,
|
||||
PERCENT_VERBOSE = 294,
|
||||
PERCENT_YACC = 295,
|
||||
BRACED_CODE = 296,
|
||||
BRACED_PREDICATE = 297,
|
||||
BRACKETED_ID = 298,
|
||||
CHAR = 299,
|
||||
EPILOGUE = 300,
|
||||
EQUAL = 301,
|
||||
ID = 302,
|
||||
ID_COLON = 303,
|
||||
PERCENT_PERCENT = 304,
|
||||
PIPE = 305,
|
||||
PROLOGUE = 306,
|
||||
SEMICOLON = 307,
|
||||
GT = 308,
|
||||
TAG = 309,
|
||||
TAG_ANY = 310,
|
||||
TAG_NONE = 311,
|
||||
LBRACE = 312,
|
||||
RBRACE = 313,
|
||||
INT = 314,
|
||||
PERCENT_PARAM = 315,
|
||||
PERCENT_UNION = 316,
|
||||
PERCENT_EMPTY = 317
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -135,27 +140,29 @@ extern int gram_debug;
|
||||
typedef union GRAM_STYPE GRAM_STYPE;
|
||||
union GRAM_STYPE
|
||||
{
|
||||
#line 182 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
#line 187 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
unsigned char character;
|
||||
#line 186 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
char *code;
|
||||
#line 191 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
char *code;
|
||||
#line 196 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
uniqstr uniqstr;
|
||||
#line 199 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
#line 204 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
int integer;
|
||||
#line 203 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
symbol *symbol;
|
||||
#line 208 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
symbol *symbol;
|
||||
#line 213 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
assoc assoc;
|
||||
#line 211 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
#line 216 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
symbol_list *list;
|
||||
#line 214 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
#line 219 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
named_ref *named_ref;
|
||||
#line 241 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
#line 224 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
prec_rel_comparator prec_rel_comparator;
|
||||
#line 253 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
param_type param;
|
||||
#line 409 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
#line 423 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
code_props_type code_type;
|
||||
#line 647 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
#line 725 "src/parse-gram.y" /* yacc.c:1909 */
|
||||
|
||||
struct
|
||||
{
|
||||
@@ -163,7 +170,7 @@ code_props_type code_type;
|
||||
muscle_kind kind;
|
||||
} value;
|
||||
|
||||
#line 167 "src/parse-gram.h" /* yacc.c:1909 */
|
||||
#line 174 "src/parse-gram.h" /* yacc.c:1909 */
|
||||
};
|
||||
# define GRAM_STYPE_IS_TRIVIAL 1
|
||||
# define GRAM_STYPE_IS_DECLARED 1
|
||||
|
||||
@@ -130,6 +130,8 @@
|
||||
|
||||
%token PERCENT_PREC "%prec"
|
||||
%token PERCENT_DPREC "%dprec"
|
||||
%token PERCENT_GPREC "%gprec"
|
||||
%token PERCENT_PRECR "%precr"
|
||||
%token PERCENT_MERGE "%merge"
|
||||
|
||||
/*----------------------.
|
||||
@@ -175,9 +177,12 @@
|
||||
%token PIPE "|"
|
||||
%token PROLOGUE "%{...%}"
|
||||
%token SEMICOLON ";"
|
||||
%token GT ">"
|
||||
%token TAG "<tag>"
|
||||
%token TAG_ANY "<*>"
|
||||
%token TAG_NONE "<>"
|
||||
%token LBRACE "{"
|
||||
%token RBRACE "}"
|
||||
|
||||
%union {unsigned char character;}
|
||||
%type <character> CHAR
|
||||
@@ -214,6 +219,13 @@
|
||||
%union {named_ref *named_ref;}
|
||||
%type <named_ref> named_ref.opt
|
||||
|
||||
%type <uniqstr> prec_group_name.opt string_or_id
|
||||
|
||||
%union {prec_rel_comparator prec_rel_comparator;}
|
||||
%type <prec_rel_comparator> prec_rel_comparator
|
||||
|
||||
%type <list> precedence_relation_symbols precedence_symbol
|
||||
|
||||
/*---------.
|
||||
| %param. |
|
||||
`---------*/
|
||||
@@ -365,6 +377,8 @@ params:
|
||||
|
||||
grammar_declaration:
|
||||
precedence_declaration
|
||||
| precedence_group_declaration
|
||||
| precedence_relation_declaration
|
||||
| symbol_declaration
|
||||
| "%start" symbol
|
||||
{
|
||||
@@ -457,6 +471,30 @@ symbol_declaration:
|
||||
}
|
||||
;
|
||||
|
||||
/* A group of symbols for precedence declaration */
|
||||
precedence_group_declaration:
|
||||
"%gprec" prec_group_name.opt
|
||||
{
|
||||
set_current_group ($2, &@2);
|
||||
}
|
||||
"{" precedence_declarations "}"
|
||||
{
|
||||
set_current_group (DEFAULT_GROUP_NAME, NULL);
|
||||
}
|
||||
;
|
||||
|
||||
/* Name for the precedence group. If none is present a new unique one is
|
||||
generated. */
|
||||
prec_group_name.opt:
|
||||
%empty { $$ = new_anonymous_group_name (); }
|
||||
| variable /* Just a string, maybe there's a better way? */
|
||||
;
|
||||
|
||||
precedence_declarations:
|
||||
precedence_declaration
|
||||
| precedence_declarations precedence_declaration
|
||||
;
|
||||
|
||||
precedence_declaration:
|
||||
precedence_declarator tag.opt symbols.prec
|
||||
{
|
||||
@@ -484,6 +522,46 @@ tag.opt:
|
||||
| TAG { current_type = $1; tag_seen = true; }
|
||||
;
|
||||
|
||||
/* Declaration of a precedence relation between two (lists of) tokens */
|
||||
precedence_relation_declaration:
|
||||
"%precr" precedence_relation_symbols
|
||||
{ prec_braces = default_braces_state; }
|
||||
prec_rel_comparator
|
||||
precedence_relation_symbols
|
||||
{ declare_precedence_relation ($2, $5, $4, @4); }
|
||||
;
|
||||
|
||||
precedence_relation_symbols:
|
||||
precedence_symbol { $$ = $1; }
|
||||
| precedence_relation_symbols precedence_symbol
|
||||
{ $$ = symbol_list_append ($1, $2); }
|
||||
;
|
||||
|
||||
precedence_symbol:
|
||||
string_or_id
|
||||
{
|
||||
if (is_prec_group ($1))
|
||||
$$ = expand_symbol_group (symgroup_from_uniqstr($1, &@1), @1);
|
||||
else
|
||||
$$ = symbol_list_sym_new (symbol_from_uniqstr ($1, @1), @1);
|
||||
}
|
||||
| CHAR
|
||||
{
|
||||
$$ = symbol_list_sym_new (symbol_from_uniqstr (uniqstr_new (char_name ($1)), @1), @1);
|
||||
}
|
||||
;
|
||||
|
||||
string_or_id:
|
||||
STRING { $$ = uniqstr_new (quotearg_style (c_quoting_style, $1)); }
|
||||
| ID { $$ = $1; }
|
||||
;
|
||||
|
||||
prec_rel_comparator:
|
||||
">" { $$ = prec_superior; }
|
||||
| "=" { $$ = prec_equal; }
|
||||
| ">" ">" { $$ = prec_superior_strict; }
|
||||
;
|
||||
|
||||
/* Just like symbols.1 but accept INT for the sake of POSIX. */
|
||||
symbols.prec:
|
||||
symbol.prec
|
||||
|
||||
+2
-1
@@ -392,7 +392,8 @@ print_grammar (FILE *out, int level)
|
||||
{
|
||||
char const *tag = symbols[token_translations[i]]->tag;
|
||||
int precedence = symbols[token_translations[i]]->content->prec;
|
||||
assoc associativity = symbols[token_translations[i]]->content->assoc;
|
||||
assoc associativity = symbols[token_translations[i]]->content->prec_node
|
||||
->assoc;
|
||||
xml_indent (out, level + 2);
|
||||
fprintf (out,
|
||||
"<terminal symbol-number=\"%d\" token-number=\"%d\""
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ record_merge_function_type (int merger, uniqstr type, location declaration_loc)
|
||||
if (merge_function->type != NULL && !UNIQSTR_EQ (merge_function->type, type))
|
||||
{
|
||||
unsigned indent = 0;
|
||||
start_complain_indent (&declaration_loc, complaint, &indent,
|
||||
complain_indent (&declaration_loc, complaint, &indent,
|
||||
_("result type clash on merge function %s: "
|
||||
"<%s> != <%s>"),
|
||||
quote (merge_function->name), type,
|
||||
|
||||
+8
-11
@@ -335,7 +335,7 @@ show_sub_message (warnings warning,
|
||||
const char *at_spec = get_at_spec (var->symbol_index);
|
||||
|
||||
if (var->err == 0)
|
||||
start_complain_indent (&var->loc, warning, &indent,
|
||||
complain_indent (&var->loc, warning, &indent,
|
||||
_("refers to: %c%s at %s"), dollar_or_at,
|
||||
var->id, at_spec);
|
||||
else
|
||||
@@ -372,7 +372,7 @@ show_sub_message (warnings warning,
|
||||
_(", cannot be accessed from mid-rule action at $%d"),
|
||||
midrule_rhs_index);
|
||||
|
||||
start_complain_indent (&id_loc, warning, &indent, "%s",
|
||||
complain_indent (&id_loc, warning, &indent, "%s",
|
||||
obstack_finish0 (&msg_buf));
|
||||
obstack_free (&msg_buf, 0);
|
||||
}
|
||||
@@ -515,7 +515,7 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
||||
cp_end - cp : ref_tail_fields - cp;
|
||||
unsigned indent = 0;
|
||||
|
||||
start_complain_indent (&text_loc, complaint, &indent,
|
||||
complain_indent (&text_loc, complaint, &indent,
|
||||
_("invalid reference: %s"), quote (text));
|
||||
indent += SUB_INDENT;
|
||||
if (len == 0)
|
||||
@@ -523,18 +523,18 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
||||
location sym_loc = text_loc;
|
||||
sym_loc.start.column += 1;
|
||||
sym_loc.end = sym_loc.start;
|
||||
start_complain_indent (&sym_loc, complaint, &indent,
|
||||
complain_indent (&sym_loc, complaint, &indent,
|
||||
_("syntax error after '%c', expecting integer, "
|
||||
"letter, '_', '[', or '$'"),
|
||||
dollar_or_at);
|
||||
}
|
||||
else if (midrule_rhs_index)
|
||||
start_complain_indent (&rule->location, complaint, &indent,
|
||||
complain_indent (&rule->location, complaint, &indent,
|
||||
_("symbol not found in production before $%d: "
|
||||
"%.*s"),
|
||||
midrule_rhs_index, len, cp);
|
||||
else
|
||||
start_complain_indent (&rule->location, complaint, &indent,
|
||||
complain_indent (&rule->location, complaint, &indent,
|
||||
_("symbol not found in production: %.*s"),
|
||||
len, cp);
|
||||
|
||||
@@ -542,7 +542,6 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
||||
show_sub_messages (complaint,
|
||||
cp, explicit_bracketing, midrule_rhs_index,
|
||||
dollar_or_at, indent);
|
||||
finish_complaint ();
|
||||
return INVALID_REF;
|
||||
}
|
||||
case 1:
|
||||
@@ -550,12 +549,11 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
||||
unsigned indent = 0;
|
||||
if (variant_count > 1)
|
||||
{
|
||||
start_complain_indent (&text_loc, Wother, &indent,
|
||||
complain_indent (&text_loc, Wother, &indent,
|
||||
_("misleading reference: %s"), quote (text));
|
||||
show_sub_messages (Wother,
|
||||
cp, explicit_bracketing, midrule_rhs_index,
|
||||
dollar_or_at, indent + SUB_INDENT);
|
||||
finish_complaint ();
|
||||
}
|
||||
{
|
||||
unsigned symbol_index =
|
||||
@@ -567,12 +565,11 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
||||
default:
|
||||
{
|
||||
unsigned indent = 0;
|
||||
start_complain_indent (&text_loc, complaint, &indent,
|
||||
complain_indent (&text_loc, complaint, &indent,
|
||||
_("ambiguous reference: %s"), quote (text));
|
||||
show_sub_messages (complaint,
|
||||
cp, explicit_bracketing, midrule_rhs_index,
|
||||
dollar_or_at, indent + SUB_INDENT);
|
||||
finish_complaint ();
|
||||
return INVALID_REF;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,6 +223,10 @@ eqopt ([[:space:]]*=)?
|
||||
"%fixed-output-files" return PERCENT_YACC;
|
||||
"%initial-action" return PERCENT_INITIAL_ACTION;
|
||||
"%glr-parser" return PERCENT_GLR_PARSER;
|
||||
"%gprec" {
|
||||
prec_braces = gprec_seen;
|
||||
return PERCENT_GPREC;
|
||||
}
|
||||
"%language" return PERCENT_LANGUAGE;
|
||||
"%left" return PERCENT_LEFT;
|
||||
"%lex-param" RETURN_PERCENT_PARAM(lex);
|
||||
@@ -239,6 +243,7 @@ eqopt ([[:space:]]*=)?
|
||||
"%parse-param" RETURN_PERCENT_PARAM(parse);
|
||||
"%prec" return PERCENT_PREC;
|
||||
"%precedence" return PERCENT_PRECEDENCE;
|
||||
"%precr" return PERCENT_PRECR;
|
||||
"%printer" return PERCENT_PRINTER;
|
||||
"%pure-parser" RETURN_PERCENT_FLAG("api.pure");
|
||||
"%require" return PERCENT_REQUIRE;
|
||||
@@ -273,10 +278,17 @@ eqopt ([[:space:]]*=)?
|
||||
"=" return EQUAL;
|
||||
"|" return PIPE;
|
||||
";" return SEMICOLON;
|
||||
"}" return RBRACE;
|
||||
">" return GT;
|
||||
|
||||
{id} {
|
||||
val->uniqstr = uniqstr_new (yytext);
|
||||
id_loc = *loc;
|
||||
if (prec_braces == gprec_seen)
|
||||
{
|
||||
prec_braces = group_name_seen;
|
||||
return ID;
|
||||
}
|
||||
bracketed_id_str = NULL;
|
||||
BEGIN SC_AFTER_IDENTIFIER;
|
||||
}
|
||||
@@ -307,6 +319,11 @@ eqopt ([[:space:]]*=)?
|
||||
|
||||
/* Code in between braces. */
|
||||
"{" {
|
||||
if (prec_braces == gprec_seen || prec_braces == group_name_seen)
|
||||
{
|
||||
prec_braces = braces_seen;
|
||||
return LBRACE;
|
||||
}
|
||||
STRING_GROW;
|
||||
nesting = 0;
|
||||
code_start = loc->start;
|
||||
|
||||
+486
-15
@@ -26,6 +26,7 @@
|
||||
#include "complain.h"
|
||||
#include "gram.h"
|
||||
#include "symtab.h"
|
||||
#include "symlist.h"
|
||||
|
||||
/*-------------------------------------------------------------------.
|
||||
| Symbols sorted by tag. Allocated by the first invocation of |
|
||||
@@ -58,6 +59,305 @@ static symgraph **prec_nodes;
|
||||
|
||||
bool *used_assoc = NULL;
|
||||
|
||||
/*-------------------------------------------------------------.
|
||||
| The current precedence group of symbols. Used by the parser. |
|
||||
`-------------------------------------------------------------*/
|
||||
|
||||
static symgroup *current_group = NULL;
|
||||
|
||||
/*-------------------------------------------------------.
|
||||
| The list of symbols declared in the current statement. |
|
||||
`-------------------------------------------------------*/
|
||||
|
||||
static symbol_list *current_prec_declaration = NULL;
|
||||
|
||||
/*-------------------------------------------------.
|
||||
| A counter to distinguish precedence declarations |
|
||||
`-------------------------------------------------*/
|
||||
|
||||
static int current_prec_level = 0;
|
||||
|
||||
/*-----------------------------.
|
||||
| Constructor for a prec_link. |
|
||||
`-----------------------------*/
|
||||
|
||||
static prec_link *
|
||||
prec_link_new (prec_node *to, bool transitive)
|
||||
{
|
||||
prec_link *res = malloc (sizeof *res);
|
||||
res->target = to;
|
||||
res->transitive = transitive;
|
||||
res->next = NULL;
|
||||
return res;
|
||||
}
|
||||
|
||||
/*-------------------------------------.
|
||||
| Destructor for a simple symbol list. |
|
||||
`-------------------------------------*/
|
||||
|
||||
static void
|
||||
symbol_list_prec_free (symbol_list *l)
|
||||
{
|
||||
if (l)
|
||||
{
|
||||
symbol_list_prec_free (l->next);
|
||||
free (l);
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------.
|
||||
| Check if PARENT has a higher priority than SON. |
|
||||
`------------------------------------------------*/
|
||||
|
||||
bool
|
||||
is_prec_superior (prec_node *parent, prec_node *son)
|
||||
{
|
||||
prec_link *l;
|
||||
for (l = parent->sons; l; l = l->next)
|
||||
if (l->target == son)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*-----------------------------------------.
|
||||
| Check if S1 has the same priority as S2. |
|
||||
`-----------------------------------------*/
|
||||
|
||||
bool
|
||||
is_prec_equal (prec_node *s1, prec_node *s2)
|
||||
{
|
||||
prec_link *l;
|
||||
if (s1 == s2)
|
||||
return true;
|
||||
for (l = s1->equals; l; l = l->next)
|
||||
if (l->target == s2)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void
|
||||
complain_contradicting_prec (location *loc, uniqstr s1, uniqstr s2, char c1,
|
||||
char c2)
|
||||
{
|
||||
complain (loc, Wprecedence, _("contradicting declaration: %s %c %s is in "
|
||||
"conflict with the previous declaration: %s %c %s"), s1, c1, s2,
|
||||
s1, c2, s2);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------.
|
||||
| Compare LINK with TARGET, and return whether they are equal. |
|
||||
| In case of equality, complain of the duplicate precedence declaration. |
|
||||
`-----------------------------------------------------------------------*/
|
||||
|
||||
static inline bool
|
||||
is_prec_target (prec_node *l, prec_node *target, uniqstr from, char c,
|
||||
location loc)
|
||||
{
|
||||
if (l == target)
|
||||
{
|
||||
complain (&loc, Wprecedence, _("duplicate declaration of the precedence "
|
||||
"relationship %s %c %s"), from, c,
|
||||
target->symbol->tag);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*-----------------------------------------.
|
||||
| Add a precedence relationship FROM > TO. |
|
||||
`-----------------------------------------*/
|
||||
|
||||
static void
|
||||
add_prec_link (prec_node *from, prec_node *to, bool transitive, location loc)
|
||||
{
|
||||
if (is_prec_superior (to, from))
|
||||
complain_contradicting_prec(&loc, from->symbol->tag, to->symbol->tag,
|
||||
'>', '<');
|
||||
else if (is_prec_equal (from, to))
|
||||
complain_contradicting_prec(&loc, from->symbol->tag, to->symbol->tag,
|
||||
'>', '=');
|
||||
else
|
||||
{
|
||||
if (from->sons)
|
||||
{
|
||||
if (is_prec_target (from->sons->target, to, from->symbol->tag, '>',
|
||||
loc))
|
||||
return;
|
||||
|
||||
prec_link *son = from->sons;
|
||||
for (; son->next; son = son->next)
|
||||
if (is_prec_target (son->next->target, to, from->symbol->tag, '>',
|
||||
loc))
|
||||
return;
|
||||
son->next = prec_link_new (to, transitive);
|
||||
}
|
||||
else
|
||||
from->sons = prec_link_new (to, transitive);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------.
|
||||
| Add a precedence relationship S1 == S2, one way. |
|
||||
`-------------------------------------------------*/
|
||||
|
||||
static void
|
||||
create_prec_equal_link (prec_node *s1, prec_node *s2, bool transitive,
|
||||
location loc)
|
||||
{
|
||||
if (s1->equals)
|
||||
{
|
||||
if (is_prec_target (s1->equals->target, s2, s1->symbol->tag, '=',
|
||||
loc))
|
||||
return;
|
||||
prec_link *eq = s1->equals;
|
||||
for (; eq->next; eq = eq->next)
|
||||
if (is_prec_target (eq->next->target, s2, s1->symbol->tag, '=',
|
||||
loc))
|
||||
return;
|
||||
eq->next = prec_link_new (s2, transitive);
|
||||
}
|
||||
else
|
||||
s1->equals = prec_link_new (s2, transitive);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------.
|
||||
| Add a precedence relationship S1 == S2, both ways. |
|
||||
`---------------------------------------------------*/
|
||||
|
||||
static void
|
||||
add_prec_equal_link (prec_node *s1, prec_node *s2, bool transitive,
|
||||
location loc)
|
||||
{
|
||||
if (is_prec_superior (s2, s1))
|
||||
complain_contradicting_prec(&loc, s1->symbol->tag, s2->symbol->tag,
|
||||
'=', '>');
|
||||
else if (is_prec_superior (s1, s2))
|
||||
complain_contradicting_prec(&loc, s1->symbol->tag, s2->symbol->tag,
|
||||
'=', '<');
|
||||
create_prec_equal_link (s1, s2, transitive, loc);
|
||||
create_prec_equal_link (s2, s1, transitive, loc);
|
||||
}
|
||||
|
||||
|
||||
/* The function to use to register \a c type relations. */
|
||||
typedef void (*add_link_t) (prec_node *, prec_node *, bool, location);
|
||||
static add_link_t
|
||||
add_link_function (prec_rel_comparator c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case prec_superior_strict:
|
||||
case prec_superior:
|
||||
return &add_prec_link;
|
||||
case prec_equal:
|
||||
return &add_prec_equal_link;
|
||||
}
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------.
|
||||
| Handle the precedence declaration between the elements of S1 and S2. |
|
||||
`---------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
declare_precedence_relation (symbol_list *s1, symbol_list *s2,
|
||||
prec_rel_comparator c, location loc)
|
||||
{
|
||||
void (*functionPtr) (prec_node *, prec_node *, bool, location)
|
||||
= add_link_function (c);
|
||||
bool transitive = c != prec_superior_strict;
|
||||
for (symbol_list *l1 = s1; l1; l1 = l1->next)
|
||||
for (symbol_list *l2 = s2; l2; l2 = l2->next)
|
||||
(*functionPtr)(l1->content.sym->content->prec_node,
|
||||
l2->content.sym->content->prec_node, transitive, loc);
|
||||
symbol_list_free (s1);
|
||||
symbol_list_free (s2);
|
||||
}
|
||||
|
||||
/*----------------------------------------------.
|
||||
| Get the list of symbols contained in a group. |
|
||||
`----------------------------------------------*/
|
||||
|
||||
symbol_list *
|
||||
expand_symbol_group (symgroup *group, location loc)
|
||||
{
|
||||
symbol_list *l = NULL;
|
||||
for (sym_content *s = group->symbol_list; s; s = s->group_next)
|
||||
l = symbol_list_append (l, symbol_list_sym_new (s->symbol, loc));
|
||||
return l;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------.
|
||||
| Add a symbol to the current declaration group, and declare the implicit |
|
||||
| precedence links. SAME_LINE is true if the symbol was declared in the |
|
||||
| same statement as the previous one (same precedence level). |
|
||||
`------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
add_to_current_group (sym_content *s, bool same_line)
|
||||
{
|
||||
if (!same_line)
|
||||
for (symbol_list *l = current_prec_declaration; l; l = l->next)
|
||||
{
|
||||
sym_content *symb = l->content.sym->content;
|
||||
if (!current_group->symbol_list)
|
||||
current_group->symbol_list = symb;
|
||||
else
|
||||
{
|
||||
sym_content *sym = current_group->symbol_list;
|
||||
while (sym->group_next)
|
||||
sym = sym->group_next;
|
||||
sym->group_next = symb;
|
||||
}
|
||||
}
|
||||
|
||||
if (current_group->symbol_list)
|
||||
for (sym_content *sym = current_group->symbol_list; sym;
|
||||
sym = sym->group_next)
|
||||
add_prec_link (s->prec_node, sym->prec_node, true,
|
||||
s->prec_node->prec_location);
|
||||
|
||||
if (!same_line)
|
||||
{
|
||||
symbol_list_prec_free (current_prec_declaration);
|
||||
current_prec_declaration = malloc (sizeof *current_prec_declaration);
|
||||
current_prec_declaration->content.sym = s->symbol;
|
||||
current_prec_declaration->next = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
symbol_list *l = current_prec_declaration;
|
||||
for (; true; l = l->next)
|
||||
{
|
||||
add_prec_equal_link (s->prec_node, l->content.sym->content->prec_node,
|
||||
true, s->prec_node->prec_location);
|
||||
if (!l->next)
|
||||
break;
|
||||
}
|
||||
l->next = malloc (sizeof *l->next);
|
||||
l->next->content.sym = s->symbol;
|
||||
l->next->next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------.
|
||||
| Create a new prec_node for the symbol s. |
|
||||
`-----------------------------------------*/
|
||||
|
||||
static prec_node *
|
||||
prec_node_new (symbol * s)
|
||||
{
|
||||
prec_node * res = malloc (sizeof *res);
|
||||
res->symbol = s;
|
||||
res->assoc = undef_assoc;
|
||||
res->sons = NULL;
|
||||
res-> equals = NULL;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------.
|
||||
| Create a new sym_content. |
|
||||
`--------------------------*/
|
||||
@@ -78,12 +378,14 @@ sym_content_new (symbol *s)
|
||||
|
||||
res->number = NUMBER_UNDEFINED;
|
||||
res->prec = 0;
|
||||
res->assoc = undef_assoc;
|
||||
res->user_token_number = USER_NUMBER_UNDEFINED;
|
||||
|
||||
res->class = unknown_sym;
|
||||
res->status = undeclared;
|
||||
|
||||
res->group_next = NULL;
|
||||
res->prec_node = prec_node_new (s);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -105,6 +407,7 @@ symbol_new (uniqstr tag, location loc)
|
||||
|
||||
res->tag = tag;
|
||||
res->location = loc;
|
||||
|
||||
res->alias = NULL;
|
||||
res->content = sym_content_new (res);
|
||||
res->is_alias = false;
|
||||
@@ -116,6 +419,28 @@ symbol_new (uniqstr tag, location loc)
|
||||
return res;
|
||||
}
|
||||
|
||||
void
|
||||
prec_link_free (prec_link * l)
|
||||
{
|
||||
if (l)
|
||||
{
|
||||
prec_link_free (l->next);
|
||||
free (l);
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------.
|
||||
| Free one prec_node. |
|
||||
`--------------------*/
|
||||
|
||||
static void
|
||||
prec_node_free (prec_node * n)
|
||||
{
|
||||
prec_link_free (n->sons);
|
||||
prec_link_free (n->equals);
|
||||
free (n);
|
||||
}
|
||||
|
||||
/*--------------------.
|
||||
| Free a sym_content. |
|
||||
`--------------------*/
|
||||
@@ -123,6 +448,7 @@ symbol_new (uniqstr tag, location loc)
|
||||
static void
|
||||
sym_content_free (sym_content *sym)
|
||||
{
|
||||
prec_node_free (sym->prec_node);
|
||||
free (sym);
|
||||
}
|
||||
|
||||
@@ -250,7 +576,7 @@ symbol_redeclaration (symbol *s, const char *what, location first,
|
||||
location second)
|
||||
{
|
||||
unsigned i = 0;
|
||||
start_complain_indent (&second, complaint, &i,
|
||||
complain_indent (&second, complaint, &i,
|
||||
_("%s redeclaration for %s"), what, s->tag);
|
||||
i += SUB_INDENT;
|
||||
complain_indent (&first, complaint, &i,
|
||||
@@ -262,7 +588,7 @@ semantic_type_redeclaration (semantic_type *s, const char *what, location first,
|
||||
location second)
|
||||
{
|
||||
unsigned i = 0;
|
||||
start_complain_indent (&second, complaint, &i,
|
||||
complain_indent (&second, complaint, &i,
|
||||
_("%s redeclaration for <%s>"), what, s->tag);
|
||||
i += SUB_INDENT;
|
||||
complain_indent (&first, complaint, &i,
|
||||
@@ -367,14 +693,16 @@ symbol_precedence_set (symbol *sym, int prec, assoc a, location loc)
|
||||
sym_content *s = sym->content;
|
||||
if (a != undef_assoc)
|
||||
{
|
||||
if (s->prec)
|
||||
if (s->prec_node->assoc != undef_assoc)
|
||||
symbol_redeclaration (sym, assoc_to_string (a),
|
||||
s->prec_location, loc);
|
||||
s->prec_node->prec_location, loc);
|
||||
else
|
||||
{
|
||||
s->prec = prec;
|
||||
s->assoc = a;
|
||||
s->prec_location = loc;
|
||||
s->prec_node->assoc = a;
|
||||
s->prec_node->prec_location = loc;
|
||||
add_to_current_group (s, prec == current_prec_level);
|
||||
current_prec_level = prec;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,7 +909,7 @@ user_token_number_redeclaration (int num, symbol *first, symbol *second)
|
||||
first = second;
|
||||
second = tmp;
|
||||
}
|
||||
start_complain_indent (&second->location, complaint, &i,
|
||||
complain_indent (&second->location, complaint, &i,
|
||||
_("user token number %d redeclaration for %s"),
|
||||
num, second->tag);
|
||||
i += SUB_INDENT;
|
||||
@@ -684,6 +1012,38 @@ hash_semantic_type_hasher (void const *m, size_t tablesize)
|
||||
return hash_semantic_type (m, tablesize);
|
||||
}
|
||||
|
||||
/*-------------------------------------.
|
||||
| Symbol precedence group hash table. |
|
||||
`-------------------------------------*/
|
||||
|
||||
static struct hash_table *group_table = NULL;
|
||||
|
||||
static inline bool
|
||||
hash_compare_group (const symgroup *m1, const symgroup *m2)
|
||||
{
|
||||
/* Since tags are unique, we can compare the pointers themselves. */
|
||||
return UNIQSTR_EQ (m1->tag, m2->tag);
|
||||
}
|
||||
|
||||
static bool
|
||||
hash_group_comparator (void const *m1, void const *m2)
|
||||
{
|
||||
return hash_compare_group (m1, m2);
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
hash_group (const symgroup *m, size_t tablesize)
|
||||
{
|
||||
/* Since tags are unique, we can hash the pointer itself. */
|
||||
return ((uintptr_t) m->tag) % tablesize;
|
||||
}
|
||||
|
||||
static size_t
|
||||
hash_group_hasher (void const *m, size_t tablesize)
|
||||
{
|
||||
return hash_group (m, tablesize);
|
||||
}
|
||||
|
||||
/*-------------------------------.
|
||||
| Create the symbol hash table. |
|
||||
`-------------------------------*/
|
||||
@@ -701,6 +1061,12 @@ symbols_new (void)
|
||||
hash_semantic_type_hasher,
|
||||
hash_semantic_type_comparator,
|
||||
free);
|
||||
group_table = hash_initialize (HT_INITIAL_CAPACITY,
|
||||
NULL,
|
||||
hash_group_hasher,
|
||||
hash_group_comparator,
|
||||
free);
|
||||
set_current_group (DEFAULT_GROUP_NAME, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -815,9 +1181,11 @@ symbols_free (void)
|
||||
{
|
||||
hash_free (symbol_table);
|
||||
hash_free (semantic_type_table);
|
||||
hash_free (group_table);
|
||||
free (symbols);
|
||||
free (symbols_sorted);
|
||||
free (semantic_types_sorted);
|
||||
symbol_list_prec_free (current_prec_declaration);
|
||||
}
|
||||
|
||||
|
||||
@@ -1102,8 +1470,8 @@ static inline bool
|
||||
is_assoc_useless (symbol *s)
|
||||
{
|
||||
return s
|
||||
&& s->content->assoc != undef_assoc
|
||||
&& s->content->assoc != precedence_assoc
|
||||
&& s->content->prec_node->assoc != undef_assoc
|
||||
&& s->content->prec_node->assoc != precedence_assoc
|
||||
&& !used_assoc[s->content->number];
|
||||
}
|
||||
|
||||
@@ -1136,21 +1504,124 @@ print_precedence_warnings (void)
|
||||
{
|
||||
symbol *s = symbols[i];
|
||||
if (s
|
||||
&& s->content->prec != 0
|
||||
&& !prec_nodes[i]->pred
|
||||
&& !prec_nodes[i]->succ)
|
||||
{
|
||||
if (is_assoc_useless (s))
|
||||
complain (&s->content->prec_location, Wprecedence,
|
||||
complain (&s->content->prec_node->prec_location, Wprecedence,
|
||||
_("useless precedence and associativity for %s"), s->tag);
|
||||
else if (s->content->assoc == precedence_assoc)
|
||||
complain (&s->content->prec_location, Wprecedence,
|
||||
else if (s->content->prec_node->assoc == precedence_assoc)
|
||||
complain (&s->content->prec_node->prec_location, Wprecedence,
|
||||
_("useless precedence for %s"), s->tag);
|
||||
}
|
||||
else if (is_assoc_useless (s))
|
||||
complain (&s->content->prec_location, Wprecedence,
|
||||
complain (&s->content->prec_node->prec_location, Wprecedence,
|
||||
_("useless associativity for %s, use %%precedence"), s->tag);
|
||||
}
|
||||
free (used_assoc);
|
||||
assoc_free ();
|
||||
}
|
||||
|
||||
/*------------------------------------------------.
|
||||
| Counter to create unique anonymous group names. |
|
||||
`------------------------------------------------*/
|
||||
|
||||
static unsigned int anon_group_counter = 0;
|
||||
|
||||
/*-------------------------------------------------.
|
||||
| Return a new unique name for an anonymous group. |
|
||||
`-------------------------------------------------*/
|
||||
|
||||
uniqstr new_anonymous_group_name (void)
|
||||
{
|
||||
char buff[20];
|
||||
snprintf (buff, 20, "__anon%u__", anon_group_counter++);
|
||||
return uniqstr_new (buff);
|
||||
}
|
||||
|
||||
/*-------------------------------------------.
|
||||
| Constructor for a symbol precedence group. |
|
||||
`-------------------------------------------*/
|
||||
|
||||
symgroup *
|
||||
symgroup_new (const uniqstr tag, location loc)
|
||||
{
|
||||
symgroup *group = xmalloc (sizeof (*group));
|
||||
group->tag = tag;
|
||||
group->symbol_list = NULL;
|
||||
group->location = loc;
|
||||
return group;
|
||||
}
|
||||
|
||||
/*----------------------------------------.
|
||||
| Check if there is a group by that name. |
|
||||
`----------------------------------------*/
|
||||
|
||||
bool
|
||||
is_prec_group (const uniqstr key)
|
||||
{
|
||||
symgroup probe;
|
||||
symgroup *entry;
|
||||
probe.tag = key;
|
||||
entry = hash_lookup (group_table, &probe);
|
||||
return entry != NULL;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------.
|
||||
| Get the symbol precedence group by that name. If not present, a new group |
|
||||
| is created and inserted in the table, with the location information |
|
||||
| provided, if any. |
|
||||
`--------------------------------------------------------------------------*/
|
||||
|
||||
symgroup *
|
||||
symgroup_from_uniqstr (const uniqstr key, location *loc)
|
||||
{
|
||||
bool null_loc = loc == NULL;
|
||||
if (null_loc)
|
||||
{
|
||||
loc = malloc (sizeof *loc);
|
||||
boundary_set (&loc->start, uniqstr_new (""), 1, 1);
|
||||
boundary_set (&loc->end, uniqstr_new (""), 1, 1);
|
||||
}
|
||||
symgroup probe;
|
||||
symgroup *entry;
|
||||
|
||||
probe.tag = key;
|
||||
entry = hash_lookup (group_table, &probe);
|
||||
|
||||
if (!entry)
|
||||
{
|
||||
/* First insertion in the hash. */
|
||||
entry = symgroup_new (key, *loc);
|
||||
if (!hash_insert (group_table, entry))
|
||||
xalloc_die ();
|
||||
}
|
||||
if (null_loc)
|
||||
free (loc);
|
||||
return entry;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------.
|
||||
| Change the current group to the one designated by the name, and create it |
|
||||
| if necessary. The location information is used for creation if available. |
|
||||
`--------------------------------------------------------------------------*/
|
||||
|
||||
void set_current_group (const uniqstr tag, location *loc)
|
||||
{
|
||||
for (symbol_list *l = current_prec_declaration; l; l = l->next)
|
||||
{
|
||||
sym_content *symb = l->content.sym->content;
|
||||
if (!current_group->symbol_list)
|
||||
current_group->symbol_list = symb;
|
||||
else
|
||||
{
|
||||
sym_content *sym = current_group->symbol_list;
|
||||
for (; sym->group_next; sym = sym->group_next)
|
||||
{}
|
||||
sym->group_next = symb;
|
||||
}
|
||||
}
|
||||
symbol_list_prec_free (current_prec_declaration);
|
||||
current_prec_declaration = NULL;
|
||||
current_group = symgroup_from_uniqstr (tag, loc);
|
||||
}
|
||||
|
||||
+99
-2
@@ -31,6 +31,8 @@
|
||||
# include "scan-code.h"
|
||||
# include "uniqstr.h"
|
||||
|
||||
typedef struct symbol_list symbol_list;
|
||||
|
||||
/*----------.
|
||||
| Symbols. |
|
||||
`----------*/
|
||||
@@ -62,6 +64,8 @@ typedef struct sym_content sym_content;
|
||||
When status are checked at the end, "declared" symbols are fine,
|
||||
"used" symbols trigger warnings, otherwise it's an error. */
|
||||
|
||||
typedef struct prec_node prec_node;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/** Used in the input file for an unknown reason (error). */
|
||||
@@ -125,13 +129,21 @@ struct sym_content
|
||||
code_props props[CODE_PROPS_SIZE];
|
||||
|
||||
symbol_number number;
|
||||
location prec_location;
|
||||
|
||||
/* Not used anymore, to remove. */
|
||||
int prec;
|
||||
assoc assoc;
|
||||
|
||||
int user_token_number;
|
||||
|
||||
symbol_class class;
|
||||
status status;
|
||||
|
||||
/* The next element in the symbol precedence group. */
|
||||
sym_content *group_next;
|
||||
|
||||
/* The graph node containing all the precedence information for this
|
||||
symbol. */
|
||||
prec_node *prec_node;
|
||||
};
|
||||
|
||||
/** Undefined user number. */
|
||||
@@ -286,6 +298,91 @@ void print_precedence_warnings (void);
|
||||
|
||||
void register_assoc (graphid i, graphid j);
|
||||
|
||||
|
||||
/*------------------.
|
||||
| Groups of symbols |
|
||||
`------------------*/
|
||||
|
||||
#define DEFAULT_GROUP_NAME uniqstr_new ("__default__")
|
||||
|
||||
typedef struct symgroup symgroup;
|
||||
|
||||
struct symgroup
|
||||
{
|
||||
/** The name of the group. */
|
||||
uniqstr tag;
|
||||
|
||||
/** The list of symbols in the group. */
|
||||
sym_content * symbol_list;
|
||||
|
||||
location location;
|
||||
} ;
|
||||
|
||||
/** Get a dummy name for an anonymous group. */
|
||||
uniqstr new_anonymous_group_name (void);
|
||||
|
||||
/** Set the current group in the token precedence declaration to a new group
|
||||
* with this name */
|
||||
void set_current_group (const uniqstr name, location *loc);
|
||||
|
||||
/** Get or create the group by that name. The location information is used for
|
||||
* creation when available. */
|
||||
symgroup *
|
||||
symgroup_from_uniqstr (const uniqstr key, location *loc);
|
||||
|
||||
/** Check if there is a symbol precedence group by that name. */
|
||||
bool
|
||||
is_prec_group (const uniqstr key);
|
||||
|
||||
|
||||
/*----------------------------------.
|
||||
| Graph of precedence relationships |
|
||||
`----------------------------------*/
|
||||
|
||||
typedef struct prec_link prec_link;
|
||||
|
||||
struct prec_link
|
||||
{
|
||||
prec_node *target;
|
||||
bool transitive;
|
||||
prec_link *next;
|
||||
};
|
||||
|
||||
struct prec_node
|
||||
{
|
||||
symbol *symbol;
|
||||
/** Associativity for the symbol. */
|
||||
assoc assoc;
|
||||
location prec_location;
|
||||
prec_link *sons;
|
||||
prec_link *equals;
|
||||
};
|
||||
|
||||
typedef enum prec_rel_comparator prec_rel_comparator;
|
||||
|
||||
enum prec_rel_comparator
|
||||
{
|
||||
prec_equal,
|
||||
prec_superior,
|
||||
prec_superior_strict,
|
||||
};
|
||||
|
||||
/** Declare a precedence relationship between the symbols of the two lists,
|
||||
* as defined by the operator. */
|
||||
void
|
||||
declare_precedence_relation (symbol_list *l1, symbol_list *l2,
|
||||
prec_rel_comparator c, location loc);
|
||||
/** Return the list of symbols contained in the group. */
|
||||
symbol_list *
|
||||
expand_symbol_group (symgroup * group, location loc);
|
||||
|
||||
/** Check if s1 and s2 have the same precedence level. */
|
||||
bool is_prec_equal (prec_node * s1, prec_node * s2);
|
||||
|
||||
/** Check if from > to . */
|
||||
bool is_prec_superior (prec_node * from, prec_node * to);
|
||||
|
||||
|
||||
/*-----------------.
|
||||
| Semantic types. |
|
||||
`-----------------*/
|
||||
|
||||
+4
-4
@@ -1385,8 +1385,8 @@ AT_BISON_OPTION_POPDEFS
|
||||
AT_BISON_CHECK([-o input.c input.y], 0,,
|
||||
[[input.y:24.70-72: warning: useless %destructor for type <*> [-Wother]
|
||||
input.y:24.70-72: warning: useless %printer for type <*> [-Wother]
|
||||
input.y:32.3-23: warning: unused value: $3 [-Wother]
|
||||
input.y:33.3-23: warning: unset value: $$ [-Wother]
|
||||
input.y:32.3-23: warning: unused value: $3 [-Wother]
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-fcaret -o input.c input.y], 0,,
|
||||
@@ -1396,12 +1396,12 @@ AT_BISON_CHECK([-fcaret -o input.c input.y], 0,,
|
||||
input.y:24.70-72: warning: useless %printer for type <*> [-Wother]
|
||||
%printer { fprintf (yyoutput, "<*> printer should not be called"); } <*>
|
||||
^^^
|
||||
input.y:32.3-23: warning: unused value: $3 [-Wother]
|
||||
{ USE ($$); @$ = 3; } // Only set.
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:33.3-23: warning: unset value: $$ [-Wother]
|
||||
{ @$ = 4; } // Only used.
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:32.3-23: warning: unused value: $3 [-Wother]
|
||||
{ USE ($$); @$ = 3; } // Only set.
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
]])
|
||||
|
||||
AT_COMPILE([input])
|
||||
|
||||
+169
-23
@@ -17,6 +17,152 @@
|
||||
|
||||
AT_BANNER([[Conflicts.]])
|
||||
|
||||
## ----------------- ##
|
||||
## Precedence groups ##
|
||||
## ----------------- ##
|
||||
|
||||
# Sample use case of precedence groups and relations, working.
|
||||
|
||||
AT_SETUP([Precedence groups])
|
||||
|
||||
AT_DATA_GRAMMAR([[input.y]],
|
||||
[[%token CARET "^"
|
||||
%token NUM BOOL '^' OR AND
|
||||
|
||||
%left '+' '-'
|
||||
%gprec {
|
||||
%right CARET
|
||||
}
|
||||
%gprec boolean {
|
||||
%left OR
|
||||
%left AND
|
||||
}
|
||||
%left '*' '/'
|
||||
|
||||
%precr boolean >> "^"
|
||||
%precr CARET > '*' '/' '-' '+'
|
||||
|
||||
%%
|
||||
|
||||
stmt:
|
||||
exp
|
||||
| bool_exp
|
||||
|
||||
exp:
|
||||
NUM
|
||||
| exp '+' exp
|
||||
| exp '-' exp
|
||||
| exp '*' exp
|
||||
| exp '/' exp
|
||||
| exp "^" exp
|
||||
|
||||
bool_exp:
|
||||
BOOL
|
||||
| bool_exp AND bool_exp
|
||||
| bool_exp OR bool_exp
|
||||
| bool_exp CARET bool_exp
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[--report=all -o input.c input.y]], 0, [])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
## -------------------------------- ##
|
||||
## Conflicting precedence relations ##
|
||||
## -------------------------------- ##
|
||||
|
||||
AT_SETUP([Conflicting precedence relations])
|
||||
|
||||
AT_DATA_GRAMMAR([[input.y]],
|
||||
[[%token TOKEN
|
||||
%precedence A
|
||||
%precedence B
|
||||
%precedence C
|
||||
%precedence D E
|
||||
|
||||
%gprec group {
|
||||
%precedence F
|
||||
%precedence G
|
||||
}
|
||||
|
||||
%precr B = C
|
||||
%precr A > B
|
||||
%precr C > B
|
||||
%precr F > G
|
||||
%precr F > A
|
||||
%%
|
||||
exp:
|
||||
TOKEN
|
||||
| exp A exp
|
||||
| exp B exp
|
||||
| exp C exp
|
||||
| exp D exp
|
||||
| exp E exp
|
||||
| exp F exp
|
||||
| exp G exp
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-Wall -o input.c input.y]], 0, [],
|
||||
[[input.y:20.10: warning: contradicting declaration: B = C is in conflict with the previous declaration: B > C [-Wprecedence]
|
||||
input.y:21.10: warning: contradicting declaration: A > B is in conflict with the previous declaration: A < B [-Wprecedence]
|
||||
input.y:22.10: warning: contradicting declaration: C > B is in conflict with the previous declaration: C = B [-Wprecedence]
|
||||
input.y:23.10: warning: contradicting declaration: F > G is in conflict with the previous declaration: F < G [-Wprecedence]
|
||||
input.y: warning: 27 shift/reduce conflicts [-Wconflicts-sr]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
## ------------------------------ ##
|
||||
## Duplicate precedence relations ##
|
||||
## ------------------------------ ##
|
||||
|
||||
AT_SETUP([Duplicate precedence relations])
|
||||
|
||||
AT_DATA_GRAMMAR([[input.y]],
|
||||
[[%token TOKEN
|
||||
%precedence A
|
||||
%precedence B
|
||||
%precedence C
|
||||
%precedence D E
|
||||
|
||||
%gprec group {
|
||||
%precedence F
|
||||
%precedence G
|
||||
}
|
||||
|
||||
%precr D = E
|
||||
%precr B > A
|
||||
%precr C > B
|
||||
%precr G > F
|
||||
%precr F > A
|
||||
%precr C > group
|
||||
%precr C > F
|
||||
%%
|
||||
exp:
|
||||
TOKEN
|
||||
| exp A exp
|
||||
| exp B exp
|
||||
| exp C exp
|
||||
| exp D exp
|
||||
| exp E exp
|
||||
| exp F exp
|
||||
| exp G exp
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-Wall -o input.c input.y]], 0, [],
|
||||
[[input.y:20.10: warning: duplicate declaration of the precedence relationship D = E [-Wprecedence]
|
||||
input.y:20.10: warning: duplicate declaration of the precedence relationship E = D [-Wprecedence]
|
||||
input.y:21.10: warning: duplicate declaration of the precedence relationship B > A [-Wprecedence]
|
||||
input.y:22.10: warning: duplicate declaration of the precedence relationship C > B [-Wprecedence]
|
||||
input.y:23.10: warning: duplicate declaration of the precedence relationship G > F [-Wprecedence]
|
||||
input.y:26.10: warning: duplicate declaration of the precedence relationship C > F [-Wprecedence]
|
||||
input.y: warning: 23 shift/reduce conflicts [-Wconflicts-sr]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
|
||||
## ------------------------- ##
|
||||
## Token declaration order. ##
|
||||
## ------------------------- ##
|
||||
@@ -243,18 +389,18 @@ f: B
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-Wprecedence -fcaret -o input.c input.y], 0, [],
|
||||
[[input.y:2.1-11: warning: useless precedence for Z [-Wprecedence]
|
||||
%precedence Z
|
||||
^^^^^^^^^^^
|
||||
input.y:5.1-5: warning: useless precedence and associativity for W [-Wprecedence]
|
||||
%left W
|
||||
^^^^^
|
||||
[[input.y:7.1-9: warning: useless precedence and associativity for U [-Wprecedence]
|
||||
%nonassoc U
|
||||
^^^^^^^^^
|
||||
input.y:6.1-6: warning: useless precedence and associativity for V [-Wprecedence]
|
||||
%right V
|
||||
^^^^^^
|
||||
input.y:7.1-9: warning: useless precedence and associativity for U [-Wprecedence]
|
||||
%nonassoc U
|
||||
^^^^^^^^^
|
||||
input.y:5.1-5: warning: useless precedence and associativity for W [-Wprecedence]
|
||||
%left W
|
||||
^^^^^
|
||||
input.y:2.1-11: warning: useless precedence for Z [-Wprecedence]
|
||||
%precedence Z
|
||||
^^^^^^^^^^^
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -1006,8 +1152,8 @@ cond:
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-o input.c input.y], 0, [],
|
||||
[[input.y:12.3-18: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
input.y:12.3-18: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -1050,8 +1196,8 @@ id : '0';
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-o input.c --report=all input.y], 0, [],
|
||||
[[input.y:4.6-8: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
input.y:4.6-8: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
# Check the contents of the report.
|
||||
@@ -1265,9 +1411,9 @@ e: e '+' e
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-Wall -o input.c input.y], 0, [],
|
||||
[[input.y:1.1-5: warning: useless precedence and associativity for '+' [-Wprecedence]
|
||||
[[input.y: warning: 4 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input.y:1.1-5: warning: useless precedence and associativity for '+' [-Wprecedence]
|
||||
input.y:2.1-5: warning: useless precedence and associativity for '*' [-Wprecedence]
|
||||
input.y: warning: 4 shift/reduce conflicts [-Wconflicts-sr]
|
||||
]])
|
||||
AT_CLEANUP
|
||||
|
||||
@@ -1369,15 +1515,15 @@ reported_conflicts:
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[--report=all input.y]], 0, [],
|
||||
[[input.y:12.5-20: warning: rule useless in parser due to conflicts [-Wother]
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
input.y:12.5-20: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:20.5-20: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:21.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:25.13: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:25.16: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:31.5-7: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:32.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
]])
|
||||
|
||||
AT_CHECK([[cat input.output]], 0,
|
||||
@@ -1522,12 +1668,12 @@ AT_DATA([[input-keep.y]],
|
||||
AT_CHECK([[cat input.y >> input-keep.y]])
|
||||
|
||||
AT_BISON_CHECK([[input-keep.y]], 0, [],
|
||||
[[input-keep.y:22.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
[[input-keep.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input-keep.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
input-keep.y:22.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input-keep.y:26.16: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input-keep.y:32.5-7: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input-keep.y:33.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input-keep.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input-keep.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -1705,9 +1851,9 @@ exp: 'a' | 'a';
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[2.y]], [[0]], [],
|
||||
[[2.y:3.12-14: warning: rule useless in parser due to conflicts [-Wother]
|
||||
2.y: warning: %expect-rr applies only to GLR parsers [-Wother]
|
||||
[[2.y: warning: %expect-rr applies only to GLR parsers [-Wother]
|
||||
2.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
2.y:3.12-14: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
+75
-75
@@ -426,25 +426,7 @@ dnl don't like even 'print $!4;'.
|
||||
[[LEX_GETLINE, '$', '!', YNUMBER, '*', YNUMBER, ';']],
|
||||
|
||||
dnl BISON-STDERR
|
||||
[[input.y:33.1-6: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence]
|
||||
input.y:37.1-5: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence]
|
||||
input.y:38.1-9: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence]
|
||||
input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence]
|
||||
input.y:39.1-5: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence]
|
||||
input.y:39.1-5: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence]
|
||||
input.y:40.1-9: warning: useless precedence and associativity for ',' [-Wprecedence]
|
||||
input.y:42.1-9: warning: useless precedence and associativity for APPEND_OP [-Wprecedence]
|
||||
input.y:43.1-5: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence]
|
||||
input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence]
|
||||
input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence]
|
||||
input.y:47.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence]
|
||||
input.y:47.1-6: warning: useless associativity for UNARY, use %precedence [-Wprecedence]
|
||||
input.y:49.1-5: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence]
|
||||
input.y:49.1-5: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence]
|
||||
input.y:50.1-5: warning: useless associativity for '$', use %precedence [-Wprecedence]
|
||||
input.y:51.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
|
||||
input.y:51.1-5: warning: useless precedence and associativity for ')' [-Wprecedence]
|
||||
input.y:66.10: warning: empty rule without %empty [-Wempty-rule]
|
||||
[[input.y:66.10: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:169.8: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:174.12: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:179.13: warning: empty rule without %empty [-Wempty-rule]
|
||||
@@ -457,6 +439,24 @@ input.y:322.9: warning: empty rule without %empty [-Wempty-rule]
|
||||
]AT_COND_CASE([[canonical LR]],
|
||||
[[input.y: warning: 265 shift/reduce conflicts [-Wconflicts-sr]]],
|
||||
[[input.y: warning: 65 shift/reduce conflicts [-Wconflicts-sr]]])[
|
||||
input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence]
|
||||
input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence]
|
||||
input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence]
|
||||
input.y:42.1-9: warning: useless precedence and associativity for APPEND_OP [-Wprecedence]
|
||||
input.y:33.1-6: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence]
|
||||
input.y:43.1-5: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence]
|
||||
input.y:37.1-5: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence]
|
||||
input.y:38.1-9: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence]
|
||||
input.y:49.1-5: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence]
|
||||
input.y:49.1-5: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence]
|
||||
input.y:39.1-5: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence]
|
||||
input.y:39.1-5: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence]
|
||||
input.y:40.1-9: warning: useless precedence and associativity for ',' [-Wprecedence]
|
||||
input.y:47.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence]
|
||||
input.y:47.1-6: warning: useless associativity for UNARY, use %precedence [-Wprecedence]
|
||||
input.y:50.1-5: warning: useless associativity for '$', use %precedence [-Wprecedence]
|
||||
input.y:51.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
|
||||
input.y:51.1-5: warning: useless precedence and associativity for ')' [-Wprecedence]
|
||||
]],
|
||||
|
||||
dnl LAST-STATE
|
||||
@@ -484,7 +484,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
||||
|
||||
NAME [reduce using rule 152 (opt_variable)]
|
||||
'$' [reduce using rule 152 (opt_variable)]
|
||||
@@ -5379,7 +5379,7 @@
|
||||
@@ -5385,7 +5385,7 @@
|
||||
156 | . '$' non_post_simp_exp
|
||||
|
||||
NAME shift, and go to state 9
|
||||
@@ -493,7 +493,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
||||
|
||||
NAME [reduce using rule 152 (opt_variable)]
|
||||
'$' [reduce using rule 152 (opt_variable)]
|
||||
@@ -5399,7 +5399,7 @@
|
||||
@@ -5405,7 +5405,7 @@
|
||||
156 | . '$' non_post_simp_exp
|
||||
|
||||
NAME shift, and go to state 9
|
||||
@@ -502,7 +502,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
||||
|
||||
NAME [reduce using rule 152 (opt_variable)]
|
||||
'$' [reduce using rule 152 (opt_variable)]
|
||||
@@ -6214,7 +6214,7 @@
|
||||
@@ -6220,7 +6220,7 @@
|
||||
156 | . '$' non_post_simp_exp
|
||||
|
||||
NAME shift, and go to state 9
|
||||
@@ -511,7 +511,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
||||
|
||||
NAME [reduce using rule 152 (opt_variable)]
|
||||
'$' [reduce using rule 152 (opt_variable)]
|
||||
@@ -11099,3 +11099,274 @@
|
||||
@@ -11117,3 +11117,274 @@
|
||||
45 statement: LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement .
|
||||
|
||||
$default reduce using rule 45 (statement)
|
||||
@@ -1395,13 +1395,7 @@ dnl INPUT
|
||||
[[]],
|
||||
|
||||
dnl BISON-STDERR
|
||||
[[input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence]
|
||||
input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence]
|
||||
input.y:55.1-5: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence]
|
||||
input.y:61.1-5: warning: useless associativity for HNOT, use %precedence [-Wprecedence]
|
||||
input.y:68.1-5: warning: useless associativity for UNEAR, use %precedence [-Wprecedence]
|
||||
input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence]
|
||||
input.y:128.12: warning: empty rule without %empty [-Wempty-rule]
|
||||
[[input.y:128.12: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:137.10: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:142.8: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:161.15: warning: empty rule without %empty [-Wempty-rule]
|
||||
@@ -1428,6 +1422,12 @@ input.y:591.14: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y: warning: 144 reduce/reduce conflicts [-Wconflicts-rr]]],
|
||||
[[input.y: warning: 78 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input.y: warning: 10 reduce/reduce conflicts [-Wconflicts-rr]]])[
|
||||
input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence]
|
||||
input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence]
|
||||
input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence]
|
||||
input.y:55.1-5: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence]
|
||||
input.y:61.1-5: warning: useless associativity for HNOT, use %precedence [-Wprecedence]
|
||||
input.y:68.1-5: warning: useless associativity for UNEAR, use %precedence [-Wprecedence]
|
||||
]],
|
||||
|
||||
dnl LAST-STATE
|
||||
@@ -2009,42 +2009,20 @@ dnl without being followed by "of".)
|
||||
[[VARIABLE, '=', LABEL, LEFT, DOT_X]],
|
||||
|
||||
dnl BISON-STDERR
|
||||
[[input.y:137.1-5: warning: useless associativity for '.', use %precedence [-Wprecedence]
|
||||
input.y:140.1-5: warning: useless associativity for PLOT, use %precedence [-Wprecedence]
|
||||
input.y:141.1-5: warning: useless associativity for TEXT, use %precedence [-Wprecedence]
|
||||
input.y:141.1-5: warning: useless associativity for SPRINTF, use %precedence [-Wprecedence]
|
||||
input.y:147.1-5: warning: useless precedence and associativity for LJUST [-Wprecedence]
|
||||
input.y:147.1-5: warning: useless precedence and associativity for RJUST [-Wprecedence]
|
||||
input.y:147.1-5: warning: useless precedence and associativity for ABOVE [-Wprecedence]
|
||||
input.y:147.1-5: warning: useless precedence and associativity for BELOW [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for UP, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for DOWN, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless precedence and associativity for SOLID [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for DOTTED, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for DASHED, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for CHOP, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for FILL, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless precedence and associativity for COLORED [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless precedence and associativity for OUTLINED [-Wprecedence]
|
||||
[[input.y:202.19: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:270.6: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:292.12: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:309.17: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:382.13: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:471.11-48: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:154.1-5: warning: useless associativity for LABEL, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for VARIABLE, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for NUMBER, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for LAST, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for SIN, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for COS, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for ATAN2, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for LOG, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for EXP, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for SQRT, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for K_MAX, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for K_MIN, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for INT, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for RAND, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for SRAND, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
|
||||
input.y:141.1-5: warning: useless associativity for TEXT, use %precedence [-Wprecedence]
|
||||
input.y:157.1-5: warning: useless associativity for ORDINAL, use %precedence [-Wprecedence]
|
||||
input.y:157.1-5: warning: useless associativity for HERE, use %precedence [-Wprecedence]
|
||||
input.y:157.1-5: warning: useless associativity for '`', use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for LAST, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for UP, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for DOWN, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for BOX, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for CIRCLE, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for ELLIPSE, use %precedence [-Wprecedence]
|
||||
@@ -2052,7 +2030,6 @@ input.y:159.1-5: warning: useless associativity for ARC, use %precedence [-Wprec
|
||||
input.y:159.1-5: warning: useless associativity for LINE, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for ARROW, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for SPLINE, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for '@<:@', use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for HEIGHT, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for RADIUS, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for WIDTH, use %precedence [-Wprecedence]
|
||||
@@ -2060,7 +2037,18 @@ input.y:162.1-5: warning: useless associativity for DIAMETER, use %precedence [-
|
||||
input.y:162.1-5: warning: useless associativity for FROM, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for TO, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for AT, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for THICKNESS, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless precedence and associativity for SOLID [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for DOTTED, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for DASHED, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for CHOP, use %precedence [-Wprecedence]
|
||||
input.y:147.1-5: warning: useless precedence and associativity for LJUST [-Wprecedence]
|
||||
input.y:147.1-5: warning: useless precedence and associativity for RJUST [-Wprecedence]
|
||||
input.y:147.1-5: warning: useless precedence and associativity for ABOVE [-Wprecedence]
|
||||
input.y:147.1-5: warning: useless precedence and associativity for BELOW [-Wprecedence]
|
||||
input.y:176.1-5: warning: useless associativity for OF, use %precedence [-Wprecedence]
|
||||
input.y:176.1-5: warning: useless associativity for BETWEEN, use %precedence [-Wprecedence]
|
||||
input.y:177.1-5: warning: useless associativity for AND, use %precedence [-Wprecedence]
|
||||
input.y:157.1-5: warning: useless associativity for HERE, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_N, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_E, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_W, use %precedence [-Wprecedence]
|
||||
@@ -2072,12 +2060,23 @@ input.y:166.1-5: warning: useless associativity for DOT_SW, use %precedence [-Wp
|
||||
input.y:166.1-5: warning: useless associativity for DOT_C, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for DOT_START, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for DOT_END, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for SIN, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for COS, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for ATAN2, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for LOG, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for EXP, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for SQRT, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for K_MAX, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for K_MIN, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for INT, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for RAND, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for SRAND, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for TOP, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for BOTTOM, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for LEFT_CORNER, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for RIGHT_CORNER, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for UPPER, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for LOWER, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for LEFT_CORNER, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for RIGHT_CORNER, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for NORTH, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for SOUTH, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for EAST, use %precedence [-Wprecedence]
|
||||
@@ -2085,17 +2084,18 @@ input.y:168.1-5: warning: useless associativity for WEST, use %precedence [-Wpre
|
||||
input.y:168.1-5: warning: useless associativity for CENTER, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for END, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for START, use %precedence [-Wprecedence]
|
||||
input.y:140.1-5: warning: useless associativity for PLOT, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for THICKNESS, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for FILL, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless precedence and associativity for COLORED [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless precedence and associativity for OUTLINED [-Wprecedence]
|
||||
input.y:141.1-5: warning: useless associativity for SPRINTF, use %precedence [-Wprecedence]
|
||||
input.y:137.1-5: warning: useless associativity for '.', use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
|
||||
input.y:157.1-5: warning: useless associativity for '`', use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for '@<:@', use %precedence [-Wprecedence]
|
||||
input.y:170.1-5: warning: useless associativity for ',', use %precedence [-Wprecedence]
|
||||
input.y:176.1-5: warning: useless associativity for OF, use %precedence [-Wprecedence]
|
||||
input.y:176.1-5: warning: useless associativity for BETWEEN, use %precedence [-Wprecedence]
|
||||
input.y:177.1-5: warning: useless associativity for AND, use %precedence [-Wprecedence]
|
||||
input.y:181.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence]
|
||||
input.y:202.19: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:270.6: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:292.12: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:309.17: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:382.13: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:471.11-48: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]],
|
||||
|
||||
dnl LAST-STATE
|
||||
|
||||
+54
-55
@@ -64,14 +64,13 @@ AT_CHECK([[$PERL -pi -e 's/\\(\d{3})/chr(oct($1))/ge' input.y || exit 77]])
|
||||
AT_BISON_CHECK([input.y], [1], [],
|
||||
[[input.y:1.1-2: error: invalid characters: '\0\001\002\377?'
|
||||
input.y:3.1: error: invalid character: '?'
|
||||
input.y:4.14: error: invalid character: '}'
|
||||
input.y:4.14: error: syntax error, unexpected }
|
||||
input.y:5.1: error: invalid character: '%'
|
||||
input.y:5.2: error: invalid character: '&'
|
||||
input.y:6.1-17: error: invalid directive: '%a-does-not-exist'
|
||||
input.y:7.1: error: invalid character: '%'
|
||||
input.y:7.2: error: invalid character: '-'
|
||||
input.y:8.1-9.0: error: missing '%}' at end of file
|
||||
input.y:8.1-9.0: error: syntax error, unexpected %{...%}
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -142,15 +141,15 @@ exp: foo { $$; } foo { $2; } foo
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-fcaret input.y], [1], [],
|
||||
[[input.y:5.6-32: warning: type clash on default action: <bar> != <> [-Wother]
|
||||
exp: foo { $$; } foo { $2; } foo
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:5.12-13: error: $$ for the midrule at $2 of 'exp' has no declared type
|
||||
[[input.y:5.12-13: error: $$ for the midrule at $2 of 'exp' has no declared type
|
||||
exp: foo { $$; } foo { $2; } foo
|
||||
^^
|
||||
input.y:5.24-25: error: $2 of 'exp' has no declared type
|
||||
exp: foo { $$; } foo { $2; } foo
|
||||
^^
|
||||
input.y:5.6-32: warning: type clash on default action: <bar> != <> [-Wother]
|
||||
exp: foo { $$; } foo { $2; } foo
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:6.6-8: warning: type clash on default action: <bar> != <> [-Wother]
|
||||
| foo
|
||||
^^^
|
||||
@@ -208,12 +207,12 @@ _AT_UNUSED_VALUES_DECLARATIONS])
|
||||
|
||||
AT_BISON_CHECK(m4_ifval($2, [--warnings=midrule-values ])[-fcaret input.y],
|
||||
[0], [],
|
||||
[[input.y:11.10-12: warning: unused value: $][1 [-Wother]
|
||||
a: INT | INT { } INT { } INT { };
|
||||
^^^
|
||||
input.y:11.10-32: warning: unset value: $][$ [-Wother]
|
||||
[[input.y:11.10-32: warning: unset value: $][$ [-Wother]
|
||||
a: INT | INT { } INT { } INT { };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:11.10-12: warning: unused value: $][1 [-Wother]
|
||||
a: INT | INT { } INT { } INT { };
|
||||
^^^
|
||||
input.y:11.18-20: warning: unused value: $][3 [-Wother]
|
||||
a: INT | INT { } INT { } INT { };
|
||||
^^^
|
||||
@@ -223,28 +222,28 @@ input.y:11.26-28: warning: unused value: $][5 [-Wother]
|
||||
input.y:12.10-15: warning: empty rule for typed nonterminal, and no action [-Wother]
|
||||
b: INT | %empty;
|
||||
^^^^^^
|
||||
input.y:13.10-62: warning: unset value: $][$ [-Wother]
|
||||
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
]]m4_ifval($2, [[[input.y:13.14-20: warning: unset value: $][$ [-Wmidrule-values]
|
||||
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
|
||||
^^^^^^^
|
||||
]]])[[input.y:13.22-24: warning: unused value: $][3 [-Wother]
|
||||
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
|
||||
^^^
|
||||
]]m4_ifval($2, [[[input.y:13.26-41: warning: unset value: $][$ [-Wmidrule-values]
|
||||
input.y:13.26-41: warning: unset value: $][$ [-Wmidrule-values]
|
||||
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
|
||||
^^^^^^^^^^^^^^^^
|
||||
]]])[[input.y:13.43-45: warning: unused value: $][5 [-Wother]
|
||||
]]])[[input.y:13.10-62: warning: unset value: $][$ [-Wother]
|
||||
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:13.22-24: warning: unused value: $][3 [-Wother]
|
||||
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
|
||||
^^^
|
||||
input.y:13.43-45: warning: unused value: $][5 [-Wother]
|
||||
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
|
||||
^^^
|
||||
input.y:14.10-49: warning: unset value: $][$ [-Wother]
|
||||
d: INT | INT { } INT { $][1; } INT { $<integer>2; };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
]]m4_ifval($2, [[[input.y:14.14-16: warning: unset value: $][$ [-Wmidrule-values]
|
||||
d: INT | INT { } INT { $][1; } INT { $<integer>2; };
|
||||
^^^
|
||||
]]])[[input.y:14.18-20: warning: unused value: $][3 [-Wother]
|
||||
]]])[[input.y:14.10-49: warning: unset value: $][$ [-Wother]
|
||||
d: INT | INT { } INT { $][1; } INT { $<integer>2; };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:14.18-20: warning: unused value: $][3 [-Wother]
|
||||
d: INT | INT { } INT { $][1; } INT { $<integer>2; };
|
||||
^^^
|
||||
input.y:14.30-32: warning: unused value: $][5 [-Wother]
|
||||
@@ -259,12 +258,12 @@ input.y:15.18-20: warning: unused value: $][3 [-Wother]
|
||||
input.y:15.27-29: warning: unused value: $][5 [-Wother]
|
||||
e: INT | INT { } INT { } INT { $][1; };
|
||||
^^^
|
||||
input.y:17.10-12: warning: unused value: $][1 [-Wother]
|
||||
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
|
||||
^^^
|
||||
input.y:17.10-58: warning: unset value: $][$ [-Wother]
|
||||
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:17.10-12: warning: unused value: $][1 [-Wother]
|
||||
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
|
||||
^^^
|
||||
]]m4_ifval($2, [[[input.y:17.14-29: warning: unused value: $][2 [-Wmidrule-values]
|
||||
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
|
||||
^^^^^^^^^^^^^^^^
|
||||
@@ -277,12 +276,12 @@ input.y:17.10-58: warning: unset value: $][$ [-Wother]
|
||||
]]])[[input.y:17.52-54: warning: unused value: $][5 [-Wother]
|
||||
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
|
||||
^^^
|
||||
input.y:18.10-12: warning: unused value: $][1 [-Wother]
|
||||
h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
|
||||
^^^
|
||||
input.y:18.10-72: warning: unset value: $][$ [-Wother]
|
||||
h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:18.10-12: warning: unused value: $][1 [-Wother]
|
||||
h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
|
||||
^^^
|
||||
input.y:18.31-33: warning: unused value: $][3 [-Wother]
|
||||
h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
|
||||
^^^
|
||||
@@ -295,12 +294,12 @@ input.y:18.31-33: warning: unused value: $][3 [-Wother]
|
||||
]]m4_ifval($2, [[[input.y:20.18-37: warning: unused value: $][3 [-Wmidrule-values]
|
||||
j: INT | INT INT { $<integer>$ = 1; } { $][$ = $][1 + $][2; };
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
]]])[[input.y:21.10-12: warning: unused value: $][1 [-Wother]
|
||||
k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
|
||||
^^^
|
||||
input.y:21.10-68: warning: unset value: $][$ [-Wother]
|
||||
]]])[[input.y:21.10-68: warning: unset value: $][$ [-Wother]
|
||||
k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:21.10-12: warning: unused value: $][1 [-Wother]
|
||||
k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
|
||||
^^^
|
||||
input.y:21.14-16: warning: unused value: $][2 [-Wother]
|
||||
k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
|
||||
^^^
|
||||
@@ -458,15 +457,15 @@ exp: bar;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-fcaret input.y], [1], [],
|
||||
[[input.y:1.13-15: warning: symbol foo is used, but is not defined as a token and has no rules [-Wother]
|
||||
%printer {} foo baz
|
||||
^^^
|
||||
[[input.y:2.16-18: error: symbol bar is used, but is not defined as a token and has no rules
|
||||
%destructor {} bar
|
||||
^^^
|
||||
input.y:1.17-19: warning: symbol baz is used, but is not defined as a token and has no rules [-Wother]
|
||||
%printer {} foo baz
|
||||
^^^
|
||||
input.y:2.16-18: error: symbol bar is used, but is not defined as a token and has no rules
|
||||
%destructor {} bar
|
||||
^^^
|
||||
input.y:1.13-15: warning: symbol foo is used, but is not defined as a token and has no rules [-Wother]
|
||||
%printer {} foo baz
|
||||
^^^
|
||||
input.y:3.13-15: warning: symbol qux is used, but is not defined as a token and has no rules [-Wother]
|
||||
%type <foo> qux
|
||||
^^^
|
||||
@@ -1417,9 +1416,9 @@ start: TOK;
|
||||
|
||||
AT_BISON_CHECK([[input.yy]], [0], [],
|
||||
[[input.yy:2.9-25: warning: %define variable 'api.location.type' requires '{...}' values [-Wdeprecated]
|
||||
input.yy:3.9-21: warning: %define variable 'api.namespace' requires '{...}' values [-Wdeprecated]
|
||||
input.yy:4.9-18: warning: %define variable 'api.prefix' requires '{...}' values [-Wdeprecated]
|
||||
input.yy:5.9-24: warning: %define variable 'api.token.prefix' requires '{...}' values [-Wdeprecated]
|
||||
input.yy:3.9-21: warning: %define variable 'api.namespace' requires '{...}' values [-Wdeprecated]
|
||||
]])
|
||||
])
|
||||
|
||||
@@ -1448,11 +1447,11 @@ exp: %empty
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input.y]], [0], [],
|
||||
[[input.y:1.9-16: warning: %define variable 'api.pure' requires keyword values [-Wdeprecated]
|
||||
input.y:2.9-21: warning: %define variable 'api.push-pull' requires keyword values [-Wdeprecated]
|
||||
[[input.y:5.9-15: warning: %define variable 'lr.type' requires keyword values [-Wdeprecated]
|
||||
input.y:3.9-28: warning: %define variable 'lr.default-reduction' requires keyword values [-Wdeprecated]
|
||||
input.y:4.9-33: warning: %define variable 'lr.keep-unreachable-state' requires keyword values [-Wdeprecated]
|
||||
input.y:5.9-15: warning: %define variable 'lr.type' requires keyword values [-Wdeprecated]
|
||||
input.y:2.9-21: warning: %define variable 'api.push-pull' requires keyword values [-Wdeprecated]
|
||||
input.y:1.9-16: warning: %define variable 'api.pure' requires keyword values [-Wdeprecated]
|
||||
]])
|
||||
])
|
||||
|
||||
@@ -1717,26 +1716,26 @@ AT_CHECK([[$PERL -e 'print "start: \"\\\t\\\f\\\0\\\1\" ;";' >> input.y \
|
||||
|| exit 77]])
|
||||
|
||||
AT_BISON_CHECK([input.y], [1], [],
|
||||
[[input.y:2.8-13: warning: empty character literal [-Wother]
|
||||
input.y:2.9-12: error: invalid number after \-escape: 777
|
||||
input.y:2.15-18: warning: empty character literal [-Wother]
|
||||
[[input.y:2.9-12: error: invalid number after \-escape: 777
|
||||
input.y:2.8-13: warning: empty character literal [-Wother]
|
||||
input.y:2.16-17: error: invalid number after \-escape: 0
|
||||
input.y:2.20-26: warning: empty character literal [-Wother]
|
||||
input.y:2.15-18: warning: empty character literal [-Wother]
|
||||
input.y:2.21-25: error: invalid number after \-escape: xfff
|
||||
input.y:2.28-32: warning: empty character literal [-Wother]
|
||||
input.y:2.20-26: warning: empty character literal [-Wother]
|
||||
input.y:2.29-31: error: invalid number after \-escape: x0
|
||||
input.y:3.8-15: warning: empty character literal [-Wother]
|
||||
input.y:2.28-32: warning: empty character literal [-Wother]
|
||||
input.y:3.9-14: error: invalid number after \-escape: uffff
|
||||
input.y:3.17-24: warning: empty character literal [-Wother]
|
||||
input.y:3.8-15: warning: empty character literal [-Wother]
|
||||
input.y:3.18-23: error: invalid number after \-escape: u0000
|
||||
input.y:3.26-37: warning: empty character literal [-Wother]
|
||||
input.y:3.17-24: warning: empty character literal [-Wother]
|
||||
input.y:3.27-36: error: invalid number after \-escape: Uffffffff
|
||||
input.y:3.39-50: warning: empty character literal [-Wother]
|
||||
input.y:3.26-37: warning: empty character literal [-Wother]
|
||||
input.y:3.40-49: error: invalid number after \-escape: U00000000
|
||||
input.y:4.8-11: warning: empty character literal [-Wother]
|
||||
input.y:3.39-50: warning: empty character literal [-Wother]
|
||||
input.y:4.9-10: error: invalid character after \-escape: ' '
|
||||
input.y:4.13-16: warning: empty character literal [-Wother]
|
||||
input.y:4.8-11: warning: empty character literal [-Wother]
|
||||
input.y:4.14-15: error: invalid character after \-escape: A
|
||||
input.y:4.13-16: warning: empty character literal [-Wother]
|
||||
input.y:5.9-16: error: invalid character after \-escape: \t
|
||||
input.y:5.17: error: invalid character after \-escape: \f
|
||||
input.y:5.18: error: invalid character after \-escape: \0
|
||||
@@ -2007,12 +2006,12 @@ AT_BISON_CHECK([[input.y]], [[1]], [[]],
|
||||
input.y:11.15-24: warning: deprecated directive: '%expect_rr', use '%expect-rr' [-Wdeprecated]
|
||||
input.y:12.15-24: warning: deprecated directive: '%expect_rr', use '%expect-rr' [-Wdeprecated]
|
||||
input.y:13.1-14: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
|
||||
input.y:13.16-29: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
|
||||
input.y:13.11-21: error: %define variable 'parse.error' redefined
|
||||
input.y:13-6: previous definition
|
||||
input.y:13.16-29: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
|
||||
input.y:14.16-29: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
|
||||
input.y:14.11-21: error: %define variable 'parse.error' redefined
|
||||
input.y:13.11-21: previous definition
|
||||
input.y:14.16-29: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
+41
-41
@@ -88,7 +88,8 @@ exp: useful;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input.y]], 0, [],
|
||||
[[input.y:4.8-15: warning: nonterminal useless in grammar: useless1 [-Wother]
|
||||
[[input.y: warning: 9 nonterminals useless in grammar [-Wother]
|
||||
input.y:4.8-15: warning: nonterminal useless in grammar: useless1 [-Wother]
|
||||
input.y:5.8-15: warning: nonterminal useless in grammar: useless2 [-Wother]
|
||||
input.y:6.8-15: warning: nonterminal useless in grammar: useless3 [-Wother]
|
||||
input.y:7.8-15: warning: nonterminal useless in grammar: useless4 [-Wother]
|
||||
@@ -97,7 +98,6 @@ input.y:9.8-15: warning: nonterminal useless in grammar: useless6 [-Wother]
|
||||
input.y:10.8-15: warning: nonterminal useless in grammar: useless7 [-Wother]
|
||||
input.y:11.8-15: warning: nonterminal useless in grammar: useless8 [-Wother]
|
||||
input.y:12.8-15: warning: nonterminal useless in grammar: useless9 [-Wother]
|
||||
input.y: warning: 9 nonterminals useless in grammar [-Wother]
|
||||
]])
|
||||
|
||||
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
|
||||
@@ -143,62 +143,62 @@ useless9: '9';
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-fcaret input.y]], 0, [],
|
||||
[[input.y:6.1-8: warning: nonterminal useless in grammar: useless1 [-Wother]
|
||||
[[input.y: warning: 9 nonterminals useless in grammar [-Wother]
|
||||
input.y: warning: 9 rules useless in grammar [-Wother]
|
||||
input.y:6.1-8: warning: nonterminal useless in grammar: useless1 [-Wother]
|
||||
useless1: '1';
|
||||
^^^^^^^^
|
||||
input.y:7.1-8: warning: nonterminal useless in grammar: useless2 [-Wother]
|
||||
useless2: '2';
|
||||
^^^^^^^^
|
||||
input.y:8.1-8: warning: nonterminal useless in grammar: useless3 [-Wother]
|
||||
useless3: '3';
|
||||
^^^^^^^^
|
||||
input.y:9.1-8: warning: nonterminal useless in grammar: useless4 [-Wother]
|
||||
useless4: '4';
|
||||
^^^^^^^^
|
||||
input.y:10.1-8: warning: nonterminal useless in grammar: useless5 [-Wother]
|
||||
useless5: '5';
|
||||
^^^^^^^^
|
||||
input.y:11.1-8: warning: nonterminal useless in grammar: useless6 [-Wother]
|
||||
useless6: '6';
|
||||
^^^^^^^^
|
||||
input.y:12.1-8: warning: nonterminal useless in grammar: useless7 [-Wother]
|
||||
useless7: '7';
|
||||
^^^^^^^^
|
||||
input.y:13.1-8: warning: nonterminal useless in grammar: useless8 [-Wother]
|
||||
useless8: '8';
|
||||
^^^^^^^^
|
||||
input.y:14.1-8: warning: nonterminal useless in grammar: useless9 [-Wother]
|
||||
useless9: '9';
|
||||
^^^^^^^^
|
||||
input.y:6.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless1: '1';
|
||||
^^^
|
||||
input.y:7.1-8: warning: nonterminal useless in grammar: useless2 [-Wother]
|
||||
useless2: '2';
|
||||
^^^^^^^^
|
||||
input.y:7.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless2: '2';
|
||||
^^^
|
||||
input.y:8.1-8: warning: nonterminal useless in grammar: useless3 [-Wother]
|
||||
useless3: '3';
|
||||
^^^^^^^^
|
||||
input.y:8.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless3: '3';
|
||||
^^^
|
||||
input.y:9.1-8: warning: nonterminal useless in grammar: useless4 [-Wother]
|
||||
useless4: '4';
|
||||
^^^^^^^^
|
||||
input.y:9.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless4: '4';
|
||||
^^^
|
||||
input.y:10.1-8: warning: nonterminal useless in grammar: useless5 [-Wother]
|
||||
useless5: '5';
|
||||
^^^^^^^^
|
||||
input.y:10.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless5: '5';
|
||||
^^^
|
||||
input.y:11.1-8: warning: nonterminal useless in grammar: useless6 [-Wother]
|
||||
useless6: '6';
|
||||
^^^^^^^^
|
||||
input.y:11.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless6: '6';
|
||||
^^^
|
||||
input.y:12.1-8: warning: nonterminal useless in grammar: useless7 [-Wother]
|
||||
useless7: '7';
|
||||
^^^^^^^^
|
||||
input.y:12.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless7: '7';
|
||||
^^^
|
||||
input.y:13.1-8: warning: nonterminal useless in grammar: useless8 [-Wother]
|
||||
useless8: '8';
|
||||
^^^^^^^^
|
||||
input.y:13.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless8: '8';
|
||||
^^^
|
||||
input.y:14.1-8: warning: nonterminal useless in grammar: useless9 [-Wother]
|
||||
useless9: '9';
|
||||
^^^^^^^^
|
||||
input.y:14.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless9: '9';
|
||||
^^^
|
||||
input.y: warning: 9 nonterminals useless in grammar [-Wother]
|
||||
input.y: warning: 9 rules useless in grammar [-Wother]
|
||||
]])
|
||||
|
||||
|
||||
@@ -276,23 +276,23 @@ non_productive: non_productive useless_token
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-fcaret not-reduced.y]], 0, [],
|
||||
[[not-reduced.y:11.6-19: warning: nonterminal useless in grammar: non_productive [-Wother]
|
||||
[[not-reduced.y: warning: 2 nonterminals useless in grammar [-Wother]
|
||||
not-reduced.y: warning: 3 rules useless in grammar [-Wother]
|
||||
not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable [-Wother]
|
||||
not_reachable: useful { /* A not reachable action. */ }
|
||||
^^^^^^^^^^^^^
|
||||
not-reduced.y:11.6-19: warning: nonterminal useless in grammar: non_productive [-Wother]
|
||||
| non_productive { /* A non productive action. */ }
|
||||
^^^^^^^^^^^^^^
|
||||
not-reduced.y:11.6-57: warning: rule useless in grammar [-Wother]
|
||||
| non_productive { /* A non productive action. */ }
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable [-Wother]
|
||||
not_reachable: useful { /* A not reachable action. */ }
|
||||
^^^^^^^^^^^^^
|
||||
not-reduced.y:14.16-56: warning: rule useless in grammar [-Wother]
|
||||
not_reachable: useful { /* A not reachable action. */ }
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
not-reduced.y:17.17-18.63: warning: rule useless in grammar [-Wother]
|
||||
non_productive: non_productive useless_token
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
not-reduced.y: warning: 2 nonterminals useless in grammar [-Wother]
|
||||
not-reduced.y: warning: 3 rules useless in grammar [-Wother]
|
||||
]])
|
||||
|
||||
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' not-reduced.output]], 0,
|
||||
@@ -361,13 +361,13 @@ indirection: underivable;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input.y]], 0, [],
|
||||
[[input.y:5.15-25: warning: nonterminal useless in grammar: underivable [-Wother]
|
||||
input.y:5.15-25: warning: rule useless in grammar [-Wother]
|
||||
[[input.y: warning: 2 nonterminals useless in grammar [-Wother]
|
||||
input.y: warning: 3 rules useless in grammar [-Wother]
|
||||
input.y:5.15-25: warning: nonterminal useless in grammar: underivable [-Wother]
|
||||
input.y:6.14-24: warning: nonterminal useless in grammar: indirection [-Wother]
|
||||
input.y:5.15-25: warning: rule useless in grammar [-Wother]
|
||||
input.y:6.14-24: warning: rule useless in grammar [-Wother]
|
||||
input.y:7.14-24: warning: rule useless in grammar [-Wother]
|
||||
input.y: warning: 2 nonterminals useless in grammar [-Wother]
|
||||
input.y: warning: 3 rules useless in grammar [-Wother]
|
||||
]])
|
||||
|
||||
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
|
||||
@@ -397,9 +397,9 @@ exp: exp;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input.y]], 1, [],
|
||||
[[input.y:3.1-3: fatal error: start symbol exp does not derive any sentence
|
||||
input.y: warning: 2 nonterminals useless in grammar [-Wother]
|
||||
[[input.y: warning: 2 nonterminals useless in grammar [-Wother]
|
||||
input.y: warning: 2 rules useless in grammar [-Wother]
|
||||
input.y:3.1-3: fatal error: start symbol exp does not derive any sentence
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
+3
-4
@@ -405,14 +405,13 @@ default: 'a' }
|
||||
|
||||
AT_BISON_CHECK([input.y], [1], [],
|
||||
[[input.y:2.1: error: invalid character: '?'
|
||||
input.y:3.14: error: invalid character: '}'
|
||||
input.y:3.14: error: syntax error, unexpected }
|
||||
input.y:4.1: error: invalid character: '%'
|
||||
input.y:4.2: error: invalid character: '&'
|
||||
input.y:5.1-17: error: invalid directive: '%a-does-not-exist'
|
||||
input.y:6.1: error: invalid character: '%'
|
||||
input.y:6.2: error: invalid character: '-'
|
||||
input.y:7.1-8.0: error: missing '%}' at end of file
|
||||
input.y:7.1-8.0: error: syntax error, unexpected %{...%}
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -1147,9 +1146,9 @@ sr_conflict:
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-Wall -o input.c input.y]], [[0]],,
|
||||
[[input.y:18.1-5: warning: useless precedence and associativity for TK1 [-Wprecedence]
|
||||
input.y:24.5-19: warning: rule useless in parser due to conflicts [-Wother]
|
||||
[[input.y:24.5-19: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:28.5-19: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:18.1-5: warning: useless precedence and associativity for TK1 [-Wprecedence]
|
||||
]])
|
||||
AT_COMPILE([[input]])
|
||||
AT_PARSER_CHECK([[./input]])
|
||||
|
||||
+4
-4
@@ -186,10 +186,10 @@ start: ;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input1.y]], [[1]], [[]],
|
||||
[[fooc.y:1.1-10.5: error: foocat fubar
|
||||
[[input1.y: warning: foow fubar [-Wother]
|
||||
foow.y:2.3-5.3: warning: foowat fubar [-Wother]
|
||||
input1.y: warning: foow fubar [-Wother]
|
||||
input1.y: error: fooc fubar
|
||||
fooc.y:1.1-10.5: error: foocat fubar
|
||||
input1.y: fatal error: foof fubar
|
||||
]])
|
||||
|
||||
@@ -276,8 +276,8 @@ start: ;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input2.y]], [[1]], [[]],
|
||||
[[foo.y:1.5-6: fatal error: M4 should exit immediately here
|
||||
input2.y: warning: morning [-Wother]
|
||||
[[input2.y: warning: morning [-Wother]
|
||||
foo.y:1.5-6: fatal error: M4 should exit immediately here
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
Reference in New Issue
Block a user