home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume06 / yaccfix.awk < prev   
Encoding:
Internet Message Format  |  1991-08-27  |  1.8 KB

  1. From decwrl!ucbvax!tut.cis.ohio-state.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!uunet!allbery Fri Mar 24 22:24:21 PST 1989
  2. Article 818 of comp.sources.misc:
  3. Path: decwrl!ucbvax!tut.cis.ohio-state.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!uunet!allbery
  4. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5. Newsgroups: comp.sources.misc
  6. Subject: v06i053: y.tab.c filter
  7. Keywords: yacc dbx
  8. Message-ID: <2235@goofy.megatest.UUCP>
  9. Date: 7 Mar 89 02:48:16 GMT
  10. Sender: allbery@uunet.UU.NET
  11. Reply-To: megatest!djones@decwrl.dec.com (Dave Jones)
  12. Organization: Megatest Corporation, San Jose, Ca
  13. Lines: 33
  14. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  15.  
  16. Posting-number: Volume 6, Issue 53
  17. Submitted-by: megatest!djones@decwrl.dec.com (Dave Jones)
  18. Archive-name: yaccfix.awk
  19.  
  20. [You must be kidding.  Not only was it not "shar"ed, but it does just about
  21. the opposite of what I want.  ++bsa]
  22.  
  23. I submit the following in the category of Shortest Arguably
  24. Nontrivial Program. It's a two-liner, written in AWK.
  25.  
  26. --- snip --- snip --- snip --- snip --- snip --- snip --- snip
  27. #! /bin/sh
  28. # This file was wrapped with "dummyshar".  "sh" this file to extract.
  29. # Contents:  yaccfix.awk
  30. echo extracting 'yaccfix.awk'
  31. if test -f 'yaccfix.awk' -a -z "$1"; then echo Not overwriting 'yaccfix.awk'; else
  32. sed 's/^X//' << \EOF > 'yaccfix.awk'
  33. X# The line-number info produced by yacc causes dbx to skip
  34. X# around foolishly, showing random lines from the .y file
  35. X# when the execution is actually in yyparse().
  36. X#
  37. X# Run this over your y.tab.c to fix it.
  38. X#
  39. X
  40. X/^yyparse\(/ { print "# line "  NR+1  " \"y.tab.c\"" }
  41. X             { print }
  42. X
  43. X
  44. EOF
  45. chars=`wc -c < 'yaccfix.awk'`
  46. if test $chars !=      300; then echo 'yaccfix.awk' is $chars characters, should be      300 characters!; fi
  47. fi
  48. exit 0
  49.  
  50.  
  51.