home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume6 / yaccfix.awk < prev    next >
Text File  |  1989-03-06  |  1KB  |  42 lines

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