skeletons: fix comments

The commit 38de4e570f underquoted the
content of the comments, which resulted in losing square brackets in
the comments.  Besides, some other invocations were underquoting the
effective arguments.

* data/c.m4 (b4_comment_): Properly quote the comment.
(b4_comment_, b4_comment): Move to...
* data/c-like.m4: here, so that...
* data/java.m4: can use it instead of its own copy.
* data/bison.m4 (b4_integral_parser_tables_map): Fix some comments.

* data/lalr1.cc, data/lalr1.java, data/yacc.c: Comment fixes.

* data/lalr1.cc: Reorder a bit to factor some CPP directives.
This commit is contained in:
Akim Demaille
2012-12-27 10:01:58 +01:00
parent e672a4ba5e
commit 6f0a6f274c
7 changed files with 37 additions and 44 deletions

View File

@@ -250,30 +250,30 @@ m4_define([b4_integral_parser_tables_map],
STATE-NUM.]])
$1([defact], [b4_defact],
[[YYDEFACT[S] -- default reduction number in state S. Performed when
YYTABLE does not specify something else to do. Zero means the default
is an error.]])
[[YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
Performed when YYTABLE does not specify something else to do. Zero
means the default is an error.]])
$1([pgoto], [b4_pgoto], [[YYPGOTO[NTERM-NUM].]])
$1([defgoto], [b4_defgoto], [[YYDEFGOTO[NTERM-NUM].]])
$1([table], [b4_table],
[[YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
[[YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule whose
number is the opposite. If YYTABLE_NINF, syntax error.]])
$1([check], [b4_check])
$1([stos], [b4_stos],
[[STOS_[STATE-NUM] -- The (internal number of the) accessing
[[YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM.]])
$1([r1], [b4_r1],
[[YYR1[YYN] -- Symbol number of symbol that rule YYN derives.]])
$1([r2], [b4_r2],
[[YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.]])
[[YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.]])
])

View File

@@ -17,6 +17,28 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# b4_comment_(TEXT, OPEN, CONTINUE, END)
# --------------------------------------
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
# Avoid adding indentation to the first line, as the indentation comes
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
#
# Prefix all the output lines with PREFIX.
m4_define([b4_comment_],
[$2[]m4_bpatsubst(m4_expand([[$1]]), [
\(.\)], [
$3\1])$4])
# b4_comment(TEXT, [PREFIX])
# --------------------------
# Put TEXT in comment. Prefix all the output lines with PREFIX.
m4_define([b4_comment],
[b4_comment_([$1], [$2/* ], [$2 ], [ */])])
# b4_dollar_dollar_(VALUE, FIELD, DEFAULT-FIELD)
# ----------------------------------------------
# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",

View File

@@ -51,26 +51,6 @@ m4_define([b4_cpp_guard_close],
## Identification. ##
## ---------------- ##
# b4_comment_(TEXT, OPEN, CONTINUE, END)
# --------------------------------------
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
# Avoid adding indentation to the first line, as the indentation comes
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
#
# Prefix all the output lines with PREFIX.
m4_define([b4_comment_],
[$2[]m4_bpatsubst(m4_expand([$1]), [
\(.\)], [
$3\1])$4])
# b4_comment(TEXT, [PREFIX])
# --------------------------
# Put TEXT in comment. Prefix all the output lines with PREFIX.
m4_define([b4_comment],
[b4_comment_([$1], [$2/* ], [$2 ], [ */])])
# b4_identification
# -----------------
# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or

View File

@@ -19,15 +19,9 @@
m4_include(b4_pkgdatadir/[c-like.m4])
# b4_comment(TEXT)
# ----------------
m4_define([b4_comment], [/* m4_bpatsubst([$1], [
], [
]) */])
# b4_list2(LIST1, LIST2)
# --------------------------
# ----------------------
# Join two lists with a comma if necessary.
m4_define([b4_list2],
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])

View File

@@ -227,6 +227,9 @@ b4_location_define])])[
static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_;
static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_;
/// Convert a scanner token number \a t to a symbol number.
static inline token_number_type yytranslate_ (]b4_token_ctor_if([token_type], [int])[ t);
// Tables.
]b4_parser_tables_declare[]b4_error_verbose_if([
@@ -238,7 +241,7 @@ b4_location_define])])[
static const char* const yytname_[];
]b4_token_table_if([[#if ]b4_api_PREFIX[DEBUG]])[
]b4_integral_parser_table_declare([rline], [b4_rline],
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
[[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
/// Report on the debug stream that the rule \a r is going to be reduced.
virtual void yy_reduce_print_ (int r);
/// Print the state stack on the debug stream.
@@ -247,12 +250,7 @@ b4_location_define])])[
// Debugging.
int yydebug_;
std::ostream* yycdebug_;
#endif // ]b4_api_PREFIX[DEBUG
/// Convert a scanner token number \a t to a symbol number.
static inline token_number_type yytranslate_ (]b4_token_ctor_if([token_type], [int])[ t);
#if ]b4_api_PREFIX[DEBUG
/// \brief Display a symbol type, value and location.
/// \param yyo The output stream.
/// \param yysym The symbol.
@@ -269,7 +267,6 @@ b4_location_define])])[
inline void yy_destroy_ (const char* yymsg,
symbol_base_type<Exact>& yysym) const;
private:
/// Element of the stack: a state and its attributes.
struct stack_symbol_type : symbol_base_type<stack_symbol_type>
{

View File

@@ -815,15 +815,15 @@ b4_dollar_popdef])[]dnl
]b4_parser_tables_define[
]b4_integral_parser_table_define([token_number], [b4_toknum],
[TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
to YYLEX-NUM.])[
[[YYTOKEN_NUMBER[YYLEX-NUM] -- Internal symbol number corresponding
to YYLEX-NUM.]])[
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
]b4_typed_parser_table_define([String], [tname], [b4_tname])[
]b4_integral_parser_table_define([rline], [b4_rline],
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
[[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
// Report on the debug stream that the rule yyrule is going to be reduced.
private void yy_reduce_print (int yyrule, YYStack yystack)

View File

@@ -604,7 +604,7 @@ static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
#if ]b4_api_PREFIX[DEBUG
]b4_integral_parser_table_define([rline], [b4_rline],
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
[[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
#endif
#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[