-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcup
executable file
·131 lines (106 loc) · 2.05 KB
/
cup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/sh
this=$(readlink -e "$0")
prg=$(basename "$this")
dir="dependencies/custom"
usage() {
compiler "-help"
cat <<EOF
-j <jvm-options> pass options to the Java VM
-J <jvm> use a different Java VM (default java in path)
-V echo the java command
-rdebug enable remote debugging
EOF
}
compiler() {
eval "$java" "$vmargs" -classpath "'$classpath'" java_cup.Main "$@"
}
compilerprint() {
echo "$java" "$vmargs" -classpath "'$classpath'" java_cup.Main "$@"
}
fixclasspath() {
windows=0
if [ `uname | grep -c CYGWIN` -ne 0 ]; then
windows=1
fi
cp="$1"
if [ "$windows" = 1 ]; then
cygpath -pw "$cp"
else
echo "$cp"
fi
}
unixfilename() {
windows=0
if [ `uname | grep -c CYGWIN` -ne 0 ]; then
windows=1
fi
cp="$1"
if [ "$windows" = 1 ]; then
cygpath -u "$cp"
else
echo "$cp"
fi
}
extra_cp=
args=
vmargs=
classpath=
java=java
dir=`unixfilename "$dir"`
while true; do
case "$1" in
"")
break
;;
-V)
verbose=1
shift
;;
-classpath|-cp)
shift
extra_cp="$extra_cp:$1"
shift
;;
-ext)
shift
ext="$1"
shift
;;
-j)
shift
vmargs="$vmargs '$1'"
shift
;;
-J)
shift
java="'$1'"
shift
;;
-rdebug)
shift
vmargs="${vmargs} -Xdebug -Xrunjdwp:transport=dt_socket,address=6666,server=y,suspend=y"
;;
-h)
usage=1
break
;;
*)
args="$args '$1'"
shift
;;
esac
done
if [ -n "$ext" ]; then
args="-ext '$ext' $args"
fi
classpath="$dir/classes:$dir/java_cup.jar"
classpath="$classpath:$extra_cp"
classpath=`fixclasspath "$classpath"`
if [ "$usage" = 1 ]; then
usage
exit 0
fi
if [ "$verbose" = 1 ]; then
compilerprint "$args"
fi
compiler "$args"