mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +00:00
Provide warn_at, complain_at, and fatal_at function callbacks to the
skeletons, and use this for %code qualifier complaints. * data/bison.m4 (b4_error_at): New, invoked by... (b4_warn_at, b4_complain_at, b4_fatal_at): ... these new macros to wrap the skeleton scanner's new @warn_at(...@), @complain_at(...@), and @fatal_at(...@) directives. (b4_check_percent_code_qualifiers): Rewrite to expect locations for qualifiers in b4_used_percent_code_qualifiers and to use b4_complain_at. * src/location.c, src/location.h (boundary_set_from_string): New global function. * src/muscle_tab.c, src/muscle_tab.h (muscle_boundary_grow): New global function. * src/parse-gram.y (grammar_declaration): Add locations for qualifiers to b4_used_percent_code_qualifiers. * src/scan-skel.l (fail_for_at_directive_too_few_args): New static function. (AT_DIRECTIVE_ARGC_MAX): Increase for boundary arguments. (lineno): Rename to... (out_lineno): ... this so I don't misunderstand it again. (SC_AT_DIRECTIVE_SKIP_WS): Don't increment out_lineno for newlines here; these newlines are in the input but not the output file. (SC_AT_DIRECTIVE_ARG): Likewise. Extract directive execution to... (at_directive_perform): ... this new static function, and add handling of new @warn_at(...@), @complain_at(...@), and @fatal_at(...@) directives. * tests/input.at (Reject bad %code qualifiers): Update test output with locations and extend. * tests/output.at (Output file name: [, Output file name: ]): Remove bogus comment about these tests failing.
This commit is contained in:
34
ChangeLog
34
ChangeLog
@@ -1,3 +1,37 @@
|
|||||||
|
2007-01-06 Joel E. Denny <jdenny@ces.clemson.edu>
|
||||||
|
|
||||||
|
Provide warn_at, complain_at, and fatal_at function callbacks to the
|
||||||
|
skeletons, and use this for %code qualifier complaints.
|
||||||
|
* data/bison.m4 (b4_error_at): New, invoked by...
|
||||||
|
(b4_warn_at, b4_complain_at, b4_fatal_at): ... these new macros to wrap
|
||||||
|
the skeleton scanner's new @warn_at(...@), @complain_at(...@), and
|
||||||
|
@fatal_at(...@) directives.
|
||||||
|
(b4_check_percent_code_qualifiers): Rewrite to expect locations for
|
||||||
|
qualifiers in b4_used_percent_code_qualifiers and to use
|
||||||
|
b4_complain_at.
|
||||||
|
* src/location.c, src/location.h (boundary_set_from_string): New global
|
||||||
|
function.
|
||||||
|
* src/muscle_tab.c, src/muscle_tab.h (muscle_boundary_grow): New global
|
||||||
|
function.
|
||||||
|
* src/parse-gram.y (grammar_declaration): Add locations for qualifiers
|
||||||
|
to b4_used_percent_code_qualifiers.
|
||||||
|
* src/scan-skel.l (fail_for_at_directive_too_few_args): New static
|
||||||
|
function.
|
||||||
|
(AT_DIRECTIVE_ARGC_MAX): Increase for boundary arguments.
|
||||||
|
(lineno): Rename to...
|
||||||
|
(out_lineno): ... this so I don't misunderstand it again.
|
||||||
|
(SC_AT_DIRECTIVE_SKIP_WS): Don't increment out_lineno for newlines
|
||||||
|
here; these newlines are in the input but not the output file.
|
||||||
|
(SC_AT_DIRECTIVE_ARG): Likewise. Extract directive execution to...
|
||||||
|
(at_directive_perform): ... this new static function, and add handling
|
||||||
|
of new @warn_at(...@), @complain_at(...@), and @fatal_at(...@)
|
||||||
|
directives.
|
||||||
|
* tests/input.at (Reject bad %code qualifiers): Update test output with
|
||||||
|
locations and extend.
|
||||||
|
|
||||||
|
* tests/output.at (Output file name: [, Output file name: ]): Remove
|
||||||
|
bogus comment about these tests failing.
|
||||||
|
|
||||||
2007-01-06 Joel E. Denny <jdenny@ces.clemson.edu>
|
2007-01-06 Joel E. Denny <jdenny@ces.clemson.edu>
|
||||||
|
|
||||||
Clean up b4_check_percent_code_qualifiers a little.
|
Clean up b4_check_percent_code_qualifiers a little.
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ version 2.2 of Bison.])])
|
|||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
# b4_error(KIND, FORMAT, [ARG1], [ARG2], ...)
|
# b4_error(KIND, FORMAT, [ARG1], [ARG2], ...)
|
||||||
# ---------------------------------------------------------------
|
# -----------------------------------------------------
|
||||||
# Write @KIND(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
|
# Write @KIND(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
|
||||||
m4_define([b4_error],
|
m4_define([b4_error],
|
||||||
[m4_divert_push(0)[@]$1[(]$2[]m4_if([$#], [2], [],
|
[m4_divert_push(0)[@]$1[(]$2[]m4_if([$#], [2], [],
|
||||||
@@ -74,8 +74,17 @@ m4_define([b4_error],
|
|||||||
m4_dquote(m4_shift(m4_shift($@))),
|
m4_dquote(m4_shift(m4_shift($@))),
|
||||||
[[@,]b4_arg])])[@)]m4_divert_pop(0)])
|
[[@,]b4_arg])])[@)]m4_divert_pop(0)])
|
||||||
|
|
||||||
|
# b4_error_at(KIND, START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
|
# -----------------------------------------------------------------
|
||||||
|
# Write @KIND(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
|
||||||
|
m4_define([b4_error_at],
|
||||||
|
[m4_divert_push(0)[@]$1[_at(]$2[@,]$3[@,]$4[]m4_if([$#], [4], [],
|
||||||
|
[m4_foreach([b4_arg],
|
||||||
|
m4_dquote(m4_shift(m4_shift(m4_shift(m4_shift($@))))),
|
||||||
|
[[@,]b4_arg])])[@)]m4_divert_pop(0)])
|
||||||
|
|
||||||
# b4_warn(FORMAT, [ARG1], [ARG2], ...)
|
# b4_warn(FORMAT, [ARG1], [ARG2], ...)
|
||||||
# --------------------------------------------------------
|
# -----------------------------------------------------
|
||||||
# Write @warn(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
|
# Write @warn(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
|
||||||
#
|
#
|
||||||
# As a simple test suite, this:
|
# As a simple test suite, this:
|
||||||
@@ -89,8 +98,6 @@ m4_define([b4_error],
|
|||||||
# m4_divert(0)
|
# m4_divert(0)
|
||||||
# b4_warn([asdf), asdf], [fsa), fsa], [fdsa), fdsa])
|
# b4_warn([asdf), asdf], [fsa), fsa], [fdsa), fdsa])
|
||||||
# m4_divert(0)
|
# m4_divert(0)
|
||||||
# b4_warn
|
|
||||||
# m4_divert(0)
|
|
||||||
# b4_warn()
|
# b4_warn()
|
||||||
# m4_divert(0)
|
# m4_divert(0)
|
||||||
# b4_warn(1)
|
# b4_warn(1)
|
||||||
@@ -103,28 +110,45 @@ m4_define([b4_error],
|
|||||||
# @warn(asdf), asdf@,fsa), fsa@,fdsa), fdsa@)
|
# @warn(asdf), asdf@,fsa), fsa@,fdsa), fdsa@)
|
||||||
# @warn(ASDF), ASDF@,FSA), FSA@,FDSA), FDSA@)
|
# @warn(ASDF), ASDF@,FSA), FSA@,FDSA), FDSA@)
|
||||||
# @warn(@)
|
# @warn(@)
|
||||||
# @warn(@)
|
|
||||||
# @warn(1@)
|
# @warn(1@)
|
||||||
# @warn(1@,2@)
|
# @warn(1@,2@)
|
||||||
m4_define([b4_warn],
|
m4_define([b4_warn],
|
||||||
[b4_error([[warn]], $@)])
|
[b4_error([[warn]], $@)])
|
||||||
|
|
||||||
|
# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
|
# -----------------------------------------------------------------
|
||||||
|
# Write @warn(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
|
||||||
|
m4_define([b4_warn_at],
|
||||||
|
[b4_error_at([[warn]], $@)])
|
||||||
|
|
||||||
# b4_complain(FORMAT, [ARG1], [ARG2], ...)
|
# b4_complain(FORMAT, [ARG1], [ARG2], ...)
|
||||||
# ------------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# Write @complain(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
|
# Write @complain(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
|
||||||
#
|
#
|
||||||
# See the test suite for b4_warn above.
|
# See the test suite for b4_warn above.
|
||||||
m4_define([b4_complain],
|
m4_define([b4_complain],
|
||||||
[b4_error([[complain]], $@)])
|
[b4_error([[complain]], $@)])
|
||||||
|
|
||||||
|
# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
|
# ---------------------------------------------------------------------
|
||||||
|
# Write @complain(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
|
||||||
|
m4_define([b4_complain_at],
|
||||||
|
[b4_error_at([[complain]], $@)])
|
||||||
|
|
||||||
# b4_fatal(FORMAT, [ARG1], [ARG2], ...)
|
# b4_fatal(FORMAT, [ARG1], [ARG2], ...)
|
||||||
# ---------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
# Write @fatal(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
|
# Write @fatal(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
|
||||||
#
|
#
|
||||||
# See the test suite for b4_warn above.
|
# See the test suite for b4_warn above.
|
||||||
m4_define([b4_fatal],
|
m4_define([b4_fatal],
|
||||||
[b4_error([[fatal]], $@)])
|
[b4_error([[fatal]], $@)])
|
||||||
|
|
||||||
|
# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
# Write @fatal(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
|
||||||
|
m4_define([b4_fatal_at],
|
||||||
|
[b4_error_at([[fatal]], $@)])
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Default values. ##
|
## Default values. ##
|
||||||
@@ -264,17 +288,19 @@ b4_define_user_code([stype])
|
|||||||
# Complain if any %code qualifier used in the grammar is not a valid qualifier.
|
# Complain if any %code qualifier used in the grammar is not a valid qualifier.
|
||||||
#
|
#
|
||||||
# If no %code qualifiers are used in the grammar,
|
# If no %code qualifiers are used in the grammar,
|
||||||
# b4_used_percent_code_qualifiers must be undefined or expand to the empty
|
# b4_used_percent_code_qualifiers must be undefined or must expand to the empty
|
||||||
# string. Otherwise, it must expand to a comma-delimited list specifying all
|
# string. Otherwise, it must expand to a list specifying all occurrences of
|
||||||
# %code qualifiers used in the grammar. Each item in the list must expand to
|
# all %code qualifiers used in the grammar. Each item in the list is a
|
||||||
# text that expands to one of those qualifiers. For example, to define
|
# triplet specifying one occurrence: qualifier, start boundary, and end
|
||||||
# b4_used_percent_code_qualifiers with two qualifiers with correct quoting:
|
# boundary. For example, to define b4_used_percent_code_qualifiers with three
|
||||||
|
# qualifier occurrences with correct quoting:
|
||||||
#
|
#
|
||||||
# m4_define([b4_used_percent_code_qualifiers],
|
# m4_define([b4_used_percent_code_qualifiers],
|
||||||
# [[[[requires]], [[provides]]]])
|
# [[[[[[requires]], [[parser.y:1.7]], [[parser.y:1.16]]]],
|
||||||
|
# [[[[provides]], [[parser.y:5.7]], [[parser.y:5.16]]]],
|
||||||
|
# [[[[provides]], [[parser.y:8.7]], [[parser.y:8.16]]]]]])
|
||||||
#
|
#
|
||||||
# Multiple occurrences of the same qualifier are fine. Empty string qualifiers
|
# Empty string qualifiers are fine.
|
||||||
# are fine.
|
|
||||||
#
|
#
|
||||||
# Each VALID_QUALIFIER must expand to a valid qualifier. For example,
|
# Each VALID_QUALIFIER must expand to a valid qualifier. For example,
|
||||||
# b4_check_percent_code_qualifiers might be invoked with:
|
# b4_check_percent_code_qualifiers might be invoked with:
|
||||||
@@ -292,13 +318,22 @@ b4_define_user_code([stype])
|
|||||||
# Qualifiers and valid qualifiers must not contain the character `,'.
|
# Qualifiers and valid qualifiers must not contain the character `,'.
|
||||||
m4_define([b4_check_percent_code_qualifiers],
|
m4_define([b4_check_percent_code_qualifiers],
|
||||||
[m4_ifdef([b4_used_percent_code_qualifiers], [
|
[m4_ifdef([b4_used_percent_code_qualifiers], [
|
||||||
m4_foreach([b4_qualifier],
|
m4_foreach([b4_occurrence],
|
||||||
b4_used_percent_code_qualifiers,
|
b4_used_percent_code_qualifiers,
|
||||||
[m4_if(m4_index(m4_if($#, 0, [], [[,]m4_quote($*)[,]]),
|
[m4_pushdef([b4_occurrence], b4_occurrence)
|
||||||
|
m4_pushdef([b4_qualifier], m4_car(b4_occurrence))
|
||||||
|
m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))
|
||||||
|
m4_pushdef([b4_end], m4_shift(m4_shift(b4_occurrence)))
|
||||||
|
m4_if(m4_index(m4_if($#, 0, [], [[,]m4_quote($*)[,]]),
|
||||||
[,]b4_qualifier[,]),
|
[,]b4_qualifier[,]),
|
||||||
[-1],
|
[-1],
|
||||||
[b4_complain([[`%s' is not a recognized %%code qualifier]],
|
[b4_complain_at([b4_start], [b4_end],
|
||||||
[b4_qualifier])
|
[[`%s' is not a recognized %%code qualifier]],
|
||||||
|
[b4_qualifier])
|
||||||
])
|
])
|
||||||
|
m4_popdef([b4_occurrence])
|
||||||
|
m4_popdef([b4_qualifier])
|
||||||
|
m4_popdef([b4_start])
|
||||||
|
m4_popdef([b4_end])
|
||||||
])
|
])
|
||||||
])])
|
])])
|
||||||
|
|||||||
@@ -116,3 +116,19 @@ location_print (FILE *out, location loc)
|
|||||||
else if (loc.start.column < end_col)
|
else if (loc.start.column < end_col)
|
||||||
fprintf (out, "-%d", end_col);
|
fprintf (out, "-%d", end_col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
boundary_set_from_string (boundary *bound, char *loc_str)
|
||||||
|
{
|
||||||
|
/* Must search in reverse since the file name field may
|
||||||
|
* contain `.' or `:'. */
|
||||||
|
char *delim = strrchr (loc_str, '.');
|
||||||
|
aver (delim);
|
||||||
|
*delim = '\0';
|
||||||
|
bound->column = atoi (delim+1);
|
||||||
|
delim = strrchr (loc_str, ':');
|
||||||
|
aver (delim);
|
||||||
|
*delim = '\0';
|
||||||
|
bound->line = atoi (delim+1);
|
||||||
|
bound->file = uniqstr_new (loc_str);
|
||||||
|
}
|
||||||
|
|||||||
@@ -81,4 +81,7 @@ void location_compute (location *loc,
|
|||||||
|
|
||||||
void location_print (FILE *out, location loc);
|
void location_print (FILE *out, location loc);
|
||||||
|
|
||||||
|
/* LOC_STR must be formatted as `file:line.column', it will be modified. */
|
||||||
|
void boundary_set_from_string (boundary *bound, char *loc_str);
|
||||||
|
|
||||||
#endif /* ! defined LOCATION_H_ */
|
#endif /* ! defined LOCATION_H_ */
|
||||||
|
|||||||
@@ -261,3 +261,18 @@ muscles_m4_output (FILE *out)
|
|||||||
{
|
{
|
||||||
hash_do_for_each (muscle_table, muscle_m4_output_processor, out);
|
hash_do_for_each (muscle_table, muscle_m4_output_processor, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
muscle_boundary_grow (char const *key, boundary bound)
|
||||||
|
{
|
||||||
|
char *extension;
|
||||||
|
MUSCLE_OBSTACK_SGROW (&muscle_obstack, bound.file);
|
||||||
|
obstack_1grow (&muscle_obstack, ':');
|
||||||
|
obstack_fgrow1 (&muscle_obstack, "%d", bound.line);
|
||||||
|
obstack_1grow (&muscle_obstack, '.');
|
||||||
|
obstack_fgrow1 (&muscle_obstack, "%d", bound.column);
|
||||||
|
obstack_1grow (&muscle_obstack, '\0');
|
||||||
|
extension = obstack_finish (&muscle_obstack);
|
||||||
|
muscle_grow (key, extension, "");
|
||||||
|
obstack_free (&muscle_obstack, extension);
|
||||||
|
}
|
||||||
|
|||||||
@@ -112,4 +112,8 @@ void muscle_pair_list_grow (const char *muscle,
|
|||||||
|
|
||||||
void muscles_m4_output (FILE *out);
|
void muscles_m4_output (FILE *out);
|
||||||
|
|
||||||
|
/* In the format `file_name:line.column', append BOUND to MUSCLE. Use digraphs
|
||||||
|
for special characters in the file name. */
|
||||||
|
void muscle_boundary_grow (char const *key, boundary bound);
|
||||||
|
|
||||||
#endif /* not MUSCLE_TAB_H_ */
|
#endif /* not MUSCLE_TAB_H_ */
|
||||||
|
|||||||
114
src/parse-gram.c
114
src/parse-gram.c
@@ -677,13 +677,13 @@ static const yytype_uint16 yyrline[] =
|
|||||||
238, 243, 244, 245, 246, 247, 248, 253, 262, 263,
|
238, 243, 244, 245, 246, 247, 248, 253, 262, 263,
|
||||||
264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
|
264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
|
||||||
274, 275, 276, 277, 278, 279, 280, 284, 285, 286,
|
274, 275, 276, 277, 278, 279, 280, 284, 285, 286,
|
||||||
290, 297, 304, 308, 312, 317, 340, 341, 345, 374,
|
290, 297, 304, 308, 312, 317, 344, 345, 349, 378,
|
||||||
374, 379, 379, 384, 395, 410, 411, 412, 416, 417,
|
378, 383, 383, 388, 399, 414, 415, 416, 420, 421,
|
||||||
422, 424, 429, 430, 434, 435, 436, 437, 442, 447,
|
426, 428, 433, 434, 438, 439, 440, 441, 446, 451,
|
||||||
452, 458, 464, 475, 476, 485, 486, 492, 493, 494,
|
456, 462, 468, 479, 480, 489, 490, 496, 497, 498,
|
||||||
501, 501, 505, 506, 507, 512, 513, 515, 517, 519,
|
505, 505, 509, 510, 511, 516, 517, 519, 521, 523,
|
||||||
521, 531, 532, 538, 542, 547, 567, 569, 578, 583,
|
525, 535, 536, 542, 546, 551, 571, 573, 582, 587,
|
||||||
584, 589, 596, 598
|
588, 593, 600, 602
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2194,30 +2194,34 @@ yyreduce:
|
|||||||
muscle_code_grow (uniqstr_new (name), (yyvsp[(3) - (3)].chars), (yylsp[(3) - (3)]));
|
muscle_code_grow (uniqstr_new (name), (yyvsp[(3) - (3)].chars), (yylsp[(3) - (3)]));
|
||||||
free (name);
|
free (name);
|
||||||
code_scanner_last_string_free ();
|
code_scanner_last_string_free ();
|
||||||
muscle_grow ("used_percent_code_qualifiers", "[[", ",");
|
muscle_grow ("used_percent_code_qualifiers", "[[[[", ",");
|
||||||
muscle_grow ("used_percent_code_qualifiers", (yyvsp[(2) - (3)].chars), "");
|
muscle_grow ("used_percent_code_qualifiers", (yyvsp[(2) - (3)].chars), "");
|
||||||
muscle_grow ("used_percent_code_qualifiers", "]]", "");
|
muscle_grow ("used_percent_code_qualifiers", "]], [[", "");
|
||||||
|
muscle_boundary_grow ("used_percent_code_qualifiers", (yylsp[(2) - (3)]).start);
|
||||||
|
muscle_grow ("used_percent_code_qualifiers", "]], [[", "");
|
||||||
|
muscle_boundary_grow ("used_percent_code_qualifiers", (yylsp[(2) - (3)]).end);
|
||||||
|
muscle_grow ("used_percent_code_qualifiers", "]]]]", "");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 46:
|
case 46:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 340 "parse-gram.y"
|
#line 344 "parse-gram.y"
|
||||||
{}
|
{}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 47:
|
case 47:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 341 "parse-gram.y"
|
#line 345 "parse-gram.y"
|
||||||
{ muscle_code_grow ("union_name", (yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
|
{ muscle_code_grow ("union_name", (yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 48:
|
case 48:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 346 "parse-gram.y"
|
#line 350 "parse-gram.y"
|
||||||
{
|
{
|
||||||
char const *body = (yyvsp[(3) - (3)].code);
|
char const *body = (yyvsp[(3) - (3)].code);
|
||||||
|
|
||||||
@@ -2245,14 +2249,14 @@ yyreduce:
|
|||||||
case 49:
|
case 49:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 374 "parse-gram.y"
|
#line 378 "parse-gram.y"
|
||||||
{ current_class = nterm_sym; }
|
{ current_class = nterm_sym; }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 50:
|
case 50:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 375 "parse-gram.y"
|
#line 379 "parse-gram.y"
|
||||||
{
|
{
|
||||||
current_class = unknown_sym;
|
current_class = unknown_sym;
|
||||||
current_type = NULL;
|
current_type = NULL;
|
||||||
@@ -2262,14 +2266,14 @@ yyreduce:
|
|||||||
case 51:
|
case 51:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 379 "parse-gram.y"
|
#line 383 "parse-gram.y"
|
||||||
{ current_class = token_sym; }
|
{ current_class = token_sym; }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 52:
|
case 52:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 380 "parse-gram.y"
|
#line 384 "parse-gram.y"
|
||||||
{
|
{
|
||||||
current_class = unknown_sym;
|
current_class = unknown_sym;
|
||||||
current_type = NULL;
|
current_type = NULL;
|
||||||
@@ -2279,7 +2283,7 @@ yyreduce:
|
|||||||
case 53:
|
case 53:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 385 "parse-gram.y"
|
#line 389 "parse-gram.y"
|
||||||
{
|
{
|
||||||
symbol_list *list;
|
symbol_list *list;
|
||||||
tag_seen = true;
|
tag_seen = true;
|
||||||
@@ -2292,7 +2296,7 @@ yyreduce:
|
|||||||
case 54:
|
case 54:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 396 "parse-gram.y"
|
#line 400 "parse-gram.y"
|
||||||
{
|
{
|
||||||
symbol_list *list;
|
symbol_list *list;
|
||||||
++current_prec;
|
++current_prec;
|
||||||
@@ -2309,98 +2313,98 @@ yyreduce:
|
|||||||
case 55:
|
case 55:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 410 "parse-gram.y"
|
#line 414 "parse-gram.y"
|
||||||
{ (yyval.assoc) = left_assoc; }
|
{ (yyval.assoc) = left_assoc; }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 56:
|
case 56:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 411 "parse-gram.y"
|
#line 415 "parse-gram.y"
|
||||||
{ (yyval.assoc) = right_assoc; }
|
{ (yyval.assoc) = right_assoc; }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 57:
|
case 57:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 412 "parse-gram.y"
|
#line 416 "parse-gram.y"
|
||||||
{ (yyval.assoc) = non_assoc; }
|
{ (yyval.assoc) = non_assoc; }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 58:
|
case 58:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 416 "parse-gram.y"
|
#line 420 "parse-gram.y"
|
||||||
{ current_type = NULL; }
|
{ current_type = NULL; }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 59:
|
case 59:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 417 "parse-gram.y"
|
#line 421 "parse-gram.y"
|
||||||
{ current_type = (yyvsp[(1) - (1)].uniqstr); tag_seen = true; }
|
{ current_type = (yyvsp[(1) - (1)].uniqstr); tag_seen = true; }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 60:
|
case 60:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 423 "parse-gram.y"
|
#line 427 "parse-gram.y"
|
||||||
{ (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
|
{ (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 61:
|
case 61:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 425 "parse-gram.y"
|
#line 429 "parse-gram.y"
|
||||||
{ (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), symbol_list_sym_new ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]))); }
|
{ (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), symbol_list_sym_new ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]))); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 62:
|
case 62:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 429 "parse-gram.y"
|
#line 433 "parse-gram.y"
|
||||||
{ (yyval.list) = (yyvsp[(1) - (1)].list); }
|
{ (yyval.list) = (yyvsp[(1) - (1)].list); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 63:
|
case 63:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 430 "parse-gram.y"
|
#line 434 "parse-gram.y"
|
||||||
{ (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].list)); }
|
{ (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].list)); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 64:
|
case 64:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 434 "parse-gram.y"
|
#line 438 "parse-gram.y"
|
||||||
{ (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
|
{ (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 65:
|
case 65:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 435 "parse-gram.y"
|
#line 439 "parse-gram.y"
|
||||||
{ (yyval.list) = symbol_list_type_new ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
|
{ (yyval.list) = symbol_list_type_new ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 66:
|
case 66:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 436 "parse-gram.y"
|
#line 440 "parse-gram.y"
|
||||||
{ (yyval.list) = symbol_list_default_tagged_new ((yylsp[(1) - (1)])); }
|
{ (yyval.list) = symbol_list_default_tagged_new ((yylsp[(1) - (1)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 67:
|
case 67:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 437 "parse-gram.y"
|
#line 441 "parse-gram.y"
|
||||||
{ (yyval.list) = symbol_list_default_tagless_new ((yylsp[(1) - (1)])); }
|
{ (yyval.list) = symbol_list_default_tagless_new ((yylsp[(1) - (1)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 68:
|
case 68:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 443 "parse-gram.y"
|
#line 447 "parse-gram.y"
|
||||||
{
|
{
|
||||||
current_type = (yyvsp[(1) - (1)].uniqstr);
|
current_type = (yyvsp[(1) - (1)].uniqstr);
|
||||||
tag_seen = true;
|
tag_seen = true;
|
||||||
@@ -2410,7 +2414,7 @@ yyreduce:
|
|||||||
case 69:
|
case 69:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 448 "parse-gram.y"
|
#line 452 "parse-gram.y"
|
||||||
{
|
{
|
||||||
symbol_class_set ((yyvsp[(1) - (1)].symbol), current_class, (yylsp[(1) - (1)]), true);
|
symbol_class_set ((yyvsp[(1) - (1)].symbol), current_class, (yylsp[(1) - (1)]), true);
|
||||||
symbol_type_set ((yyvsp[(1) - (1)].symbol), current_type, (yylsp[(1) - (1)]));
|
symbol_type_set ((yyvsp[(1) - (1)].symbol), current_type, (yylsp[(1) - (1)]));
|
||||||
@@ -2420,7 +2424,7 @@ yyreduce:
|
|||||||
case 70:
|
case 70:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 453 "parse-gram.y"
|
#line 457 "parse-gram.y"
|
||||||
{
|
{
|
||||||
symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true);
|
symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true);
|
||||||
symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)]));
|
symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)]));
|
||||||
@@ -2431,7 +2435,7 @@ yyreduce:
|
|||||||
case 71:
|
case 71:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 459 "parse-gram.y"
|
#line 463 "parse-gram.y"
|
||||||
{
|
{
|
||||||
symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true);
|
symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true);
|
||||||
symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)]));
|
symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)]));
|
||||||
@@ -2442,7 +2446,7 @@ yyreduce:
|
|||||||
case 72:
|
case 72:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 465 "parse-gram.y"
|
#line 469 "parse-gram.y"
|
||||||
{
|
{
|
||||||
symbol_class_set ((yyvsp[(1) - (3)].symbol), current_class, (yylsp[(1) - (3)]), true);
|
symbol_class_set ((yyvsp[(1) - (3)].symbol), current_class, (yylsp[(1) - (3)]), true);
|
||||||
symbol_type_set ((yyvsp[(1) - (3)].symbol), current_type, (yylsp[(1) - (3)]));
|
symbol_type_set ((yyvsp[(1) - (3)].symbol), current_type, (yylsp[(1) - (3)]));
|
||||||
@@ -2454,7 +2458,7 @@ yyreduce:
|
|||||||
case 79:
|
case 79:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 495 "parse-gram.y"
|
#line 499 "parse-gram.y"
|
||||||
{
|
{
|
||||||
yyerrok;
|
yyerrok;
|
||||||
}
|
}
|
||||||
@@ -2463,70 +2467,70 @@ yyreduce:
|
|||||||
case 80:
|
case 80:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 501 "parse-gram.y"
|
#line 505 "parse-gram.y"
|
||||||
{ current_lhs = (yyvsp[(1) - (1)].symbol); current_lhs_location = (yylsp[(1) - (1)]); }
|
{ current_lhs = (yyvsp[(1) - (1)].symbol); current_lhs_location = (yylsp[(1) - (1)]); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 82:
|
case 82:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 505 "parse-gram.y"
|
#line 509 "parse-gram.y"
|
||||||
{ grammar_current_rule_end ((yylsp[(1) - (1)])); }
|
{ grammar_current_rule_end ((yylsp[(1) - (1)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 83:
|
case 83:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 506 "parse-gram.y"
|
#line 510 "parse-gram.y"
|
||||||
{ grammar_current_rule_end ((yylsp[(3) - (3)])); }
|
{ grammar_current_rule_end ((yylsp[(3) - (3)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 85:
|
case 85:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 512 "parse-gram.y"
|
#line 516 "parse-gram.y"
|
||||||
{ grammar_current_rule_begin (current_lhs, current_lhs_location); }
|
{ grammar_current_rule_begin (current_lhs, current_lhs_location); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 86:
|
case 86:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 514 "parse-gram.y"
|
#line 518 "parse-gram.y"
|
||||||
{ grammar_current_rule_symbol_append ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); }
|
{ grammar_current_rule_symbol_append ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 87:
|
case 87:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 516 "parse-gram.y"
|
#line 520 "parse-gram.y"
|
||||||
{ grammar_current_rule_action_append ((yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); }
|
{ grammar_current_rule_action_append ((yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 88:
|
case 88:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 518 "parse-gram.y"
|
#line 522 "parse-gram.y"
|
||||||
{ grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - (3)])); }
|
{ grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - (3)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 89:
|
case 89:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 520 "parse-gram.y"
|
#line 524 "parse-gram.y"
|
||||||
{ grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - (3)])); }
|
{ grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - (3)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 90:
|
case 90:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 522 "parse-gram.y"
|
#line 526 "parse-gram.y"
|
||||||
{ grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - (3)])); }
|
{ grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - (3)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 93:
|
case 93:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 538 "parse-gram.y"
|
#line 542 "parse-gram.y"
|
||||||
{
|
{
|
||||||
static char one[] = "1";
|
static char one[] = "1";
|
||||||
(yyval.chars) = one;
|
(yyval.chars) = one;
|
||||||
@@ -2536,7 +2540,7 @@ yyreduce:
|
|||||||
case 95:
|
case 95:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 548 "parse-gram.y"
|
#line 552 "parse-gram.y"
|
||||||
{
|
{
|
||||||
code_props plain_code;
|
code_props plain_code;
|
||||||
(yyvsp[(1) - (1)].code)[strlen ((yyvsp[(1) - (1)].code)) - 1] = '\n';
|
(yyvsp[(1) - (1)].code)[strlen ((yyvsp[(1) - (1)].code)) - 1] = '\n';
|
||||||
@@ -2550,14 +2554,14 @@ yyreduce:
|
|||||||
case 96:
|
case 96:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 568 "parse-gram.y"
|
#line 572 "parse-gram.y"
|
||||||
{ (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
|
{ (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 97:
|
case 97:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 570 "parse-gram.y"
|
#line 574 "parse-gram.y"
|
||||||
{
|
{
|
||||||
(yyval.symbol) = symbol_get (char_name ((yyvsp[(1) - (1)].character)), (yylsp[(1) - (1)]));
|
(yyval.symbol) = symbol_get (char_name ((yyvsp[(1) - (1)].character)), (yylsp[(1) - (1)]));
|
||||||
symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false);
|
symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false);
|
||||||
@@ -2568,14 +2572,14 @@ yyreduce:
|
|||||||
case 98:
|
case 98:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 578 "parse-gram.y"
|
#line 582 "parse-gram.y"
|
||||||
{ (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
|
{ (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 101:
|
case 101:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 590 "parse-gram.y"
|
#line 594 "parse-gram.y"
|
||||||
{
|
{
|
||||||
(yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[(1) - (1)].chars)), (yylsp[(1) - (1)]));
|
(yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[(1) - (1)].chars)), (yylsp[(1) - (1)]));
|
||||||
symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false);
|
symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false);
|
||||||
@@ -2585,7 +2589,7 @@ yyreduce:
|
|||||||
case 103:
|
case 103:
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 599 "parse-gram.y"
|
#line 603 "parse-gram.y"
|
||||||
{
|
{
|
||||||
code_props plain_code;
|
code_props plain_code;
|
||||||
code_props_plain_init (&plain_code, (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)]));
|
code_props_plain_init (&plain_code, (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)]));
|
||||||
@@ -2599,7 +2603,7 @@ yyreduce:
|
|||||||
|
|
||||||
|
|
||||||
/* Line 1280 of yacc.c */
|
/* Line 1280 of yacc.c */
|
||||||
#line 2603 "parse-gram.c"
|
#line 2607 "parse-gram.c"
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
||||||
@@ -2818,7 +2822,7 @@ yyreturn:
|
|||||||
|
|
||||||
|
|
||||||
/* Line 1497 of yacc.c */
|
/* Line 1497 of yacc.c */
|
||||||
#line 609 "parse-gram.y"
|
#line 613 "parse-gram.y"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -323,9 +323,13 @@ grammar_declaration:
|
|||||||
muscle_code_grow (uniqstr_new (name), $3, @3);
|
muscle_code_grow (uniqstr_new (name), $3, @3);
|
||||||
free (name);
|
free (name);
|
||||||
code_scanner_last_string_free ();
|
code_scanner_last_string_free ();
|
||||||
muscle_grow ("used_percent_code_qualifiers", "[[", ",");
|
muscle_grow ("used_percent_code_qualifiers", "[[[[", ",");
|
||||||
muscle_grow ("used_percent_code_qualifiers", $2, "");
|
muscle_grow ("used_percent_code_qualifiers", $2, "");
|
||||||
muscle_grow ("used_percent_code_qualifiers", "]]", "");
|
muscle_grow ("used_percent_code_qualifiers", "]], [[", "");
|
||||||
|
muscle_boundary_grow ("used_percent_code_qualifiers", @2.start);
|
||||||
|
muscle_grow ("used_percent_code_qualifiers", "]], [[", "");
|
||||||
|
muscle_boundary_grow ("used_percent_code_qualifiers", @2.end);
|
||||||
|
muscle_grow ("used_percent_code_qualifiers", "]]]]", "");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
210
src/scan-skel.l
210
src/scan-skel.l
@@ -47,15 +47,18 @@ YY_DECL;
|
|||||||
#define QPUTS(String) \
|
#define QPUTS(String) \
|
||||||
fputs (quotearg_style (c_quoting_style, String), yyout)
|
fputs (quotearg_style (c_quoting_style, String), yyout)
|
||||||
|
|
||||||
|
static void at_directive_perform (char **outnamep, int *out_linenop);
|
||||||
static void fail_for_at_directive_too_many_args (void);
|
static void fail_for_at_directive_too_many_args (void);
|
||||||
|
static void fail_for_at_directive_too_few_args (void);
|
||||||
static void fail_for_invalid_at (char const *at);
|
static void fail_for_invalid_at (char const *at);
|
||||||
|
|
||||||
/* In SC_AT_DIRECTIVE_ARG context, the name of the directive. */
|
/* In SC_AT_DIRECTIVE_ARG context, the name of the directive. */
|
||||||
static char *at_directive_name;
|
static char *at_directive_name;
|
||||||
|
|
||||||
/* Currently, only the @warn, @complain, and @fatal directives take multiple
|
/* Currently, only the @warn, @complain, @fatal, @warn_at, @complain_at, and
|
||||||
arguments, and they already can't take more than 5. */
|
@fatal_at directives take multiple arguments, and the last three already
|
||||||
#define AT_DIRECTIVE_ARGC_MAX 5
|
can't take more than 7. */
|
||||||
|
#define AT_DIRECTIVE_ARGC_MAX 7
|
||||||
static int at_directive_argc = 0;
|
static int at_directive_argc = 0;
|
||||||
static char *at_directive_argv[AT_DIRECTIVE_ARGC_MAX];
|
static char *at_directive_argv[AT_DIRECTIVE_ARGC_MAX];
|
||||||
%}
|
%}
|
||||||
@@ -66,7 +69,7 @@ static char *at_directive_argv[AT_DIRECTIVE_ARGC_MAX];
|
|||||||
%%
|
%%
|
||||||
|
|
||||||
%{
|
%{
|
||||||
int lineno IF_LINT (= 0);
|
int out_lineno IF_LINT (= 0);
|
||||||
char *outname = NULL;
|
char *outname = NULL;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
@@ -74,7 +77,7 @@ static char *at_directive_argv[AT_DIRECTIVE_ARGC_MAX];
|
|||||||
"@{" fputc ('[', yyout);
|
"@{" fputc ('[', yyout);
|
||||||
"@}" fputc (']', yyout);
|
"@}" fputc (']', yyout);
|
||||||
|
|
||||||
"@oline@" fprintf (yyout, "%d", lineno + 1);
|
"@oline@" fprintf (yyout, "%d", out_lineno + 1);
|
||||||
"@ofile@" QPUTS (outname);
|
"@ofile@" QPUTS (outname);
|
||||||
"@dir_prefix@" QPUTS (dir_prefix);
|
"@dir_prefix@" QPUTS (dir_prefix);
|
||||||
|
|
||||||
@@ -86,7 +89,7 @@ static char *at_directive_argv[AT_DIRECTIVE_ARGC_MAX];
|
|||||||
|
|
||||||
/* This pattern must not match more than the previous @ patterns. */
|
/* This pattern must not match more than the previous @ patterns. */
|
||||||
@[^@{}(\n]* fail_for_invalid_at (yytext);
|
@[^@{}(\n]* fail_for_invalid_at (yytext);
|
||||||
\n lineno++; ECHO;
|
\n out_lineno++; ECHO;
|
||||||
[^@\n]+ ECHO;
|
[^@\n]+ ECHO;
|
||||||
|
|
||||||
<INITIAL><<EOF>> {
|
<INITIAL><<EOF>> {
|
||||||
@@ -99,8 +102,7 @@ static char *at_directive_argv[AT_DIRECTIVE_ARGC_MAX];
|
|||||||
}
|
}
|
||||||
|
|
||||||
<SC_AT_DIRECTIVE_ARG>{
|
<SC_AT_DIRECTIVE_ARG>{
|
||||||
[^@\n]+ { STRING_GROW; }
|
[^@]+ { STRING_GROW; }
|
||||||
\n { ++lineno; STRING_GROW; }
|
|
||||||
|
|
||||||
"@@" { obstack_1grow (&obstack_for_string, '@'); }
|
"@@" { obstack_1grow (&obstack_for_string, '@'); }
|
||||||
"@{" { obstack_1grow (&obstack_for_string, '['); }
|
"@{" { obstack_1grow (&obstack_for_string, '['); }
|
||||||
@@ -121,67 +123,7 @@ static char *at_directive_argv[AT_DIRECTIVE_ARGC_MAX];
|
|||||||
BEGIN SC_AT_DIRECTIVE_SKIP_WS;
|
BEGIN SC_AT_DIRECTIVE_SKIP_WS;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (0 == strcmp (at_directive_name, "@basename"))
|
at_directive_perform (&outname, &out_lineno);
|
||||||
{
|
|
||||||
if (at_directive_argc > 1)
|
|
||||||
fail_for_at_directive_too_many_args ();
|
|
||||||
fputs (last_component (at_directive_argv[0]), yyout);
|
|
||||||
}
|
|
||||||
else if (0 == strcmp (at_directive_name, "@warn")
|
|
||||||
|| 0 == strcmp (at_directive_name, "@complain")
|
|
||||||
|| 0 == strcmp (at_directive_name, "@fatal"))
|
|
||||||
{
|
|
||||||
void (*func)(char const *, ...);
|
|
||||||
switch (at_directive_name[1])
|
|
||||||
{
|
|
||||||
case 'w': func = warn; break;
|
|
||||||
case 'c': func = complain; break;
|
|
||||||
case 'f': func = fatal; break;
|
|
||||||
default: aver (false); func = NULL; break;
|
|
||||||
}
|
|
||||||
switch (at_directive_argc)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
func (_(at_directive_argv[0]));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
func (_(at_directive_argv[0]), at_directive_argv[1]);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
func (_(at_directive_argv[0]), at_directive_argv[1],
|
|
||||||
at_directive_argv[2]);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
func (_(at_directive_argv[0]), at_directive_argv[1],
|
|
||||||
at_directive_argv[2], at_directive_argv[3]);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
func (_(at_directive_argv[0]), at_directive_argv[1],
|
|
||||||
at_directive_argv[2], at_directive_argv[3],
|
|
||||||
at_directive_argv[4]);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fail_for_at_directive_too_many_args ();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (0 == strcmp (at_directive_name, "@output"))
|
|
||||||
{
|
|
||||||
if (at_directive_argc > 1)
|
|
||||||
fail_for_at_directive_too_many_args ();
|
|
||||||
if (outname)
|
|
||||||
{
|
|
||||||
free (outname);
|
|
||||||
xfclose (yyout);
|
|
||||||
}
|
|
||||||
outname = xstrdup (at_directive_argv[0]);
|
|
||||||
output_file_name_check (outname);
|
|
||||||
yyout = xfopen (outname, "w");
|
|
||||||
lineno = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fail_for_invalid_at (at_directive_name);
|
|
||||||
|
|
||||||
obstack_free (&obstack_for_string, at_directive_argv[0]);
|
obstack_free (&obstack_for_string, at_directive_argv[0]);
|
||||||
at_directive_argc = 0;
|
at_directive_argc = 0;
|
||||||
free (at_directive_name);
|
free (at_directive_name);
|
||||||
@@ -193,8 +135,7 @@ static char *at_directive_argv[AT_DIRECTIVE_ARGC_MAX];
|
|||||||
}
|
}
|
||||||
|
|
||||||
<SC_AT_DIRECTIVE_SKIP_WS>{
|
<SC_AT_DIRECTIVE_SKIP_WS>{
|
||||||
[ \t\r]
|
[ \t\r\n]
|
||||||
\n { ++lineno; }
|
|
||||||
. { yyless (0); BEGIN SC_AT_DIRECTIVE_ARG; }
|
. { yyless (0); BEGIN SC_AT_DIRECTIVE_ARG; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,6 +167,127 @@ scan_skel (FILE *in)
|
|||||||
yylex_destroy ();
|
yylex_destroy ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
skel_scanner_free (void)
|
||||||
|
{
|
||||||
|
obstack_free (&obstack_for_string, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
void at_directive_perform (char **outnamep, int *out_linenop)
|
||||||
|
{
|
||||||
|
if (0 == strcmp (at_directive_name, "@basename"))
|
||||||
|
{
|
||||||
|
if (at_directive_argc > 1)
|
||||||
|
fail_for_at_directive_too_many_args ();
|
||||||
|
fputs (last_component (at_directive_argv[0]), yyout);
|
||||||
|
}
|
||||||
|
else if (0 == strcmp (at_directive_name, "@warn")
|
||||||
|
|| 0 == strcmp (at_directive_name, "@complain")
|
||||||
|
|| 0 == strcmp (at_directive_name, "@fatal"))
|
||||||
|
{
|
||||||
|
void (*func)(char const *, ...);
|
||||||
|
switch (at_directive_name[1])
|
||||||
|
{
|
||||||
|
case 'w': func = warn; break;
|
||||||
|
case 'c': func = complain; break;
|
||||||
|
case 'f': func = fatal; break;
|
||||||
|
default: aver (false); func = NULL; break;
|
||||||
|
}
|
||||||
|
switch (at_directive_argc)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
func (_(at_directive_argv[0]));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
func (_(at_directive_argv[0]), at_directive_argv[1]);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
func (_(at_directive_argv[0]), at_directive_argv[1],
|
||||||
|
at_directive_argv[2]);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
func (_(at_directive_argv[0]), at_directive_argv[1],
|
||||||
|
at_directive_argv[2], at_directive_argv[3]);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
func (_(at_directive_argv[0]), at_directive_argv[1],
|
||||||
|
at_directive_argv[2], at_directive_argv[3],
|
||||||
|
at_directive_argv[4]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fail_for_at_directive_too_many_args ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (0 == strcmp (at_directive_name, "@warn_at")
|
||||||
|
|| 0 == strcmp (at_directive_name, "@complain_at")
|
||||||
|
|| 0 == strcmp (at_directive_name, "@fatal_at"))
|
||||||
|
{
|
||||||
|
void (*func)(location, char const *, ...);
|
||||||
|
location loc;
|
||||||
|
if (at_directive_argc < 3)
|
||||||
|
fail_for_at_directive_too_few_args ();
|
||||||
|
switch (at_directive_name[1])
|
||||||
|
{
|
||||||
|
case 'w': func = warn_at; break;
|
||||||
|
case 'c': func = complain_at; break;
|
||||||
|
case 'f': func = fatal_at; break;
|
||||||
|
default: aver (false); func = NULL; break;
|
||||||
|
}
|
||||||
|
boundary_set_from_string (&loc.start, at_directive_argv[0]);
|
||||||
|
boundary_set_from_string (&loc.end, at_directive_argv[1]);
|
||||||
|
switch (at_directive_argc)
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
func (loc, _(at_directive_argv[2]));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
func (loc, _(at_directive_argv[2]), at_directive_argv[3]);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
func (loc, _(at_directive_argv[2]), at_directive_argv[3],
|
||||||
|
at_directive_argv[4]);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
func (loc, _(at_directive_argv[2]), at_directive_argv[3],
|
||||||
|
at_directive_argv[4], at_directive_argv[5]);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
func (loc, _(at_directive_argv[2]), at_directive_argv[3],
|
||||||
|
at_directive_argv[4], at_directive_argv[5],
|
||||||
|
at_directive_argv[6]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fail_for_at_directive_too_many_args ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (0 == strcmp (at_directive_name, "@output"))
|
||||||
|
{
|
||||||
|
if (at_directive_argc > 1)
|
||||||
|
fail_for_at_directive_too_many_args ();
|
||||||
|
if (*outnamep)
|
||||||
|
{
|
||||||
|
free (*outnamep);
|
||||||
|
xfclose (yyout);
|
||||||
|
}
|
||||||
|
*outnamep = xstrdup (at_directive_argv[0]);
|
||||||
|
output_file_name_check (*outnamep);
|
||||||
|
yyout = xfopen (*outnamep, "w");
|
||||||
|
*out_linenop = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fail_for_invalid_at (at_directive_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fail_for_at_directive_too_few_args (void)
|
||||||
|
{
|
||||||
|
fatal (_("too few arguments for %s directive in skeleton"),
|
||||||
|
at_directive_name);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fail_for_at_directive_too_many_args (void)
|
fail_for_at_directive_too_many_args (void)
|
||||||
{
|
{
|
||||||
@@ -238,9 +300,3 @@ fail_for_invalid_at (char const *at)
|
|||||||
{
|
{
|
||||||
fatal ("invalid @ in skeleton: %s", at);
|
fatal ("invalid @ in skeleton: %s", at);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
skel_scanner_free (void)
|
|
||||||
{
|
|
||||||
obstack_free (&obstack_for_string, 0);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -711,38 +711,80 @@ AT_SETUP([Reject bad %code qualifiers])
|
|||||||
|
|
||||||
AT_DATA([input-c.y],
|
AT_DATA([input-c.y],
|
||||||
[[%code "" {}
|
[[%code "" {}
|
||||||
|
%code "bad" {}
|
||||||
|
%code "bad" {}
|
||||||
%%
|
%%
|
||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_CHECK([[bison input-c.y]], [1], [],
|
AT_CHECK([[bison input-c.y]], [1], [],
|
||||||
[[input-c.y: `' is not a recognized %code qualifier
|
[[input-c.y:1.7-8: `' is not a recognized %code qualifier
|
||||||
|
input-c.y:2.7-11: `bad' is not a recognized %code qualifier
|
||||||
|
input-c.y:3.7-11: `bad' is not a recognized %code qualifier
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA([input-c-glr.y],
|
AT_DATA([input-c-glr.y],
|
||||||
[[%code "bad" {}
|
[[%code "" {}
|
||||||
|
%code "bad" {}
|
||||||
|
%code "bad" {}
|
||||||
%%
|
%%
|
||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_CHECK([[bison input-c-glr.y]], [1], [],
|
AT_CHECK([[bison input-c-glr.y]], [1], [],
|
||||||
[[input-c-glr.y: `bad' is not a recognized %code qualifier
|
[[input-c-glr.y:1.7-8: `' is not a recognized %code qualifier
|
||||||
|
input-c-glr.y:2.7-11: `bad' is not a recognized %code qualifier
|
||||||
|
input-c-glr.y:3.8-12: `bad' is not a recognized %code qualifier
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA([input-c++.y],
|
AT_DATA([input-c++.y],
|
||||||
[[%code "bad" {}
|
[[%code "" {}
|
||||||
|
%code "bad" {}
|
||||||
|
%code "" {}
|
||||||
%%
|
%%
|
||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_CHECK([[bison input-c++.y]], [1], [],
|
AT_CHECK([[bison input-c++.y]], [1], [],
|
||||||
[[input-c++.y: `bad' is not a recognized %code qualifier
|
[[input-c++.y:1.7-8: `' is not a recognized %code qualifier
|
||||||
|
input-c++.y:2.7-11: `bad' is not a recognized %code qualifier
|
||||||
|
input-c++.y:3.8-9: `' is not a recognized %code qualifier
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA([input-c++-glr.y],
|
AT_DATA([input-c++-glr.y],
|
||||||
[[%code "bad" {}
|
[[%code "bad" {}
|
||||||
|
%code "" {}
|
||||||
|
%code "" {}
|
||||||
%%
|
%%
|
||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_CHECK([[bison input-c++-glr.y]], [1], [],
|
AT_CHECK([[bison input-c++-glr.y]], [1], [],
|
||||||
[[input-c++-glr.y: `bad' is not a recognized %code qualifier
|
[[input-c++-glr.y:1.7-11: `bad' is not a recognized %code qualifier
|
||||||
|
input-c++-glr.y:2.7-8: `' is not a recognized %code qualifier
|
||||||
|
input-c++-glr.y:3.7-8: `' is not a recognized %code qualifier
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_DATA([special-char-@@.y],
|
||||||
|
[[%code "bad" {}
|
||||||
|
%code "" {}
|
||||||
|
%code "" {}
|
||||||
|
%%
|
||||||
|
start: ;
|
||||||
|
]])
|
||||||
|
AT_CHECK([[bison special-char-@@.y]], [1], [],
|
||||||
|
[[special-char-@@.y:1.7-11: `bad' is not a recognized %code qualifier
|
||||||
|
special-char-@@.y:2.7-8: `' is not a recognized %code qualifier
|
||||||
|
special-char-@@.y:3.7-8: `' is not a recognized %code qualifier
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_DATA([special-char-@:>@.y],
|
||||||
|
[[%code "bad" {}
|
||||||
|
%code "" {}
|
||||||
|
%code "" {}
|
||||||
|
%%
|
||||||
|
start: ;
|
||||||
|
]])
|
||||||
|
AT_CHECK([[bison special-char-@:>@.y]], [1], [],
|
||||||
|
[[special-char-@:>@.y:1.7-11: `bad' is not a recognized %code qualifier
|
||||||
|
special-char-@:>@.y:2.7-8: `' is not a recognized %code qualifier
|
||||||
|
special-char-@:>@.y:3.7-8: `' is not a recognized %code qualifier
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|||||||
@@ -193,8 +193,5 @@ AT_CHECK_OUTPUT_FILE_NAME([[#]])
|
|||||||
AT_CHECK_OUTPUT_FILE_NAME([[@@]])
|
AT_CHECK_OUTPUT_FILE_NAME([[@@]])
|
||||||
AT_CHECK_OUTPUT_FILE_NAME([[@{]])
|
AT_CHECK_OUTPUT_FILE_NAME([[@{]])
|
||||||
AT_CHECK_OUTPUT_FILE_NAME([[@}]])
|
AT_CHECK_OUTPUT_FILE_NAME([[@}]])
|
||||||
|
|
||||||
# Bison isn't M4-quoting file names before inserting them into muscles, so
|
|
||||||
# these tests currently fail.
|
|
||||||
AT_CHECK_OUTPUT_FILE_NAME([[@<:@]])
|
AT_CHECK_OUTPUT_FILE_NAME([[@<:@]])
|
||||||
AT_CHECK_OUTPUT_FILE_NAME([[@:>@]])
|
AT_CHECK_OUTPUT_FILE_NAME([[@:>@]])
|
||||||
|
|||||||
Reference in New Issue
Block a user