]> git.saurik.com Git - bison.git/blame - data/c-like.m4
glr: formatting changes
[bison.git] / data / c-like.m4
CommitLineData
cd735a8c
AD
1 -*- Autoconf -*-
2
3# Common code for C-like languages (C, C++, Java, etc.)
4
7d6bad19 5# Copyright (C) 2012-2013 Free Software Foundation, Inc.
cd735a8c
AD
6
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
6f0a6f27
AD
20# b4_comment_(TEXT, OPEN, CONTINUE, END)
21# --------------------------------------
22# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
23# Avoid adding indentation to the first line, as the indentation comes
24# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
25#
26# Prefix all the output lines with PREFIX.
27m4_define([b4_comment_],
28[$2[]m4_bpatsubst(m4_expand([[$1]]), [
29\(.\)], [
30$3\1])$4])
31
32
33# b4_comment(TEXT, [PREFIX])
34# --------------------------
35# Put TEXT in comment. Prefix all the output lines with PREFIX.
36m4_define([b4_comment],
37[b4_comment_([$1], [$2/* ], [$2 ], [ */])])
38
39
40
41
cd735a8c
AD
42# b4_dollar_dollar_(VALUE, FIELD, DEFAULT-FIELD)
43# ----------------------------------------------
44# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",
45# otherwise just VALUE. Be sure to pass "(VALUE)" is VALUE is a
46# pointer.
47m4_define([b4_dollar_dollar_],
4323e0da
AD
48[b4_symbol_value([$1],
49 m4_if([$2], [[]],
50 [[$3]], [[$2]]))])
cd735a8c
AD
51
52# b4_dollar_pushdef(VALUE-POINTER, DEFAULT-FIELD, LOCATION)
53# b4_dollar_popdef
54# ---------------------------------------------------------
55# Define b4_dollar_dollar for VALUE and DEFAULT-FIELD,
56# and b4_at_dollar for LOCATION.
57m4_define([b4_dollar_pushdef],
58[m4_pushdef([b4_dollar_dollar],
59 [b4_dollar_dollar_([$1], m4_dquote($][1), [$2])])dnl
60m4_pushdef([b4_at_dollar], [$3])dnl
61])
62m4_define([b4_dollar_popdef],
63[m4_popdef([b4_at_dollar])dnl
64m4_popdef([b4_dollar_dollar])dnl
65])