Factor b4_assert_if, b4_lex_symbol_if, and b4_variant_if.

* data/bison.m4 (b4_percent_define_if_define): New.
	* data/c++.m4 (b4_variant_if): Move to...
	* data/bison.m4: Here, using b4_percent_define_if_define.
	* data/lalr1.cc (b4_assert_if, b4_lex_symbol_if): Move to...
	* data/bison.m4: Here, using b4_percent_define_if_define.
This commit is contained in:
Akim Demaille
2008-12-31 15:07:48 +01:00
parent 1d6b689b26
commit b47b6ff7fd
4 changed files with 38 additions and 22 deletions

View File

@@ -1,3 +1,12 @@
2009-03-02 Akim Demaille <demaille@gostai.com>
Factor b4_assert_if, b4_lex_symbol_if, and b4_variant_if.
* data/bison.m4 (b4_percent_define_if_define): New.
* data/c++.m4 (b4_variant_if): Move to...
* data/bison.m4: Here, using b4_percent_define_if_define.
* data/lalr1.cc (b4_assert_if, b4_lex_symbol_if): Move to...
* data/bison.m4: Here, using b4_percent_define_if_define.
2009-03-02 Akim Demaille <demaille@gostai.com>
Dub symbol_type_base as a public type.

View File

@@ -1,8 +1,8 @@
-*- Autoconf -*-
# Language-independent M4 Macros for Bison.
# Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
# Inc.
# Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -618,6 +618,31 @@ m4_define([b4_percent_define_ifdef],
[m4_define([b4_percent_define_bison_variables(]$1[)])$2],
[$3])])
# b4_percent_define_if_define(VARIABLE)
# -------------------------------------
# Define b4_VARIABLE_if that executes its $1 or $2 depending whether VARIABLE
# was %defined.
m4_define([b4_percent_define_if_define_],
[m4_define([b4_$1_if], [b4_percent_define_ifdef([$1], [$2], [$3])])])
m4_define([b4_percent_define_if_define],
[b4_percent_define_if_define_([$1], $[1], $[2])])
## --------- ##
## Options. ##
## --------- ##
# b4_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
# b4_lex_symbol_if([IF-YYLEX-RETURNS-A-COMPLETE-SYMBOL], [IF-NOT])
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
# ----------------------------------------------
b4_percent_define_if_define([assert])
b4_percent_define_if_define([lex_symbol])
b4_percent_define_if_define([variant])
# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE])
# --------------------------------------------------------
# Mimic muscle_percent_define_flag_if in ../src/muscle_tab.h exactly. That is,

View File

@@ -2,8 +2,8 @@
# C++ skeleton for Bison
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
# Foundation, Inc.
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -284,12 +284,6 @@ m4_define([b4_public_types_define],
]])])
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
# ----------------------------------------------
m4_define([b4_variant_if],
[b4_percent_define_ifdef([[variant]], [$1], [$2])])
# b4_lhs_value([TYPE])
# --------------------
# Expansion of $<TYPE>$.

View File

@@ -47,18 +47,6 @@ m4_define([b4_integral_parser_table_define],
m4_copy([b4_symbol_value], [b4_symbol_value_template])
# b4_lex_symbol_if([IF-YYLEX-RETURNS-A-COMPLETE-SYMBOL], [IF-NOT])
# ----------------------------------------------------------------
m4_define([b4_lex_symbol_if],
[b4_percent_define_ifdef([[lex_symbol]], [$1], [$2])])
# b4_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
# ------------------------------------------------
m4_define([b4_assert_if],
[b4_percent_define_ifdef([[assert]], [$1], [$2])])
# b4_lhs_value([TYPE])
# --------------------
# Expansion of $<TYPE>$.