b4_tables_map.

The point is to factor the generation of the tables across skeletons.
This is language dependant.

	* data/c.m4 (b4_comment_): New.
	Should be usable to define how to generate tables independently of
	the language.
	(b4_c_comment): New.
	(b4_comment): Bounce to b4_c_comment.
	Now support $2 = [PREFIX] for indentation.
	* data/lalr1.cc (b4_table_declare): Don't output a comment if
	there is no comment.
	Indent it properly when there is one.
	Output the ending semicolon.
	(b4_table_define): Space changes.
	Output the ending semicolon.
	(b4_tables_map): New.
	Use it twice instead of declaring and defining the (integral)
	tables by hand.
This commit is contained in:
Akim Demaille
2008-11-22 22:22:43 +01:00
parent 0fddb3d59f
commit 6ab1adbe1e
3 changed files with 93 additions and 50 deletions

View File

@@ -21,14 +21,34 @@
## Identification. ##
## ---------------- ##
# b4_comment(TEXT)
# ----------------
# 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([$1], [
\(.\)], [
$3\1])$4])
# b4_c_comment(TEXT, [PREFIX])
# ----------------------------
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
# Avoid adding indentation to the first line, as the indentation comes
# from "/*". That's why we don't patsubst([$1], [^\(.\)], [ \1]).
m4_define([b4_comment], [/* m4_bpatsubst([$1], [
\(.\)], [
\1]) */])
#
# Prefix all the output lines with PREFIX.
m4_define([b4_c_comment],
[b4_comment_([$1], [$2/* ], [$2 ], [$2 */])])
# b4_comment(TEXT, [PREFIX])
# --------------------------
# By default, C comments.
m4_define([b4_comment], [b4_c_comment($@)])
# b4_identification
# -----------------