DEFINITIONS
This source file includes following functions.
1 #! /usr/local/bin/ruby -Kn
2 # usage: exyacc.rb [yaccfiles]
3 # this is coverted from exyacc.pl in the camel book
4
5 $/ = nil
6
7 while gets()
8 sbeg = $_.index("\n%%") + 1
9 send = $_.rindex("\n%%") + 1
10 $_ = $_[sbeg, send-sbeg]
11 sub!(/.*\n/, "")
12 gsub!(/'\{'/, "'\001'")
13 gsub!(/'}'/, "'\002'")
14 gsub!('\*/', "\003\003")
15 gsub!("/\\*[^\003]*\003\003", '')
16 while gsub!(/\{[^{}]*}/, ''); end
17 gsub!(/'\001'/, "'{'")
18 gsub!(/'\002'/, "'}'")
19 while gsub!(/^[ \t]*\n(\s)/, '\1'); end
20 gsub!(/([:|])[ \t\n]+(\w)/, '\1 \2')
21 print $_
22 end