mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
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:
30
data/c.m4
30
data/c.m4
@@ -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
|
||||
# -----------------
|
||||
|
||||
Reference in New Issue
Block a user