mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 23:03:04 +00:00
* data/c.m4 (b4_copyright, b4_sint_type, b4_uint_type, b4_token_define)
(b4_token_enum, b4_token_defines): New, factored from... * data/lalr1.cc, data/yacc.c, glr.c: here.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
m4_divert(-1)
|
||||
|
||||
# C++ skeleton for Bison
|
||||
# Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
@@ -18,24 +17,7 @@ m4_divert(-1)
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
# 02111-1307 USA
|
||||
|
||||
|
||||
# b4_sint_type(MAX)
|
||||
# -----------------
|
||||
# Return the smallest signed int type able to handle the number MAX.
|
||||
m4_define([b4_sint_type],
|
||||
[m4_if(m4_eval([$1 <= 127]), [1], [signed char],
|
||||
m4_eval([$1 <= 32767]), [1], [signed short],
|
||||
[signed int])])
|
||||
|
||||
|
||||
# b4_uint_type(MAX)
|
||||
# -----------------
|
||||
# Return the smallest unsigned int type able to handle the number MAX.
|
||||
m4_define([b4_uint_type],
|
||||
[m4_if(m4_eval([$1 <= 255]), [1], [unsigned char],
|
||||
m4_eval([$1 <= 65535]), [1], [unsigned short],
|
||||
[unsigned int])])
|
||||
|
||||
m4_include([c.m4])
|
||||
|
||||
# b4_lhs_value([TYPE])
|
||||
# --------------------
|
||||
@@ -67,20 +49,6 @@ m4_define([b4_rhs_location],
|
||||
[location_stack_@<:@m4_eval([$1 - $2])@:>@])
|
||||
|
||||
|
||||
# b4_token_define(TOKEN-NAME, TOKEN-NUMBER)
|
||||
# -----------------------------------------
|
||||
# Output the definition of this token as #define.
|
||||
m4_define([b4_token_define],
|
||||
[#define $1 $2
|
||||
])
|
||||
|
||||
|
||||
# b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||
# -------------------------------------------------------
|
||||
# Output the definition of the tokens as #define.
|
||||
m4_define([b4_token_defines],
|
||||
[m4_map([b4_token_define], [$@])])
|
||||
|
||||
m4_define_default([b4_input_suffix], [.y])
|
||||
|
||||
m4_define_default([b4_output_parser_suffix],
|
||||
@@ -118,37 +86,11 @@ m4_define([b4_constructor],
|
||||
],
|
||||
[])])
|
||||
|
||||
m4_define([b4_copyright],
|
||||
[/* -*- C++ -*- */
|
||||
/* A Bison parser, made from b4_filename,
|
||||
by GNU bison b4_version. */
|
||||
|
||||
/* Skeleton output parser for bison,
|
||||
Copyright 2002 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
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
This special exception was added by the Free Software Foundation
|
||||
in version 1.24 of Bison. */])
|
||||
|
||||
m4_divert(0)dnl
|
||||
#output "b4_output_header_name"
|
||||
b4_copyright
|
||||
b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
|
||||
[2002])
|
||||
#ifndef b4_header_guard
|
||||
# define b4_header_guard
|
||||
|
||||
@@ -353,7 +295,8 @@ namespace yy
|
||||
#endif /* not b4_header_guard */
|
||||
|
||||
#output "b4_output_prefix[]b4_output_infix[].cc"
|
||||
b4_copyright
|
||||
b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
|
||||
[2002])
|
||||
|
||||
#include "b4_output_header_name"
|
||||
|
||||
@@ -831,7 +774,7 @@ const yy::b4_name::TokenNumberType yy::b4_name::undef_token_ = b4_undef_token_nu
|
||||
b4_epilogue
|
||||
|
||||
#output "stack.hh"
|
||||
b4_copyright
|
||||
b4_copyright([2002])
|
||||
|
||||
#ifndef BISON_STACK_HH
|
||||
# define BISON_STACK_HH
|
||||
@@ -928,7 +871,7 @@ namespace yy
|
||||
#endif // not BISON_STACK_HH
|
||||
|
||||
#output "location.hh"
|
||||
b4_copyright
|
||||
b4_copyright([2002])
|
||||
|
||||
#ifndef BISON_LOCATION_HH
|
||||
# define BISON_LOCATION_HH
|
||||
|
||||
Reference in New Issue
Block a user