mirror of
https://github.com/ThomasDickey/byacc-snapshots.git
synced 2026-01-26 13:14:29 +00:00
snapshot of project "byacc", label t20110907
This commit is contained in:
parent
26439415f6
commit
3f27638c2e
60
CHANGES
60
CHANGES
@ -1,3 +1,63 @@
|
||||
2011-09-07 Thomas E. Dickey <dickey@invisible-island.net>
|
||||
|
||||
* yacc.1: document "-i" option.
|
||||
|
||||
* VERSION: bump
|
||||
|
||||
* output.c: fix an interaction between -i and -d
|
||||
|
||||
* skeleton.c, output.c, defs.h: changes to support "-i" option.
|
||||
|
||||
2011-09-06 Thomas E. Dickey <dickey@invisible-island.net>
|
||||
|
||||
* reader.c: pass explicit file-pointer to write_section()
|
||||
|
||||
* main.c:
|
||||
add "-i" option, to generate interface-file (suggested by Denis M. Wilson)
|
||||
|
||||
2011-09-05 Thomas E. Dickey <dickey@invisible-island.net>
|
||||
|
||||
* configure: regen
|
||||
|
||||
* aclocal.m4:
|
||||
resync with my-autoconf: CF_ANSI_CC_CHECK (check for $CFLAGS in $CC)
|
||||
and CF_XOPEN_SOURCE (update aix, cygwin and netbsd checks)
|
||||
|
||||
* defs.h, error.c, reader.c:
|
||||
add check for missing "}" on %parse-param and %lex-param lines (report by Denis M Wilson)
|
||||
|
||||
2011-04-01 Thomas E. Dickey <dickey@invisible-island.net>
|
||||
|
||||
* config.sub: update to 2011-04-01
|
||||
|
||||
2011-02-02 Thomas E. Dickey <dickey@invisible-island.net>
|
||||
|
||||
* config.guess: update to 2011-01-01
|
||||
|
||||
2010-12-29 Thomas E. Dickey <dickey@invisible-island.net>
|
||||
|
||||
* defs.h, skeleton.c:
|
||||
add const qualifier to skeleton data, per NetBSD changes (report by Christos Zoulas)
|
||||
|
||||
* defs.h:
|
||||
mark all of the error-functions as non-returning (report by Christos Zoulas)
|
||||
|
||||
* skeleton.c:
|
||||
use only realloc() rather than realloc+malloc, agree that systems needing this
|
||||
are very rare (prompted by NetBSD change).
|
||||
|
||||
* skeleton.c:
|
||||
remove explicit prototype for yylex() via YYLEX_DECL() macro, since that
|
||||
would prevent declaring yylex() static (request by Christos Zoulas).
|
||||
|
||||
2010-12-29 Christos.Zoulas
|
||||
|
||||
* output.c: correct definition for YYERROR_DECL()
|
||||
|
||||
2010-12-29 Thomas E. Dickey <dickey@invisible-island.net>
|
||||
|
||||
* VERSION: bump
|
||||
|
||||
2010-12-26 Thomas E. Dickey <dickey@invisible-island.net>
|
||||
|
||||
* defs.h, main.c:
|
||||
|
||||
2
MANIFEST
2
MANIFEST
@ -1,4 +1,4 @@
|
||||
MANIFEST for byacc, version t20101229
|
||||
MANIFEST for byacc, version t20110907
|
||||
--------------------------------------------------------------------------------
|
||||
MANIFEST this file
|
||||
ACKNOWLEDGEMENTS original version of byacc - 1993
|
||||
|
||||
38
aclocal.m4
vendored
38
aclocal.m4
vendored
@ -1,4 +1,4 @@
|
||||
dnl $Id: aclocal.m4,v 1.17 2010/12/26 11:58:30 tom Exp $
|
||||
dnl $Id: aclocal.m4,v 1.18 2011/09/05 23:45:06 tom Exp $
|
||||
dnl Macros for byacc configure script (Thomas E. Dickey)
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Copyright 2004-2009,2010 Thomas E. Dickey
|
||||
@ -116,12 +116,33 @@ AC_SUBST(EXTRA_CPPFLAGS)
|
||||
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_ANSI_CC_CHECK version: 10 updated: 2010/10/23 15:52:32
|
||||
dnl CF_ANSI_CC_CHECK version: 11 updated: 2011/07/01 19:47:45
|
||||
dnl ----------------
|
||||
dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
|
||||
dnl in the sharutils 4.2 distribution.
|
||||
dnl This was originally adapted from the macros 'fp_PROG_CC_STDC' and
|
||||
dnl 'fp_C_PROTOTYPES' in the sharutils 4.2 distribution.
|
||||
AC_DEFUN([CF_ANSI_CC_CHECK],
|
||||
[
|
||||
# This should have been defined by AC_PROG_CC
|
||||
: ${CC:=cc}
|
||||
|
||||
# Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
|
||||
# into CC. This will not help with broken scripts that wrap the compiler with
|
||||
# options, but eliminates a more common category of user confusion.
|
||||
AC_MSG_CHECKING(\$CC variable)
|
||||
case "$CC" in #(vi
|
||||
*[[\ \ ]]-[[IUD]]*)
|
||||
AC_MSG_RESULT(broken)
|
||||
AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
|
||||
# humor him...
|
||||
cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'`
|
||||
CC=`echo "$CC" | sed -e 's/[[ ]].*//'`
|
||||
CF_ADD_CFLAGS($cf_flags)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(ok)
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
|
||||
cf_cv_ansi_cc=no
|
||||
cf_save_CFLAGS="$CFLAGS"
|
||||
@ -965,7 +986,7 @@ fi
|
||||
fi
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_XOPEN_SOURCE version: 34 updated: 2010/05/26 05:38:42
|
||||
dnl CF_XOPEN_SOURCE version: 37 updated: 2011/08/06 20:32:05
|
||||
dnl ---------------
|
||||
dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
|
||||
dnl or adapt to the vendor's definitions to get equivalent functionality,
|
||||
@ -981,9 +1002,12 @@ cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
|
||||
cf_xopen_source=
|
||||
|
||||
case $host_os in #(vi
|
||||
aix[[456]]*) #(vi
|
||||
aix[[4-7]]*) #(vi
|
||||
cf_xopen_source="-D_ALL_SOURCE"
|
||||
;;
|
||||
cygwin) #(vi
|
||||
cf_XOPEN_SOURCE=600
|
||||
;;
|
||||
darwin[[0-8]].*) #(vi
|
||||
cf_xopen_source="-D_APPLE_C_SOURCE"
|
||||
;;
|
||||
@ -1014,7 +1038,7 @@ mirbsd*) #(vi
|
||||
# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
|
||||
;;
|
||||
netbsd*) #(vi
|
||||
# setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
|
||||
cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
|
||||
;;
|
||||
openbsd*) #(vi
|
||||
# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
|
||||
|
||||
37
config.guess
vendored
37
config.guess
vendored
@ -1,10 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
# Free Software Foundation, Inc.
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
# 2911 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2010-09-24'
|
||||
timestamp='2011-01-01'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@ -57,8 +57,8 @@ GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
|
||||
Software Foundation, Inc.
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
@ -92,7 +92,7 @@ if test $# != 0; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap 'exit 1' HUP INT TERM
|
||||
trap 'exit 1' 1 2 15
|
||||
|
||||
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
|
||||
# compiler to aid in system detection is discouraged as it requires
|
||||
@ -106,7 +106,7 @@ trap 'exit 1' HUP INT TERM
|
||||
|
||||
set_cc_for_build='
|
||||
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
|
||||
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ;
|
||||
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
|
||||
: ${TMPDIR=/tmp} ;
|
||||
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
|
||||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
|
||||
@ -270,7 +270,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
exit ;;
|
||||
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
|
||||
exitcode=$?
|
||||
trap '' 0
|
||||
exit $exitcode ;;
|
||||
Alpha\ *:Windows_NT*:*)
|
||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||
# Should we change UNAME_MACHINE based on the output of uname instead
|
||||
@ -326,8 +329,8 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
sparc) echo sparc-icl-nx7; exit ;;
|
||||
esac ;;
|
||||
s390x:SunOS:*:*)
|
||||
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
sun4H:SunOS:5.*:*)
|
||||
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
@ -495,7 +498,7 @@ EOF
|
||||
else
|
||||
echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
exit ;;
|
||||
exit ;;
|
||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||
echo m88k-dolphin-sysv3
|
||||
exit ;;
|
||||
@ -820,8 +823,8 @@ EOF
|
||||
echo x86_64-unknown-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
IA64)
|
||||
echo ia64-unknown-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
echo ia64-unknown-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
esac ;;
|
||||
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
||||
echo i${UNAME_MACHINE}-pc-mks
|
||||
@ -934,14 +937,14 @@ EOF
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||
;;
|
||||
or32:Linux:*:*)
|
||||
echo or32-unknown-linux-gnu
|
||||
exit ;;
|
||||
echo or32-unknown-linux-gnu
|
||||
exit ;;
|
||||
padre:Linux:*:*)
|
||||
echo sparc-unknown-linux-gnu
|
||||
exit ;;
|
||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||
echo hppa64-unknown-linux-gnu
|
||||
exit ;;
|
||||
echo hppa64-unknown-linux-gnu
|
||||
exit ;;
|
||||
parisc:Linux:*:* | hppa:Linux:*:*)
|
||||
# Look for CPU level
|
||||
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
||||
|
||||
75
config.sub
vendored
75
config.sub
vendored
@ -2,9 +2,9 @@
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
# Free Software Foundation, Inc.
|
||||
# 2011 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2010-09-11'
|
||||
timestamp='2011-04-01'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@ -76,8 +76,8 @@ version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
|
||||
Software Foundation, Inc.
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
@ -175,10 +175,10 @@ case $os in
|
||||
os=-chorusos
|
||||
basic_machine=$1
|
||||
;;
|
||||
-chorusrdb)
|
||||
os=-chorusrdb
|
||||
-chorusrdb)
|
||||
os=-chorusrdb
|
||||
basic_machine=$1
|
||||
;;
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
@ -283,12 +283,13 @@ case $basic_machine in
|
||||
| moxie \
|
||||
| mt \
|
||||
| msp430 \
|
||||
| nds32 | nds32le | nds32be\
|
||||
| nds32 | nds32le | nds32be \
|
||||
| nios | nios2 \
|
||||
| ns16k | ns32k \
|
||||
| open8 \
|
||||
| or32 \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
||||
| pyramid \
|
||||
| rx \
|
||||
| score \
|
||||
@ -296,12 +297,12 @@ case $basic_machine in
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||
| spu | strongarm \
|
||||
| tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||
| spu \
|
||||
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||
| ubicom32 \
|
||||
| v850 | v850e \
|
||||
| we32k \
|
||||
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||
| x86 | xc16x | xstormy16 | xtensa \
|
||||
| z8k | z80)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
@ -324,7 +325,15 @@ case $basic_machine in
|
||||
ms1)
|
||||
basic_machine=mt-unknown
|
||||
;;
|
||||
|
||||
strongarm | thumb | xscale)
|
||||
basic_machine=arm-unknown
|
||||
;;
|
||||
xscaleeb)
|
||||
basic_machine=armeb-unknown
|
||||
;;
|
||||
xscaleel)
|
||||
basic_machine=armel-unknown
|
||||
;;
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
@ -382,24 +391,25 @@ case $basic_machine in
|
||||
| nds32-* | nds32le-* | nds32be-* \
|
||||
| nios-* | nios2-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| open8-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* | rx-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
|
||||
| tahoe-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tile-* | tilegx-* \
|
||||
| tron-* \
|
||||
| ubicom32-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
||||
| xstormy16-* | xtensa*-* \
|
||||
| ymp-* \
|
||||
| z8k-* | z80-*)
|
||||
@ -539,7 +549,7 @@ case $basic_machine in
|
||||
basic_machine=craynv-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
cr16)
|
||||
cr16 | cr16-*)
|
||||
basic_machine=cr16-unknown
|
||||
os=-elf
|
||||
;;
|
||||
@ -826,10 +836,10 @@ case $basic_machine in
|
||||
basic_machine=v70-nec
|
||||
os=-sysv
|
||||
;;
|
||||
next | m*-next )
|
||||
next | m*-next)
|
||||
basic_machine=m68k-next
|
||||
case $os in
|
||||
-nextstep* )
|
||||
-nextstep*)
|
||||
;;
|
||||
-ns2*)
|
||||
os=-nextstep2
|
||||
@ -948,11 +958,14 @@ case $basic_machine in
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power) basic_machine=power-ibm
|
||||
power)
|
||||
basic_machine=power-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
ppc | ppcbe)
|
||||
basic_machine=powerpc-unknown
|
||||
;;
|
||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
ppc-* | ppcbe-*)
|
||||
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
basic_machine=powerpcle-unknown
|
||||
@ -960,9 +973,11 @@ case $basic_machine in
|
||||
ppcle-* | powerpclittle-*)
|
||||
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppc64) basic_machine=powerpc64-unknown
|
||||
ppc64)
|
||||
basic_machine=powerpc64-unknown
|
||||
;;
|
||||
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
ppc64-*)
|
||||
basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
|
||||
basic_machine=powerpc64le-unknown
|
||||
@ -1046,6 +1061,9 @@ case $basic_machine in
|
||||
basic_machine=i860-stratus
|
||||
os=-sysv4
|
||||
;;
|
||||
strongarm-* | thumb-*)
|
||||
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
@ -1178,6 +1196,9 @@ case $basic_machine in
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
xscale-* | xscalee[bl]-*)
|
||||
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
|
||||
;;
|
||||
ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
@ -1400,7 +1421,7 @@ case $os in
|
||||
-nova*)
|
||||
os=-rtmk-nova
|
||||
;;
|
||||
-ns2 )
|
||||
-ns2)
|
||||
os=-nextstep2
|
||||
;;
|
||||
-nsk*)
|
||||
@ -1597,7 +1618,7 @@ case $basic_machine in
|
||||
m88k-omron*)
|
||||
os=-luna
|
||||
;;
|
||||
*-next )
|
||||
*-next)
|
||||
os=-nextstep
|
||||
;;
|
||||
*-sequent)
|
||||
|
||||
13
defs.h
13
defs.h
@ -1,4 +1,4 @@
|
||||
/* $Id: defs.h,v 1.33 2010/12/29 20:57:30 tom Exp $ */
|
||||
/* $Id: defs.h,v 1.35 2011/09/07 08:55:03 tom Exp $ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
@ -71,10 +71,12 @@
|
||||
#if defined(VMS)
|
||||
#define CODE_SUFFIX "_code.c"
|
||||
#define DEFINES_SUFFIX "_tab.h"
|
||||
#define EXTERNS_SUFFIX "_tab.i"
|
||||
#define OUTPUT_SUFFIX "_tab.c"
|
||||
#else
|
||||
#define CODE_SUFFIX ".code.c"
|
||||
#define DEFINES_SUFFIX ".tab.h"
|
||||
#define EXTERNS_SUFFIX ".tab.i"
|
||||
#define OUTPUT_SUFFIX ".tab.c"
|
||||
#endif
|
||||
#define VERBOSE_SUFFIX ".output"
|
||||
@ -225,6 +227,7 @@ struct param
|
||||
|
||||
extern char dflag;
|
||||
extern char gflag;
|
||||
extern char iflag;
|
||||
extern char lflag;
|
||||
extern char rflag;
|
||||
extern char tflag;
|
||||
@ -242,6 +245,8 @@ extern int pure_parser;
|
||||
extern const char *const banner[];
|
||||
extern const char *const xdecls[];
|
||||
extern const char *const tables[];
|
||||
extern const char *const global_vars[];
|
||||
extern const char *const impure_vars[];
|
||||
extern const char *const hdr_defs[];
|
||||
extern const char *const hdr_vars[];
|
||||
extern const char *const body_1[];
|
||||
@ -253,10 +258,13 @@ extern const char *const trailer_2[];
|
||||
|
||||
extern char *code_file_name;
|
||||
extern char *input_file_name;
|
||||
extern char *defines_file_name;
|
||||
extern char *externs_file_name;
|
||||
|
||||
extern FILE *action_file;
|
||||
extern FILE *code_file;
|
||||
extern FILE *defines_file;
|
||||
extern FILE *externs_file;
|
||||
extern FILE *input_file;
|
||||
extern FILE *output_file;
|
||||
extern FILE *text_file;
|
||||
@ -353,6 +361,7 @@ extern void dollar_warning(int a_lineno, int i);
|
||||
extern void fatal(const char *msg) GCC_NORETURN;
|
||||
extern void illegal_character(char *c_cptr) GCC_NORETURN;
|
||||
extern void illegal_tag(int t_lineno, char *t_line, char *t_cptr) GCC_NORETURN;
|
||||
extern void missing_brace(void) GCC_NORETURN;
|
||||
extern void no_grammar(void) GCC_NORETURN;
|
||||
extern void no_space(void) GCC_NORETURN;
|
||||
extern void open_error(const char *filename) GCC_NORETURN;
|
||||
@ -412,7 +421,7 @@ extern void output(void);
|
||||
extern void reader(void);
|
||||
|
||||
/* skeleton.c */
|
||||
extern void write_section(const char *const section[]);
|
||||
extern void write_section(FILE *fp, const char *const section[]);
|
||||
|
||||
/* verbose.c */
|
||||
extern void verbose(void);
|
||||
|
||||
10
error.c
10
error.c
@ -1,4 +1,4 @@
|
||||
/* $Id: error.c,v 1.8 2010/11/24 15:10:20 tom Exp $ */
|
||||
/* $Id: error.c,v 1.9 2011/09/05 23:27:43 tom Exp $ */
|
||||
|
||||
/* routines for printing error messages */
|
||||
|
||||
@ -25,6 +25,14 @@ open_error(const char *filename)
|
||||
done(2);
|
||||
}
|
||||
|
||||
void
|
||||
missing_brace(void)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", missing '}'\n",
|
||||
myname, lineno, input_file_name);
|
||||
done(1);
|
||||
}
|
||||
|
||||
void
|
||||
unexpected_EOF(void)
|
||||
{
|
||||
|
||||
33
main.c
33
main.c
@ -1,4 +1,4 @@
|
||||
/* $Id: main.c,v 1.35 2010/12/27 01:21:59 tom Exp $ */
|
||||
/* $Id: main.c,v 1.36 2011/09/06 22:44:45 tom Exp $ */
|
||||
|
||||
#include <signal.h>
|
||||
#include <unistd.h> /* for _exit() */
|
||||
@ -34,6 +34,7 @@ static MY_TMPFILES *my_tmpfiles;
|
||||
|
||||
char dflag;
|
||||
char gflag;
|
||||
char iflag;
|
||||
char lflag;
|
||||
static char oflag;
|
||||
char rflag;
|
||||
@ -53,7 +54,9 @@ static char *file_prefix = default_file_prefix;
|
||||
|
||||
char *code_file_name;
|
||||
char *input_file_name = empty_string;
|
||||
static char *defines_file_name;
|
||||
char *defines_file_name;
|
||||
char *externs_file_name;
|
||||
|
||||
static char *graph_file_name;
|
||||
static char *output_file_name;
|
||||
static char *verbose_file_name;
|
||||
@ -62,6 +65,7 @@ FILE *action_file; /* a temp file, used to save actions associated */
|
||||
/* with rules until the parser is written */
|
||||
FILE *code_file; /* y.code.c (used when the -r option is specified) */
|
||||
FILE *defines_file; /* y.tab.h */
|
||||
FILE *externs_file; /* y.tab.i */
|
||||
FILE *input_file; /* the input file */
|
||||
FILE *output_file; /* y.tab.c */
|
||||
FILE *text_file; /* a temp file, used to save text until all */
|
||||
@ -132,6 +136,9 @@ done(int k)
|
||||
if (dflag)
|
||||
DO_FREE(defines_file_name);
|
||||
|
||||
if (iflag)
|
||||
DO_FREE(externs_file_name);
|
||||
|
||||
if (oflag)
|
||||
DO_FREE(output_file_name);
|
||||
|
||||
@ -187,6 +194,7 @@ usage(void)
|
||||
,"Options:"
|
||||
," -b file_prefix set filename prefix (default \"y.\")"
|
||||
," -d write definitions (y.tab.h)"
|
||||
," -i write interface (y.tab.i)"
|
||||
," -g write a graphical description"
|
||||
," -l suppress #line directives"
|
||||
," -o output_file (default \"y.tab.c\")"
|
||||
@ -220,6 +228,10 @@ setflag(int ch)
|
||||
gflag = 1;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
iflag = 1;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
lflag = 1;
|
||||
break;
|
||||
@ -359,17 +371,22 @@ create_file_names(void)
|
||||
{
|
||||
size_t len;
|
||||
const char *defines_suffix;
|
||||
const char *externs_suffix;
|
||||
char *prefix;
|
||||
|
||||
prefix = NULL;
|
||||
defines_suffix = DEFINES_SUFFIX;
|
||||
externs_suffix = EXTERNS_SUFFIX;
|
||||
|
||||
/* compute the file_prefix from the user provided output_file_name */
|
||||
if (output_file_name != 0)
|
||||
{
|
||||
if (!(prefix = strstr(output_file_name, ".tab.c"))
|
||||
&& (prefix = strstr(output_file_name, ".c")))
|
||||
{
|
||||
defines_suffix = ".h";
|
||||
externs_suffix = ".i";
|
||||
}
|
||||
}
|
||||
|
||||
if (prefix != NULL)
|
||||
@ -401,6 +418,11 @@ create_file_names(void)
|
||||
CREATE_FILE_NAME(defines_file_name, defines_suffix);
|
||||
}
|
||||
|
||||
if (iflag)
|
||||
{
|
||||
CREATE_FILE_NAME(externs_file_name, externs_suffix);
|
||||
}
|
||||
|
||||
if (vflag)
|
||||
{
|
||||
CREATE_FILE_NAME(verbose_file_name, VERBOSE_SUFFIX);
|
||||
@ -592,6 +614,13 @@ open_files(void)
|
||||
union_file = open_tmpfile("union_file");
|
||||
}
|
||||
|
||||
if (iflag)
|
||||
{
|
||||
externs_file = fopen(externs_file_name, "w");
|
||||
if (externs_file == 0)
|
||||
open_error(externs_file_name);
|
||||
}
|
||||
|
||||
output_file = fopen(output_file_name, "w");
|
||||
if (output_file == 0)
|
||||
open_error(output_file_name);
|
||||
|
||||
340
output.c
340
output.c
@ -1,4 +1,4 @@
|
||||
/* $Id: output.c,v 1.38 2010/12/29 18:35:38 Christos.Zoulas Exp $ */
|
||||
/* $Id: output.c,v 1.40 2011/09/07 09:52:41 tom Exp $ */
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
@ -22,33 +22,34 @@ static int lowzero;
|
||||
static int high;
|
||||
|
||||
static void
|
||||
putc_code(int c)
|
||||
putc_code(FILE * fp, int c)
|
||||
{
|
||||
if (c == '\n')
|
||||
if ((c == '\n') && (fp == code_file))
|
||||
++outline;
|
||||
putc(c, code_file);
|
||||
putc(c, fp);
|
||||
}
|
||||
|
||||
static void
|
||||
putl_code(const char *s)
|
||||
putl_code(FILE * fp, const char *s)
|
||||
{
|
||||
++outline;
|
||||
fputs(s, code_file);
|
||||
if (fp == code_file)
|
||||
++outline;
|
||||
fputs(s, fp);
|
||||
}
|
||||
|
||||
static void
|
||||
puts_code(const char *s)
|
||||
puts_code(FILE * fp, const char *s)
|
||||
{
|
||||
fputs(s, code_file);
|
||||
fputs(s, fp);
|
||||
}
|
||||
|
||||
static void
|
||||
write_code_lineno(void)
|
||||
write_code_lineno(FILE * fp)
|
||||
{
|
||||
if (!lflag)
|
||||
if (!lflag && (fp == code_file))
|
||||
{
|
||||
++outline;
|
||||
fprintf(code_file, line_format, outline, code_file_name);
|
||||
fprintf(fp, line_format, outline, code_file_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -818,7 +819,7 @@ is_C_identifier(char *name)
|
||||
}
|
||||
|
||||
static void
|
||||
output_defines(void)
|
||||
output_defines(FILE * fp)
|
||||
{
|
||||
int c, i;
|
||||
char *s;
|
||||
@ -828,51 +829,48 @@ output_defines(void)
|
||||
s = symbol_name[i];
|
||||
if (is_C_identifier(s))
|
||||
{
|
||||
puts_code("#define ");
|
||||
if (dflag)
|
||||
fprintf(defines_file, "#define ");
|
||||
fprintf(fp, "#define ");
|
||||
c = *s;
|
||||
if (c == '"')
|
||||
{
|
||||
while ((c = *++s) != '"')
|
||||
{
|
||||
putc(c, code_file);
|
||||
if (dflag)
|
||||
putc(c, defines_file);
|
||||
putc(c, fp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
putc(c, code_file);
|
||||
if (dflag)
|
||||
putc(c, defines_file);
|
||||
putc(c, fp);
|
||||
}
|
||||
while ((c = *++s) != 0);
|
||||
}
|
||||
++outline;
|
||||
fprintf(code_file, " %d\n", symbol_value[i]);
|
||||
if (dflag)
|
||||
fprintf(defines_file, " %d\n", symbol_value[i]);
|
||||
if (fp == code_file)
|
||||
++outline;
|
||||
fprintf(fp, " %d\n", symbol_value[i]);
|
||||
}
|
||||
}
|
||||
|
||||
++outline;
|
||||
fprintf(code_file, "#define YYERRCODE %d\n", symbol_value[1]);
|
||||
if (fp == code_file)
|
||||
++outline;
|
||||
if (fp != defines_file)
|
||||
fprintf(fp, "#define YYERRCODE %d\n", symbol_value[1]);
|
||||
|
||||
if (dflag && unionized)
|
||||
if (fp == defines_file)
|
||||
{
|
||||
rewind(union_file);
|
||||
while ((c = getc(union_file)) != EOF)
|
||||
putc(c, defines_file);
|
||||
fprintf(defines_file, "extern YYSTYPE %slval;\n",
|
||||
symbol_prefix);
|
||||
if (unionized)
|
||||
{
|
||||
rewind(union_file);
|
||||
while ((c = getc(union_file)) != EOF)
|
||||
putc(c, fp);
|
||||
fprintf(fp, "extern YYSTYPE %slval;\n", symbol_prefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
output_stored_text(void)
|
||||
output_stored_text(FILE * fp)
|
||||
{
|
||||
int c;
|
||||
FILE *in;
|
||||
@ -883,12 +881,12 @@ output_stored_text(void)
|
||||
in = text_file;
|
||||
if ((c = getc(in)) == EOF)
|
||||
return;
|
||||
putc_code(c);
|
||||
putc_code(fp, c);
|
||||
while ((c = getc(in)) != EOF)
|
||||
{
|
||||
putc_code(c);
|
||||
putc_code(fp, c);
|
||||
}
|
||||
write_code_lineno();
|
||||
write_code_lineno(fp);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -901,10 +899,10 @@ output_debug(void)
|
||||
++outline;
|
||||
fprintf(code_file, "#define YYFINAL %d\n", final_state);
|
||||
|
||||
putl_code("#ifndef YYDEBUG\n");
|
||||
putl_code(code_file, "#ifndef YYDEBUG\n");
|
||||
++outline;
|
||||
fprintf(code_file, "#define YYDEBUG %d\n", tflag);
|
||||
putl_code("#endif\n");
|
||||
putl_code(code_file, "#endif\n");
|
||||
|
||||
if (rflag)
|
||||
{
|
||||
@ -1112,26 +1110,25 @@ output_debug(void)
|
||||
}
|
||||
|
||||
static void
|
||||
output_pure_parser(void)
|
||||
output_pure_parser(FILE * fp)
|
||||
{
|
||||
putc_code('\n');
|
||||
putc_code(fp, '\n');
|
||||
|
||||
outline += 1;
|
||||
fprintf(code_file, "#define YYPURE %d\n", pure_parser);
|
||||
|
||||
putc_code('\n');
|
||||
if (fp == code_file)
|
||||
outline += 1;
|
||||
fprintf(fp, "#define YYPURE %d\n", pure_parser);
|
||||
putc_code(fp, '\n');
|
||||
}
|
||||
|
||||
static void
|
||||
output_stype(void)
|
||||
output_stype(FILE * fp)
|
||||
{
|
||||
if (!unionized && ntags == 0)
|
||||
{
|
||||
putc_code('\n');
|
||||
putl_code("#ifndef YYSTYPE\n");
|
||||
putl_code("typedef int YYSTYPE;\n");
|
||||
putl_code("#endif\n");
|
||||
putc_code('\n');
|
||||
putc_code(fp, '\n');
|
||||
putl_code(fp, "#ifndef YYSTYPE\n");
|
||||
putl_code(fp, "typedef int YYSTYPE;\n");
|
||||
putl_code(fp, "#endif\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1152,7 +1149,7 @@ output_trailing_text(void)
|
||||
if ((c = getc(in)) == EOF)
|
||||
return;
|
||||
write_input_lineno();
|
||||
putc_code(c);
|
||||
putc_code(code_file, c);
|
||||
last = c;
|
||||
}
|
||||
else
|
||||
@ -1160,24 +1157,24 @@ output_trailing_text(void)
|
||||
write_input_lineno();
|
||||
do
|
||||
{
|
||||
putc_code(c);
|
||||
putc_code(code_file, c);
|
||||
}
|
||||
while ((c = *++cptr) != '\n');
|
||||
putc_code(c);
|
||||
putc_code(code_file, c);
|
||||
last = '\n';
|
||||
}
|
||||
|
||||
while ((c = getc(in)) != EOF)
|
||||
{
|
||||
putc_code(c);
|
||||
putc_code(code_file, c);
|
||||
last = c;
|
||||
}
|
||||
|
||||
if (last != '\n')
|
||||
{
|
||||
putc_code('\n');
|
||||
putc_code(code_file, '\n');
|
||||
}
|
||||
write_code_lineno();
|
||||
write_code_lineno(code_file);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1190,135 +1187,136 @@ output_semantic_actions(void)
|
||||
return;
|
||||
|
||||
last = c;
|
||||
putc_code(c);
|
||||
putc_code(code_file, c);
|
||||
while ((c = getc(action_file)) != EOF)
|
||||
{
|
||||
putc_code(c);
|
||||
putc_code(code_file, c);
|
||||
last = c;
|
||||
}
|
||||
|
||||
if (last != '\n')
|
||||
{
|
||||
putc_code('\n');
|
||||
putc_code(code_file, '\n');
|
||||
}
|
||||
|
||||
write_code_lineno();
|
||||
write_code_lineno(code_file);
|
||||
}
|
||||
|
||||
static void
|
||||
output_parse_decl(void)
|
||||
output_parse_decl(FILE * fp)
|
||||
{
|
||||
putl_code("/* compatibility with bison */\n");
|
||||
putl_code("#ifdef YYPARSE_PARAM\n");
|
||||
putl_code("/* compatibility with FreeBSD */\n");
|
||||
putl_code("# ifdef YYPARSE_PARAM_TYPE\n");
|
||||
putl_code("# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)\n");
|
||||
putl_code("# else\n");
|
||||
putl_code("# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)\n");
|
||||
putl_code("# endif\n");
|
||||
putl_code("#else\n");
|
||||
putl_code(fp, "\n");
|
||||
putl_code(fp, "/* compatibility with bison */\n");
|
||||
putl_code(fp, "#ifdef YYPARSE_PARAM\n");
|
||||
putl_code(fp, "/* compatibility with FreeBSD */\n");
|
||||
putl_code(fp, "# ifdef YYPARSE_PARAM_TYPE\n");
|
||||
putl_code(fp,
|
||||
"# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)\n");
|
||||
putl_code(fp, "# else\n");
|
||||
putl_code(fp, "# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)\n");
|
||||
putl_code(fp, "# endif\n");
|
||||
putl_code(fp, "#else\n");
|
||||
|
||||
puts_code("# define YYPARSE_DECL() yyparse(");
|
||||
puts_code(fp, "# define YYPARSE_DECL() yyparse(");
|
||||
if (!parse_param)
|
||||
puts_code("void");
|
||||
puts_code(fp, "void");
|
||||
else
|
||||
{
|
||||
param *p;
|
||||
for (p = parse_param; p; p = p->next)
|
||||
fprintf(code_file, "%s %s%s%s", p->type, p->name, p->type2,
|
||||
fprintf(fp, "%s %s%s%s", p->type, p->name, p->type2,
|
||||
p->next ? ", " : "");
|
||||
}
|
||||
putl_code(")\n");
|
||||
putl_code(fp, ")\n");
|
||||
|
||||
putl_code("#endif\n");
|
||||
putl_code("\n");
|
||||
putl_code(fp, "#endif\n");
|
||||
}
|
||||
|
||||
static void
|
||||
output_lex_decl(void)
|
||||
output_lex_decl(FILE * fp)
|
||||
{
|
||||
putl_code("/* Parameters sent to lex. */\n");
|
||||
putl_code("#ifdef YYLEX_PARAM\n");
|
||||
putl_code(fp, "\n");
|
||||
putl_code(fp, "/* Parameters sent to lex. */\n");
|
||||
putl_code(fp, "#ifdef YYLEX_PARAM\n");
|
||||
if (pure_parser)
|
||||
{
|
||||
putl_code("# define YYLEX_DECL() yylex(YYSTYPE *yylval, "
|
||||
putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval, "
|
||||
"void *YYLEX_PARAM)\n");
|
||||
putl_code("# define YYLEX yylex(&yylval, YYLEX_PARAM)\n");
|
||||
putl_code(fp, "# define YYLEX yylex(&yylval, YYLEX_PARAM)\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
putl_code("# define YYLEX_DECL() yylex(void *YYLEX_PARAM)\n");
|
||||
putl_code("# define YYLEX yylex(YYLEX_PARAM)\n");
|
||||
putl_code(fp, "# define YYLEX_DECL() yylex(void *YYLEX_PARAM)\n");
|
||||
putl_code(fp, "# define YYLEX yylex(YYLEX_PARAM)\n");
|
||||
}
|
||||
putl_code("#else\n");
|
||||
putl_code(fp, "#else\n");
|
||||
if (pure_parser && lex_param)
|
||||
{
|
||||
param *p;
|
||||
puts_code("# define YYLEX_DECL() yylex(YYSTYPE *yylval, ");
|
||||
puts_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval, ");
|
||||
for (p = lex_param; p; p = p->next)
|
||||
fprintf(code_file, "%s %s%s%s", p->type, p->name, p->type2,
|
||||
fprintf(fp, "%s %s%s%s", p->type, p->name, p->type2,
|
||||
p->next ? ", " : "");
|
||||
putl_code(")\n");
|
||||
putl_code(fp, ")\n");
|
||||
|
||||
puts_code("# define YYLEX yylex(&yylval, ");
|
||||
puts_code(fp, "# define YYLEX yylex(&yylval, ");
|
||||
for (p = lex_param; p; p = p->next)
|
||||
fprintf(code_file, "%s%s", p->name, p->next ? ", " : "");
|
||||
putl_code(")\n");
|
||||
fprintf(fp, "%s%s", p->name, p->next ? ", " : "");
|
||||
putl_code(fp, ")\n");
|
||||
}
|
||||
else if (pure_parser)
|
||||
{
|
||||
putl_code("# define YYLEX_DECL() yylex(YYSTYPE *yylval)\n");
|
||||
putl_code("# define YYLEX yylex(&yylval)\n");
|
||||
putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval)\n");
|
||||
putl_code(fp, "# define YYLEX yylex(&yylval)\n");
|
||||
}
|
||||
else if (lex_param)
|
||||
{
|
||||
param *p;
|
||||
puts_code("# define YYLEX_DECL() yylex(");
|
||||
puts_code(fp, "# define YYLEX_DECL() yylex(");
|
||||
for (p = lex_param; p; p = p->next)
|
||||
fprintf(code_file, "%s %s%s%s", p->type, p->name, p->type2,
|
||||
fprintf(fp, "%s %s%s%s", p->type, p->name, p->type2,
|
||||
p->next ? ", " : "");
|
||||
putl_code(")\n");
|
||||
putl_code(fp, ")\n");
|
||||
|
||||
puts_code("# define YYLEX yylex(");
|
||||
puts_code(fp, "# define YYLEX yylex(");
|
||||
for (p = lex_param; p; p = p->next)
|
||||
fprintf(code_file, "%s%s", p->name, p->next ? ", " : "");
|
||||
putl_code(")\n");
|
||||
fprintf(fp, "%s%s", p->name, p->next ? ", " : "");
|
||||
putl_code(fp, ")\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
putl_code("# define YYLEX_DECL() yylex(void)\n");
|
||||
putl_code("# define YYLEX yylex()\n");
|
||||
putl_code(fp, "# define YYLEX_DECL() yylex(void)\n");
|
||||
putl_code(fp, "# define YYLEX yylex()\n");
|
||||
}
|
||||
putl_code("#endif\n");
|
||||
putl_code("\n");
|
||||
putl_code(fp, "#endif\n");
|
||||
}
|
||||
|
||||
static void
|
||||
output_error_decl(void)
|
||||
output_error_decl(FILE * fp)
|
||||
{
|
||||
putl_code("/* Parameters sent to yyerror. */\n");
|
||||
putl_code(fp, "\n");
|
||||
putl_code(fp, "/* Parameters sent to yyerror. */\n");
|
||||
if (parse_param)
|
||||
{
|
||||
param *p;
|
||||
|
||||
fprintf(code_file, "#define YYERROR_DECL() yyerror(");
|
||||
fprintf(fp, "#define YYERROR_DECL() yyerror(");
|
||||
for (p = parse_param; p; p = p->next)
|
||||
fprintf(code_file, "%s %s%s, ", p->type, p->name, p->type2);
|
||||
putl_code("const char *s)\n");
|
||||
fprintf(fp, "%s %s%s, ", p->type, p->name, p->type2);
|
||||
putl_code(fp, "const char *s)\n");
|
||||
|
||||
puts_code("#define YYERROR_CALL(msg) yyerror(");
|
||||
puts_code(fp, "#define YYERROR_CALL(msg) yyerror(");
|
||||
|
||||
for (p = parse_param; p; p = p->next)
|
||||
fprintf(code_file, "%s, ", p->name);
|
||||
fprintf(fp, "%s, ", p->name);
|
||||
|
||||
putl_code("msg)\n");
|
||||
putl_code(fp, "msg)\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
putl_code("#define YYERROR_DECL() yyerror(const char *s)\n");
|
||||
putl_code("#define YYERROR_CALL(msg) yyerror(msg)\n");
|
||||
putl_code(fp, "#define YYERROR_DECL() yyerror(const char *s)\n");
|
||||
putl_code(fp, "#define YYERROR_CALL(msg) yyerror(msg)\n");
|
||||
}
|
||||
putl_code("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1363,33 +1361,92 @@ free_reductions(void)
|
||||
static void
|
||||
output_yyerror_call(const char *msg)
|
||||
{
|
||||
puts_code(" yyerror(");
|
||||
FILE *fp = code_file;
|
||||
|
||||
puts_code(fp, " yyerror(");
|
||||
if (parse_param)
|
||||
{
|
||||
param *p;
|
||||
for (p = parse_param; p; p = p->next)
|
||||
fprintf(code_file, "%s, ", p->name);
|
||||
fprintf(fp, "%s, ", p->name);
|
||||
}
|
||||
puts_code(fp, "\"");
|
||||
puts_code(fp, msg);
|
||||
putl_code(fp, "\");\n");
|
||||
}
|
||||
|
||||
static void
|
||||
output_externs(FILE * fp, const char *const section[])
|
||||
{
|
||||
int c;
|
||||
int i;
|
||||
const char *s;
|
||||
|
||||
for (i = 0; (s = section[i]) != 0; ++i)
|
||||
{
|
||||
if (*s && *s != '#')
|
||||
fputs("extern\t", fp);
|
||||
while ((c = *s) != 0)
|
||||
{
|
||||
putc(c, fp);
|
||||
++s;
|
||||
}
|
||||
if (fp == code_file)
|
||||
++outline;
|
||||
putc('\n', fp);
|
||||
}
|
||||
puts_code("\"");
|
||||
puts_code(msg);
|
||||
putl_code("\");\n");
|
||||
}
|
||||
|
||||
void
|
||||
output(void)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
free_itemsets();
|
||||
free_shifts();
|
||||
free_reductions();
|
||||
output_prefix(output_file);
|
||||
output_pure_parser();
|
||||
output_stored_text();
|
||||
output_stype();
|
||||
output_parse_decl();
|
||||
output_lex_decl();
|
||||
output_error_decl();
|
||||
write_section(xdecls);
|
||||
output_defines();
|
||||
|
||||
if (iflag)
|
||||
{
|
||||
++outline;
|
||||
fprintf(code_file, "#include \"%s\"\n", externs_file_name);
|
||||
fp = externs_file;
|
||||
}
|
||||
else
|
||||
fp = code_file;
|
||||
|
||||
output_prefix(iflag ? externs_file : output_file);
|
||||
output_pure_parser(fp);
|
||||
output_stored_text(fp);
|
||||
output_stype(fp);
|
||||
output_parse_decl(fp);
|
||||
output_lex_decl(fp);
|
||||
output_error_decl(fp);
|
||||
write_section(fp, xdecls);
|
||||
|
||||
if (iflag)
|
||||
{
|
||||
output_externs(externs_file, global_vars);
|
||||
if (!pure_parser)
|
||||
output_externs(externs_file, impure_vars);
|
||||
}
|
||||
|
||||
if (iflag)
|
||||
{
|
||||
++outline;
|
||||
fprintf(code_file, "#include \"%s\"\n", defines_file_name);
|
||||
if (!dflag)
|
||||
output_defines(externs_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
putc_code(code_file, '\n');
|
||||
output_defines(code_file);
|
||||
}
|
||||
|
||||
if (dflag)
|
||||
output_defines(defines_file);
|
||||
|
||||
output_rule_data();
|
||||
output_yydefred();
|
||||
output_actions();
|
||||
@ -1398,27 +1455,32 @@ output(void)
|
||||
if (rflag)
|
||||
{
|
||||
output_prefix(code_file);
|
||||
write_section(xdecls);
|
||||
write_section(tables);
|
||||
write_section(code_file, xdecls);
|
||||
write_section(code_file, tables);
|
||||
}
|
||||
write_section(hdr_defs);
|
||||
write_section(code_file, global_vars);
|
||||
if (!pure_parser)
|
||||
{
|
||||
write_section(hdr_vars);
|
||||
write_section(code_file, impure_vars);
|
||||
}
|
||||
write_section(code_file, hdr_defs);
|
||||
if (!pure_parser)
|
||||
{
|
||||
write_section(code_file, hdr_vars);
|
||||
}
|
||||
output_trailing_text();
|
||||
write_section(body_1);
|
||||
write_section(code_file, body_1);
|
||||
if (pure_parser)
|
||||
{
|
||||
write_section(body_vars);
|
||||
write_section(code_file, body_vars);
|
||||
}
|
||||
write_section(body_2);
|
||||
write_section(code_file, body_2);
|
||||
output_yyerror_call("syntax error");
|
||||
write_section(body_3);
|
||||
write_section(code_file, body_3);
|
||||
output_semantic_actions();
|
||||
write_section(trailer);
|
||||
write_section(code_file, trailer);
|
||||
output_yyerror_call("yacc stack overflow");
|
||||
write_section(trailer_2);
|
||||
write_section(code_file, trailer_2);
|
||||
}
|
||||
|
||||
#ifdef NO_LEAKS
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
Summary: byacc - public domain Berkeley LALR Yacc parser generator
|
||||
%define AppProgram byacc
|
||||
%define AppVersion 20101229
|
||||
%define AppVersion 20110907
|
||||
%define UseProgram yacc
|
||||
# $XTermId: byacc.spec,v 1.8 2010/12/29 18:03:14 tom Exp $
|
||||
# $XTermId: byacc.spec,v 1.9 2011/09/08 00:21:24 tom Exp $
|
||||
Name: %{AppProgram}
|
||||
Version: %{AppVersion}
|
||||
Release: 1
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
byacc (20110907) unstable; urgency=low
|
||||
|
||||
* add "-i" option.
|
||||
* add error-check in reader.c
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Mon, 05 Sep 2011 20:05:51 -0400
|
||||
|
||||
byacc (20101229) unstable; urgency=low
|
||||
|
||||
* fixes from Christos Zoulos
|
||||
|
||||
6
reader.c
6
reader.c
@ -1,4 +1,4 @@
|
||||
/* $Id: reader.c,v 1.31 2010/11/26 12:30:40 tom Exp $ */
|
||||
/* $Id: reader.c,v 1.33 2011/09/06 22:56:53 tom Exp $ */
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
@ -689,6 +689,8 @@ copy_param(int k)
|
||||
|
||||
for (i = 0; (c = *cptr++) != '}'; i++)
|
||||
{
|
||||
if (c == '\0')
|
||||
missing_brace();
|
||||
if (c == EOF)
|
||||
unexpected_EOF();
|
||||
buf[i] = (char)c;
|
||||
@ -2197,7 +2199,7 @@ print_grammar(void)
|
||||
void
|
||||
reader(void)
|
||||
{
|
||||
write_section(banner);
|
||||
write_section(code_file, banner);
|
||||
create_symbol_table();
|
||||
read_declarations();
|
||||
read_grammar();
|
||||
|
||||
42
skeleton.c
42
skeleton.c
@ -1,4 +1,4 @@
|
||||
/* $Id: skeleton.c,v 1.30 2010/12/29 20:57:21 tom Exp $ */
|
||||
/* $Id: skeleton.c,v 1.31 2011/09/07 09:37:59 tom Exp $ */
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
@ -37,8 +37,8 @@ const char *const banner[] =
|
||||
|
||||
const char *const xdecls[] =
|
||||
{
|
||||
"extern int YYPARSE_DECL();",
|
||||
"",
|
||||
"extern int YYPARSE_DECL();",
|
||||
0
|
||||
};
|
||||
|
||||
@ -61,8 +61,27 @@ const char *const tables[] =
|
||||
0
|
||||
};
|
||||
|
||||
const char *const global_vars[] =
|
||||
{
|
||||
"",
|
||||
"int yydebug;",
|
||||
"int yynerrs;",
|
||||
0
|
||||
};
|
||||
|
||||
const char *const impure_vars[] =
|
||||
{
|
||||
"",
|
||||
"int yyerrflag;",
|
||||
"int yychar;",
|
||||
"YYSTYPE yyval;",
|
||||
"YYSTYPE yylval;",
|
||||
0
|
||||
};
|
||||
|
||||
const char *const hdr_defs[] =
|
||||
{
|
||||
"",
|
||||
"/* define the initial stack-sizes */",
|
||||
"#ifdef YYSTACKSIZE",
|
||||
"#undef YYMAXDEPTH",
|
||||
@ -78,9 +97,6 @@ const char *const hdr_defs[] =
|
||||
"",
|
||||
"#define YYINITSTACKSIZE 500",
|
||||
"",
|
||||
"int yydebug;",
|
||||
"int yynerrs;",
|
||||
"",
|
||||
"typedef struct {",
|
||||
" unsigned stacksize;",
|
||||
" short *s_base;",
|
||||
@ -94,11 +110,6 @@ const char *const hdr_defs[] =
|
||||
|
||||
const char *const hdr_vars[] =
|
||||
{
|
||||
"int yyerrflag;",
|
||||
"int yychar;",
|
||||
"YYSTYPE yyval;",
|
||||
"YYSTYPE yylval;",
|
||||
"",
|
||||
"/* variables for the parser stack */",
|
||||
"static YYSTACKDATA yystack;",
|
||||
0
|
||||
@ -408,22 +419,21 @@ const char *const trailer_2[] =
|
||||
};
|
||||
|
||||
void
|
||||
write_section(const char *const section[])
|
||||
write_section(FILE * fp, const char *const section[])
|
||||
{
|
||||
int c;
|
||||
int i;
|
||||
const char *s;
|
||||
FILE *f;
|
||||
|
||||
f = code_file;
|
||||
for (i = 0; (s = section[i]) != 0; ++i)
|
||||
{
|
||||
++outline;
|
||||
while ((c = *s) != 0)
|
||||
{
|
||||
putc(c, f);
|
||||
putc(c, fp);
|
||||
++s;
|
||||
}
|
||||
putc('\n', f);
|
||||
if (fp == code_file)
|
||||
++outline;
|
||||
putc('\n', fp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,6 +260,15 @@ static const char *yyrule[] = {
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* define the initial stack-sizes */
|
||||
#ifdef YYSTACKSIZE
|
||||
#undef YYMAXDEPTH
|
||||
@ -275,9 +284,6 @@ static const char *yyrule[] = {
|
||||
|
||||
#define YYINITSTACKSIZE 500
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
typedef struct {
|
||||
unsigned stacksize;
|
||||
short *s_base;
|
||||
@ -286,11 +292,6 @@ typedef struct {
|
||||
YYSTYPE *l_base;
|
||||
YYSTYPE *l_mark;
|
||||
} YYSTACKDATA;
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* variables for the parser stack */
|
||||
static YYSTACKDATA yystack;
|
||||
#line 63 "calc.y"
|
||||
@ -340,7 +341,7 @@ yylex(void)
|
||||
}
|
||||
return( c );
|
||||
}
|
||||
#line 344 "calc.tab.c"
|
||||
#line 345 "calc.tab.c"
|
||||
|
||||
#if YYDEBUG
|
||||
#include <stdio.h> /* needed for printf */
|
||||
@ -606,7 +607,7 @@ case 18:
|
||||
#line 60 "calc.y"
|
||||
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
|
||||
break;
|
||||
#line 610 "calc.tab.c"
|
||||
#line 611 "calc.tab.c"
|
||||
}
|
||||
yystack.s_mark -= yym;
|
||||
yystate = *yystack.s_mark;
|
||||
|
||||
@ -133,6 +133,7 @@ typedef union
|
||||
} YYSTYPE;
|
||||
#endif /* !YYSTYPE_IS_DECLARED */
|
||||
#line 136 "calc1.tab.c"
|
||||
|
||||
/* compatibility with bison */
|
||||
#ifdef YYPARSE_PARAM
|
||||
/* compatibility with FreeBSD */
|
||||
@ -309,6 +310,15 @@ static const char *yyrule[] = {
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* define the initial stack-sizes */
|
||||
#ifdef YYSTACKSIZE
|
||||
#undef YYMAXDEPTH
|
||||
@ -324,9 +334,6 @@ static const char *yyrule[] = {
|
||||
|
||||
#define YYINITSTACKSIZE 500
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
typedef struct {
|
||||
unsigned stacksize;
|
||||
short *s_base;
|
||||
@ -335,11 +342,6 @@ typedef struct {
|
||||
YYSTYPE *l_base;
|
||||
YYSTYPE *l_mark;
|
||||
} YYSTACKDATA;
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* variables for the parser stack */
|
||||
static YYSTACKDATA yystack;
|
||||
#line 173 "calc1.y"
|
||||
@ -478,7 +480,7 @@ vdiv(double a, double b, INTERVAL v)
|
||||
{
|
||||
return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
|
||||
}
|
||||
#line 482 "calc1.tab.c"
|
||||
#line 484 "calc1.tab.c"
|
||||
|
||||
#if YYDEBUG
|
||||
#include <stdio.h> /* needed for printf */
|
||||
@ -847,7 +849,7 @@ case 28:
|
||||
yyval.vval = yystack.l_mark[-1].vval;
|
||||
}
|
||||
break;
|
||||
#line 851 "calc1.tab.c"
|
||||
#line 853 "calc1.tab.c"
|
||||
}
|
||||
yystack.s_mark -= yym;
|
||||
yystate = *yystack.s_mark;
|
||||
|
||||
@ -257,6 +257,15 @@ static const char *yyrule[] = {
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* define the initial stack-sizes */
|
||||
#ifdef YYSTACKSIZE
|
||||
#undef YYMAXDEPTH
|
||||
@ -272,9 +281,6 @@ static const char *yyrule[] = {
|
||||
|
||||
#define YYINITSTACKSIZE 500
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
typedef struct {
|
||||
unsigned stacksize;
|
||||
short *s_base;
|
||||
@ -283,11 +289,6 @@ typedef struct {
|
||||
YYSTYPE *l_base;
|
||||
YYSTYPE *l_mark;
|
||||
} YYSTACKDATA;
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* variables for the parser stack */
|
||||
static YYSTACKDATA yystack;
|
||||
#line 65 "calc2.y"
|
||||
@ -340,7 +341,7 @@ yylex(int *base)
|
||||
}
|
||||
return( c );
|
||||
}
|
||||
#line 344 "calc2.tab.c"
|
||||
#line 345 "calc2.tab.c"
|
||||
|
||||
#if YYDEBUG
|
||||
#include <stdio.h> /* needed for printf */
|
||||
@ -606,7 +607,7 @@ case 18:
|
||||
#line 62 "calc2.y"
|
||||
{ yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
|
||||
break;
|
||||
#line 610 "calc2.tab.c"
|
||||
#line 611 "calc2.tab.c"
|
||||
}
|
||||
yystack.s_mark -= yym;
|
||||
yystate = *yystack.s_mark;
|
||||
|
||||
@ -257,6 +257,10 @@ static const char *yyrule[] = {
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
/* define the initial stack-sizes */
|
||||
#ifdef YYSTACKSIZE
|
||||
#undef YYMAXDEPTH
|
||||
@ -272,9 +276,6 @@ static const char *yyrule[] = {
|
||||
|
||||
#define YYINITSTACKSIZE 500
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
typedef struct {
|
||||
unsigned stacksize;
|
||||
short *s_base;
|
||||
@ -333,7 +334,7 @@ YYLEX_DECL()
|
||||
}
|
||||
return( c );
|
||||
}
|
||||
#line 337 "calc3.tab.c"
|
||||
#line 338 "calc3.tab.c"
|
||||
|
||||
#if YYDEBUG
|
||||
#include <stdio.h> /* needed for printf */
|
||||
@ -606,7 +607,7 @@ case 18:
|
||||
#line 64 "calc3.y"
|
||||
{ yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
|
||||
break;
|
||||
#line 610 "calc3.tab.c"
|
||||
#line 611 "calc3.tab.c"
|
||||
}
|
||||
yystack.s_mark -= yym;
|
||||
yystate = *yystack.s_mark;
|
||||
|
||||
@ -145,8 +145,8 @@ extern int YYPARSE_DECL();
|
||||
#define yyrule calc_rule
|
||||
#endif /* yyrule */
|
||||
#define YYPREFIX "calc_"
|
||||
extern int YYPARSE_DECL();
|
||||
|
||||
extern int YYPARSE_DECL();
|
||||
extern short yylhs[];
|
||||
extern short yylen[];
|
||||
extern short yydefred[];
|
||||
@ -161,6 +161,15 @@ extern short yycheck[];
|
||||
extern char *yyname[];
|
||||
extern char *yyrule[];
|
||||
#endif
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* define the initial stack-sizes */
|
||||
#ifdef YYSTACKSIZE
|
||||
#undef YYMAXDEPTH
|
||||
@ -176,9 +185,6 @@ extern char *yyrule[];
|
||||
|
||||
#define YYINITSTACKSIZE 500
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
typedef struct {
|
||||
unsigned stacksize;
|
||||
short *s_base;
|
||||
@ -187,11 +193,6 @@ typedef struct {
|
||||
YYSTYPE *l_base;
|
||||
YYSTYPE *l_mark;
|
||||
} YYSTACKDATA;
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* variables for the parser stack */
|
||||
static YYSTACKDATA yystack;
|
||||
#line 63 "code_calc.y"
|
||||
@ -240,7 +241,7 @@ yylex(void) {
|
||||
}
|
||||
return( c );
|
||||
}
|
||||
#line 244 "code_calc.code.c"
|
||||
#line 245 "code_calc.code.c"
|
||||
|
||||
#if YYDEBUG
|
||||
#include <stdio.h> /* needed for printf */
|
||||
@ -506,7 +507,7 @@ case 18:
|
||||
#line 60 "code_calc.y"
|
||||
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
|
||||
break;
|
||||
#line 510 "code_calc.code.c"
|
||||
#line 511 "code_calc.code.c"
|
||||
}
|
||||
yystack.s_mark -= yym;
|
||||
yystate = *yystack.s_mark;
|
||||
|
||||
@ -134,8 +134,8 @@ extern int YYPARSE_DECL();
|
||||
#define yyrule error_rule
|
||||
#endif /* yyrule */
|
||||
#define YYPREFIX "error_"
|
||||
extern int YYPARSE_DECL();
|
||||
|
||||
extern int YYPARSE_DECL();
|
||||
extern short yylhs[];
|
||||
extern short yylen[];
|
||||
extern short yydefred[];
|
||||
@ -150,6 +150,15 @@ extern short yycheck[];
|
||||
extern char *yyname[];
|
||||
extern char *yyrule[];
|
||||
#endif
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* define the initial stack-sizes */
|
||||
#ifdef YYSTACKSIZE
|
||||
#undef YYMAXDEPTH
|
||||
@ -165,9 +174,6 @@ extern char *yyrule[];
|
||||
|
||||
#define YYINITSTACKSIZE 500
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
typedef struct {
|
||||
unsigned stacksize;
|
||||
short *s_base;
|
||||
@ -176,11 +182,6 @@ typedef struct {
|
||||
YYSTYPE *l_base;
|
||||
YYSTYPE *l_mark;
|
||||
} YYSTACKDATA;
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* variables for the parser stack */
|
||||
static YYSTACKDATA yystack;
|
||||
#line 4 "code_error.y"
|
||||
@ -210,7 +211,7 @@ yyerror(const char* s)
|
||||
{
|
||||
printf("%s\n", s);
|
||||
}
|
||||
#line 214 "code_error.code.c"
|
||||
#line 215 "code_error.code.c"
|
||||
|
||||
#if YYDEBUG
|
||||
#include <stdio.h> /* needed for printf */
|
||||
|
||||
@ -168,6 +168,15 @@ static const char *yyrule[] = {
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* define the initial stack-sizes */
|
||||
#ifdef YYSTACKSIZE
|
||||
#undef YYMAXDEPTH
|
||||
@ -183,9 +192,6 @@ static const char *yyrule[] = {
|
||||
|
||||
#define YYINITSTACKSIZE 500
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
typedef struct {
|
||||
unsigned stacksize;
|
||||
short *s_base;
|
||||
@ -194,11 +200,6 @@ typedef struct {
|
||||
YYSTYPE *l_base;
|
||||
YYSTYPE *l_mark;
|
||||
} YYSTACKDATA;
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* variables for the parser stack */
|
||||
static YYSTACKDATA yystack;
|
||||
#line 4 "error.y"
|
||||
@ -228,7 +229,7 @@ yyerror(const char* s)
|
||||
{
|
||||
printf("%s\n", s);
|
||||
}
|
||||
#line 232 "error.tab.c"
|
||||
#line 233 "error.tab.c"
|
||||
|
||||
#if YYDEBUG
|
||||
#include <stdio.h> /* needed for printf */
|
||||
|
||||
@ -509,6 +509,15 @@ static const char *yyrule[] = {
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* define the initial stack-sizes */
|
||||
#ifdef YYSTACKSIZE
|
||||
#undef YYMAXDEPTH
|
||||
@ -524,9 +533,6 @@ static const char *yyrule[] = {
|
||||
|
||||
#define YYINITSTACKSIZE 500
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
typedef struct {
|
||||
unsigned stacksize;
|
||||
short *s_base;
|
||||
@ -535,11 +541,6 @@ typedef struct {
|
||||
YYSTYPE *l_base;
|
||||
YYSTYPE *l_mark;
|
||||
} YYSTACKDATA;
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* variables for the parser stack */
|
||||
static YYSTACKDATA yystack;
|
||||
#line 689 "ftp.y"
|
||||
@ -1074,7 +1075,7 @@ sizecmd(char *filename)
|
||||
reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
|
||||
}
|
||||
}
|
||||
#line 1078 "ftp.tab.c"
|
||||
#line 1079 "ftp.tab.c"
|
||||
|
||||
#if YYDEBUG
|
||||
#include <stdio.h> /* needed for printf */
|
||||
@ -1917,7 +1918,7 @@ case 73:
|
||||
}
|
||||
}
|
||||
break;
|
||||
#line 1921 "ftp.tab.c"
|
||||
#line 1922 "ftp.tab.c"
|
||||
}
|
||||
yystack.s_mark -= yym;
|
||||
yystate = *yystack.s_mark;
|
||||
|
||||
@ -375,6 +375,7 @@ haveAnsiParam (void)
|
||||
return FALSE;
|
||||
}
|
||||
#line 378 "grammar.tab.c"
|
||||
|
||||
/* compatibility with bison */
|
||||
#ifdef YYPARSE_PARAM
|
||||
/* compatibility with FreeBSD */
|
||||
@ -863,6 +864,15 @@ static const char *yyrule[] = {
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* define the initial stack-sizes */
|
||||
#ifdef YYSTACKSIZE
|
||||
#undef YYMAXDEPTH
|
||||
@ -878,9 +888,6 @@ static const char *yyrule[] = {
|
||||
|
||||
#define YYINITSTACKSIZE 500
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
typedef struct {
|
||||
unsigned stacksize;
|
||||
short *s_base;
|
||||
@ -889,11 +896,6 @@ typedef struct {
|
||||
YYSTYPE *l_base;
|
||||
YYSTYPE *l_mark;
|
||||
} YYSTACKDATA;
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* variables for the parser stack */
|
||||
static YYSTACKDATA yystack;
|
||||
#line 1004 "grammar.y"
|
||||
@ -1067,7 +1069,7 @@ free_parser(void)
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#line 1071 "grammar.tab.c"
|
||||
#line 1073 "grammar.tab.c"
|
||||
|
||||
#if YYDEBUG
|
||||
#include <stdio.h> /* needed for printf */
|
||||
@ -1947,7 +1949,7 @@ case 114:
|
||||
yyval.declarator->func_def = FUNC_ANSI;
|
||||
}
|
||||
break;
|
||||
#line 1951 "grammar.tab.c"
|
||||
#line 1953 "grammar.tab.c"
|
||||
}
|
||||
yystack.s_mark -= yym;
|
||||
yystate = *yystack.s_mark;
|
||||
|
||||
@ -260,6 +260,10 @@ static const char *yyrule[] = {
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
/* define the initial stack-sizes */
|
||||
#ifdef YYSTACKSIZE
|
||||
#undef YYMAXDEPTH
|
||||
@ -275,9 +279,6 @@ static const char *yyrule[] = {
|
||||
|
||||
#define YYINITSTACKSIZE 500
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
typedef struct {
|
||||
unsigned stacksize;
|
||||
short *s_base;
|
||||
@ -333,7 +334,7 @@ yylex(YYSTYPE *value)
|
||||
}
|
||||
return( c );
|
||||
}
|
||||
#line 337 "pure_calc.tab.c"
|
||||
#line 338 "pure_calc.tab.c"
|
||||
|
||||
#if YYDEBUG
|
||||
#include <stdio.h> /* needed for printf */
|
||||
@ -606,7 +607,7 @@ case 18:
|
||||
#line 60 "pure_calc.y"
|
||||
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
|
||||
break;
|
||||
#line 610 "pure_calc.tab.c"
|
||||
#line 611 "pure_calc.tab.c"
|
||||
}
|
||||
yystack.s_mark -= yym;
|
||||
yystate = *yystack.s_mark;
|
||||
|
||||
@ -168,6 +168,10 @@ static const char *yyrule[] = {
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
/* define the initial stack-sizes */
|
||||
#ifdef YYSTACKSIZE
|
||||
#undef YYMAXDEPTH
|
||||
@ -183,9 +187,6 @@ static const char *yyrule[] = {
|
||||
|
||||
#define YYINITSTACKSIZE 500
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
|
||||
typedef struct {
|
||||
unsigned stacksize;
|
||||
short *s_base;
|
||||
@ -221,7 +222,7 @@ yyerror(const char* s)
|
||||
{
|
||||
printf("%s\n", s);
|
||||
}
|
||||
#line 225 "pure_error.tab.c"
|
||||
#line 226 "pure_error.tab.c"
|
||||
|
||||
#if YYDEBUG
|
||||
#include <stdio.h> /* needed for printf */
|
||||
|
||||
27
yacc.1
27
yacc.1
@ -1,12 +1,12 @@
|
||||
.\" $Id: yacc.1,v 1.11 2010/11/26 16:27:11 tom Exp $
|
||||
.\" $Id: yacc.1,v 1.12 2011/09/08 00:40:44 tom Exp $
|
||||
.\"
|
||||
.\" .TH YACC 1 "July\ 15,\ 1990"
|
||||
.\" .UC 6
|
||||
.TH YACC 1 "November 26, 2010" "Berkeley Yacc" "User Commands"
|
||||
.TH YACC 1 "September 7, 2011" "Berkeley Yacc" "User Commands"
|
||||
.SH NAME
|
||||
Yacc \- an LALR(1) parser generator
|
||||
.SH SYNOPSIS
|
||||
.B yacc [ -dglrtv ] [ \-b
|
||||
.B yacc [ -dgilrtv ] [ \-b
|
||||
.I file_prefix
|
||||
.B ] [ \-p
|
||||
.I symbol_prefix
|
||||
@ -36,17 +36,32 @@ The default prefix is the character
|
||||
.TP
|
||||
.B \-d
|
||||
The \fB-d\fR option causes the header file
|
||||
.IR y.tab.h
|
||||
.BR y.tab.h
|
||||
to be written.
|
||||
It contains #define's for the token identifiers.
|
||||
.TP
|
||||
.B \-g
|
||||
The
|
||||
.B \-g
|
||||
option causes a graphical description of the generated LALR(1) parser to
|
||||
be written to the file
|
||||
.IR y.dot
|
||||
.BR y.dot
|
||||
in graphviz format, ready to be processed by dot(1).
|
||||
.TP
|
||||
.B \-i
|
||||
The \fB-i\fR option causes a supplementary header file
|
||||
.BR y.tab.i
|
||||
to be written.
|
||||
It contains extern declarations
|
||||
and supplementary #define's as needed to map the conventional \fIyacc\fP
|
||||
\fByy\fP-prefixed names to whatever the \fB-p\fP option may specify.
|
||||
The code file, e.g., \fBy.tab.c\fP is modified to #include this file
|
||||
as well as the \fBy.tab.h\fP file, enforcing consistent usage of the
|
||||
symbols defined in those files.
|
||||
.IP
|
||||
The supplementary header file makes it simpler to separate compilation
|
||||
of lex- and yacc-files.
|
||||
.TP
|
||||
.B \-l
|
||||
If the
|
||||
.B \-l
|
||||
@ -73,7 +88,7 @@ option changes the prefix prepended to yacc-generated symbols to
|
||||
the string denoted by
|
||||
.IR symbol_prefix.
|
||||
The default prefix is the string
|
||||
.IR yy.
|
||||
.BR yy.
|
||||
.TP
|
||||
.B \-P
|
||||
create a reentrant parser, e.g., "%pure-parser".
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user