home *** CD-ROM | disk | FTP | other *** search
- From decwrl!ucbvax!tut.cis.ohio-state.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!uunet!allbery Fri Mar 24 22:24:21 PST 1989
- Article 818 of comp.sources.misc:
- Path: decwrl!ucbvax!tut.cis.ohio-state.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!uunet!allbery
- From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
- Newsgroups: comp.sources.misc
- Subject: v06i053: y.tab.c filter
- Keywords: yacc dbx
- Message-ID: <2235@goofy.megatest.UUCP>
- Date: 7 Mar 89 02:48:16 GMT
- Sender: allbery@uunet.UU.NET
- Reply-To: megatest!djones@decwrl.dec.com (Dave Jones)
- Organization: Megatest Corporation, San Jose, Ca
- Lines: 33
- Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 6, Issue 53
- Submitted-by: megatest!djones@decwrl.dec.com (Dave Jones)
- Archive-name: yaccfix.awk
-
- [You must be kidding. Not only was it not "shar"ed, but it does just about
- the opposite of what I want. ++bsa]
-
- I submit the following in the category of Shortest Arguably
- Nontrivial Program. It's a two-liner, written in AWK.
-
- --- snip --- snip --- snip --- snip --- snip --- snip --- snip
- #! /bin/sh
- # This file was wrapped with "dummyshar". "sh" this file to extract.
- # Contents: yaccfix.awk
- echo extracting 'yaccfix.awk'
- if test -f 'yaccfix.awk' -a -z "$1"; then echo Not overwriting 'yaccfix.awk'; else
- sed 's/^X//' << \EOF > 'yaccfix.awk'
- X# The line-number info produced by yacc causes dbx to skip
- X# around foolishly, showing random lines from the .y file
- X# when the execution is actually in yyparse().
- X#
- X# Run this over your y.tab.c to fix it.
- X#
- X
- X/^yyparse\(/ { print "# line " NR+1 " \"y.tab.c\"" }
- X { print }
- X
- X
- EOF
- chars=`wc -c < 'yaccfix.awk'`
- if test $chars != 300; then echo 'yaccfix.awk' is $chars characters, should be 300 characters!; fi
- fi
- exit 0
-
-
-