1 |
m4_divert(-1) -*- C -*- |
m4_divert(-1) -*- C -*- |
2 |
|
m4_include([c.m4]) |
3 |
|
|
4 |
# Yacc compatible skeleton for Bison |
# Yacc compatible skeleton for Bison |
5 |
# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. |
# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. |
19 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
20 |
# 02111-1307 USA |
# 02111-1307 USA |
21 |
|
|
|
# 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])]) |
|
|
|
|
|
|
|
22 |
# b4_lhs_value([TYPE]) |
# b4_lhs_value([TYPE]) |
23 |
# -------------------- |
# -------------------- |
24 |
# Expansion of $<TYPE>$. |
# Expansion of $<TYPE>$. |
101 |
[[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]], [_])]) |
[[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]], [_])]) |
102 |
|
|
103 |
|
|
|
## ------------------------- ## |
|
|
## Assigning token numbers. ## |
|
|
## ------------------------- ## |
|
|
|
|
|
# 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_enum(TOKEN-NAME, TOKEN-NUMBER) |
|
|
# --------------------------------------- |
|
|
# Output the definition of this token as an enum. |
|
|
m4_define([b4_token_enum], |
|
|
[$1 = $2]) |
|
|
|
|
|
|
|
|
# b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) |
|
|
# ------------------------------------------------------- |
|
|
# Output the definition of the tokens (if there are) as enums and #define. |
|
|
m4_define([b4_token_defines], |
|
|
[m4_if([$@], [[]], [], |
|
|
[/* Tokens. */ |
|
|
#ifndef YYTOKENTYPE |
|
|
# if defined (__STDC__) || defined (__cplusplus) |
|
|
/* Put the tokens into the symbol table, so that GDB and other debuggers |
|
|
know about them. */ |
|
|
enum yytokentype { |
|
|
m4_map_sep([ b4_token_enum], [, |
|
|
], |
|
|
[$@]) |
|
|
}; |
|
|
# endif |
|
|
/* POSIX requires `int' for tokens in interfaces. */ |
|
|
# define YYTOKENTYPE int |
|
|
#endif /* !YYTOKENTYPE */ |
|
|
m4_map([b4_token_define], [$@]) |
|
|
]) |
|
|
]) |
|
|
|
|
104 |
|
|
105 |
## --------------------------------------------------------- ## |
## --------------------------------------------------------- ## |
106 |
## Defining symbol actions, e.g., printers and destructors. ## |
## Defining symbol actions, e.g., printers and destructors. ## |
126 |
|
|
127 |
m4_divert(0)dnl |
m4_divert(0)dnl |
128 |
#output "b4_output_parser_name" |
#output "b4_output_parser_name" |
129 |
/* A Bison parser, made from b4_filename |
b4_copyright([Skeleton parser for Yacc-like parsing with Bison], |
130 |
by GNU bison b4_version. */ |
[1984, 1989, 1990, 2000, 2001, 2002]) |
131 |
|
|
132 |
/* Skeleton output parser for Bison, |
/* Written by Richard Stallman by simplifying the original so called |
133 |
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software |
``semantic'' parser. */ |
|
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. */ |
|
|
|
|
|
/* This is the parser code that is written into each bison parser when |
|
|
the %semantic_parser declaration is not specified in the grammar. |
|
|
It was written by Richard Stallman by simplifying the original so |
|
|
called ``semantic'' parser. */ |
|
134 |
|
|
135 |
/* All symbols defined below should begin with yy or YY, to avoid |
/* All symbols defined below should begin with yy or YY, to avoid |
136 |
infringing on user name space. This should be done even for local |
infringing on user name space. This should be done even for local |
1230 |
|
|
1231 |
b4_epilogue |
b4_epilogue |
1232 |
m4_if(b4_defines_flag, 0, [], |
m4_if(b4_defines_flag, 0, [], |
1233 |
[#output "b4_output_header_name" |
[b4_copyright([Skeleton parser for Yacc-like parsing with Bison], |
1234 |
|
[1984, 1989, 1990, 2000, 2001, 2002]) |
1235 |
|
#output "b4_output_header_name" |
1236 |
#ifndef b4_header_guard |
#ifndef b4_header_guard |
1237 |
# define b4_header_guard |
# define b4_header_guard |
1238 |
|
|