Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 23 lines (20 sloc) 0.542 kB
511dc44 initial import
Laurent Sansonetti authored
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!(%r{\*/}, "\003\003")
15 gsub!(%r{/\*[^\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
Something went wrong with that request. Please try again.