Commit | Line | Data |
---|---|---|
80c61b95 KB |
1 | #!/bin/sh - |
2 | # | |
3 | # Copyright (c) 1990 The Regents of the University of California. | |
4 | # All rights reserved. | |
5 | # | |
6 | # %sccs.include.redist.sh% | |
7 | # | |
698343b3 | 8 | # @(#)yyfix.sh 5.2 (Berkeley) %G% |
80c61b95 KB |
9 | # |
10 | OLDYACC="yyexca yyact yypact yypgo yyr1 yyr2 yychk yydef" | |
11 | NEWYACC="yylhs yylen yydefred yydgoto yysindex yyrindex yygindex \ | |
12 | yytable yycheck" | |
13 | ||
14 | file=$1 | |
15 | >$file | |
16 | shift | |
17 | ||
18 | if [ $# -eq 0 ] ; then | |
19 | if grep yylhs y.tab.c > /dev/null ; then | |
698343b3 KB |
20 | if grep yyname y.tab.c > /dev/null ; then |
21 | NEWYACC="$NEWYACC yyname" | |
22 | fi | |
23 | if grep yyrule y.tab.c > /dev/null ; then | |
24 | NEWYACC="$NEWYACC yyrule" | |
25 | fi | |
80c61b95 KB |
26 | set $NEWYACC |
27 | else | |
28 | set $OLDYACC | |
29 | fi | |
30 | fi | |
31 | ||
32 | for i | |
33 | do | |
34 | ed - y.tab.c << END | |
35 | /^\(.*\)$i[ ]*\[]/s//extern \1 $i[];\\ | |
36 | \1 $i []/ | |
37 | .ka | |
38 | /}/kb | |
39 | 'br $file | |
40 | 'a,.w $file | |
41 | 'a,.d | |
42 | w | |
43 | q | |
44 | END | |
45 | done |