Debian Codegraph @

trip/lexical.rexx

raw
1 written = 0
2
3
4 data.1.caption = 'do'
5 data.1.1 = 14 'do 3; say hi'
6 data.1.2 = 14 'do 3;'
7 data.1.3 = 25 'do forever 5; say hallo; end'
8 data.1.4 = ''
9
10 data.2.caption = 'end'
11 data.2.1 = 10 'do 1; say hi; end; end'
12 data.2.2 = 10 'say hi; end'
13 data.2.3 = ''
14
15 data.3.caption = 'if'
16 data.3.1 = 18 'if 1'
17 data.3.2 = 14 'if 1 then;;'
18 data.3.3 = 18 'select; when 1; else nop; end'
19 data.3.4 = 08 'nop; then nop'
20 data.3.5 = 08 'nop; else nop'
21 data.3.6 = 08 'if 1 then nop; else nop; else nop'
22 data.3.7 = 08 'select; then nop; when 1 then nop; end'
23 data.3.8 = 18 'if 0; else nop'
24 data.3.9 = 14 'if 1 then nop; else'
25 data.3.10= 10 'if 1 then nop; else end'
26 data.3.11= 10 'do 3; if 1 then nop; else end'
27 data.3.12= 10 'do 3; if 1 then nop; else end; end'
28 data.3.13= 14 'if'
29 data.3.14= 08 'select; when 0 then nop; then nop; end'
30 data.3.15= ''
31
32 data.4.caption = 'select'
33 data.4.1 = 09 'when 1 then nop;'
34 data.4.2 = 07 'select; say hallo; end'
35 data.4.3 = 07 'select; when 0 then nop; say hallo; end'
36 data.4.4 = 07 'select; when 1 then nop; nop'
37 data.4.5 = 14 'select; when 1 then nop'
38 data.4.6 = 21 'select nop; when 1 then nop; end'
39 data.4.7 = 07 'select; end'
40 data.4.8 = 07 'select; otherwise'
41 data.4.9 = 14 'select; when 1 then nop'
42 data.4.10= 14 'select; when 1 then'
43 data.4.11= 14 'select; when 1'
44 data.4.12= 35 'select; when'
45 data.4.13= 21 'select foo'
46 data.4.14= 07 'select; otherwise; end'
47 data.4.15= 35 'select; when then nop; end'
48 data.4.16= 35 'select; when; then nop; end'
49 data.4.17= 07 'select; when 1 then nop; nop'
50 data.4.18= 07 'select; end junk'
51 data.4.19= 07 'select; end'
52 data.4.20= ''
53
54 data.5.caption = 'assignment'
55 data.5.1 = 31 '4=5'
56 data.5.2 = 31 '4==5'
57 data.5.3 = 31 '.4=5' /* Regina wrong */
58 data.5.4 = 31 '.4==5' /* Regina wrong */
59 data.5.5 = ''
60
61 data.6.caption = 'parse'
62 data.6.1 = 38 'parse source . *(a) .'
63 data.6.2 = 38 'parse source .2e'
64 data.6.3 = ''
65
66 data.7.caption = 'labels'
67 data.7.1 = 20 "'foo': bar"
68 data.7.2 = ''
69
70 data.8.caption = 'strings'
71 data.8.1 = 6 "foo = 'bar"
72 data.8.2 = 6 'foo = "bar'
73 data.8.3 = 6 "foo = bar /* " /**/
74 data.8.4 = ''
75
76 data.9.caption = 'when'
77 data.9.1 = 09 'when 1 then nop'
78 data.9.2 = 09 'otherwise nop'
79 data.9.3 = 09 'select; when 0 then nop; otherwise; nop; otherwise; nop; end'
80 data.9.4 = 09 'select; when 0 then nop; otherwise; nop; when 1 then nop; end'
81 data.9.5 = ''
82
83 data.10.caption = 'end'
84 data.10.1 = 10 'end'
85 data.10.2 = 10 'do i=3 to 5; nop; end j'
86 data.10.3 = 10 "i=1; do a.i=1 to 3; j=1; end a.j"
87 data.10.4 = 10 'i=1; do a.i=1 to 3; end a.1'
88 data.10.5 = 10 'do 3; nop; if 1 then end; end'
89 data.10.6 = 09 'if 1 then otherwise'
90 data.10.7 = 09 'if 1 then when'
91 data.10.8 = 10 'if 1 then end'
92 data.10.8 = ''
93
94 data.11.caption = 'data'
95 data.11.1 = 13 'say `'
96 data.11.2 = 13 'say ['
97 data.11.3 = 13 'say ]'
98 data.11.4 = 13 'say {'
99 data.11.5 = 13 'say }'
100 data.11.6 = ''
101
102 data.12.caption ='hex/bin'
103 data.12.1 = 15 'a="f f f"x'
104 data.12.2 = 15 "a='f f f'x"
105 data.12.3 = 15 'a=" f f"x'
106 data.12.4 = 15 "a=' f f'x"
107 data.12.5 = 15 'a="f f "x'
108 data.12.6 = 15 "a='f f 'x"
109 data.12.7 = 15 'a="1 1 1"b'
110 data.12.8 = 15 "a='1 1 1'b"
111 data.12.9 = 15 'a=" 1 1"b'
112 data.12.10= 15 "a=' 1 1'b"
113 data.12.11= 15 'a="1 1 "b'
114 data.12.12= 15 "a='1 1 'b"
115 data.12.13= 15 "a='fgf'x"
116 data.12.14= 15 "a='f00l'x"
117 data.12.15= 15 "a='1120'b"
118 data.12.16= ''
119
120 data.13.caption = 'signal'
121 data.13.1 = 16 'signal nonexitent'
122 data.13.2 = 16 'signal on novalue name nonexistent; drop xxx; say xxx'
123 data.13.3 = 16 'signal on notready name nonexistent; say lines("/nope1")'
124 data.13.4 = 16 'call on notready name nonexistent; xxx=lines("/nope2")'
125 data.13.5 = ''
126
127 /*
128 * Everything related to procedure must be checked in a separate
129 * script, since it is very sensitive to the setup in this file.
130 */
131
132 data.14.caption = 'strings'
133 data.14.1 = 19 'signal +34'
134 data.14.2 = 19 'signal'
135 data.14.3 = 19 'call'
136 data.14.4 = 19 'call +34'
137 data.14.5 = ''
138
139 data.15.caption = 'symbols'
140 data.15.1 = 25 'call on foobar'
141 data.15.2 = 25 'call on "name"'
142 data.15.3 = 19 'call on failure name "foobar"'
143 data.15.4 = 25 'call on'
144 data.15.5 = 25 'call on name foo'
145 data.15.6 = 19 'call on failure name'
146 data.15.7 = 20 'do i=3 to 5; nop; end "i"'
147 data.15.8 = 20 'do i=3 to 5; nop; end +i'
148 data.15.9 = 20 'do i=3 to 5; iterate "i"; end'
149 data.15.10= 20 'do i=3 to 5; iterate +i; end'
150 data.15.11= 20 'do i=3 to 5; leave "i"; end'
151 data.15.12= 20 'do i=3 to 5; leave +i; end'
152 data.15.13= 25 'signal on foobar'
153 data.15.14= 25 'signal on "name"'
154 data.15.15= 19 'signal on failure name "foobar"'
155 data.15.16= 25 'signal on'
156 data.15.17= 25 'signal on name foo'
157 data.15.18= 19 'signal on failure name'
158 data.15.19= 25 'numeric foobar'
159 data.15.20= 25 'numeric form foobar'
160 data.15.21= 25 'foobar='fff';numeric form (foobar)'
161 data.15.22= 35 'numeric fuzz **i'
162 data.15.23= 35 'numeric digits **i'
163 data.15.24= 21 'numeric form scientific foo'
164 data.15.25= 21 'numeric form engineering foo'
165 data.15.26= ''
166
167 data.16.caption = 'trailers'
168 data.16.1 = 25 'call on failure foo' /* Regina wrong */
169 data.16.2 = 19 'call on failure name testing foo'
170 data.16.3 = 25 'call off failure foo' /* Regina wrong */
171 data.16.4 = 25 'do forever foo; leave; end'
172 data.16.5 = 10 'do 3; leave; end foo'
173 data.16.6 = 21 'do i=1 to 3; leave; end i foo'
174 data.16.7 = 21 'do i=1 to 3; leave i foo; end'
175 data.16.8 = 21 'do i=1 to 3; iterate i foo; end'
176 data.16.9 = 21 'nop foo'
177 data.16.10= 21 'numeric form scientific foo'
178 data.16.11= 21 'numeric form engineering foo'
179 data.16.12= 21 'select foo; when 1 then nop; end'
180 data.16.13= 10 'select; when 1 then nop; end foo'
181 data.16.14= 21 'signal foo bar'
182 data.16.15= 19 'signal on novalue name foo bar'
183 data.16.16= 21 'signal off novalue name foo'
184 data.16.17= 21 'signal off novalue foo'
185 data.16.18= 21 'trace off forever'
186 data.16.19= 21 'trace off now'
187 data.16.20= ''
188
189 data.17.caption = 'trace'
190 data.17.1 = 24 'trace boffset'
191 data.17.2 = ''
192
193 data.18.caption = 'subkwd'
194 data.18.1 = 25 'call on failure foobar there'
195 data.18.2 = 25 'numeric foobar'
196 data.18.3 = 25 'numeric form foobar'
197 data.18.4 = 25 'parse foobar .'
198 data.18.5 = 25 'procedure foobar'
199 data.18.6 = 25 'signal on failure foobar there'
200 data.18.7 = ''
201
202 data.19.caption = 'wholenum'
203 data.19.1 = 26 'parse value x with . +9999999999 .'
204 data.19.2 = 26 'parse value x with . +9.5 .'
205 data.19.3 = 26 'var=1112223334; parse arg . +(var) .'
206 data.19.4 = 26 'var=9.5; parse value x with . +(var) .'
207 data.19.5 = 26 'a = 3**4.5'
208 data.19.6 = 26 'do 3.5; nop; end'
209 data.19.7 = 26 'do i=1 to 5 for 3.5; nop; end'
210 data.19.8 = 26 'numeric digits 5.5'
211 data.19.9 = 26 'numeric fuzz 1.5'
212 data.19.10= 26 'trace 3.5'
213 data.19.11= ''
214
215 data.20.caption = 'do'
216 data.20.1 = 27 'do 4 by 4; nop; end'
217 data.20.2 = 27 'do 4 to 4; nop; end'
218 data.20.3 = 27 'do 4 for 4; nop; end'
219 data.20.4 = 27 'do i=1 by 4 by 4; nop; end'
220 data.20.5 = 27 'do i=1 to 4 to 4; nop; end'
221 data.20.6 = 27 'do i=1 for 4 for 4; nop; end'
222 data.20.7 = 27 'do 4 until 0 while 1; nop; end'
223 data.20.8 = 27 'do 4 while 0 until 1; nop; end'
224 data.20.9 = 25 'do forever to 4; nop; end'
225 data.20.10= 34 'do while 0 for 5; nop; end'
226 data.20.11= 27 'to=1; do to+1; nop; end'
227 data.20.12= 27 'by=1; do by+1; nop; end'
228 data.20.13= 27 'for=1; do for+1; nop; end'
229 data.20.14= ''
230
231 data.21.caption = 'loops'
232 data.21.1 = 28 'iterate'
233 data.21.2 = 28 'iterate a'
234 data.21.3 = 28 'leave'
235 data.21.4 = 28 'leave a'
236 data.21.5 = 28 'do 3; iterate a; end'
237 data.21.6 = 28 'do 3; leave a; end'
238 data.21.7 = 28 'do foo=1 to 3; iterate bar; end'
239 data.21.8 = 28 'do foo=1 to 3; leave bar; end'
240 data.21.9 = 28 'do 1; interpret iterate; end'
241 data.21.10= 28 'do 1; interpret leave; end'
242 data.21.11= ''
243
244 data.22.caption = 'express'
245 data.22.1 = 33 'numeric digits; numeric fuzz 10'
246 data.22.2 = 33 'numeric fuzz 4; numeric digits 2'
247 data.22.3 = 33 'numeric digits 0'
248 data.22.4 = 26 'numeric digits -1'
249 data.22.5 = 26 'numeric fuzz -1'
250 data.22.6 = 25 'numeric form ("foobar")'
251 data.22.7 = 33 'do -1; nop; end'
252 data.22.8 = 33 'do i=1 to 3 for -1; nop; end'
253 data.22.9 = ''
254
255
256 Data.30.1 = 20 'drop "xxx"'
257
258
259 data.a.1 = 17 'call DoubleProc'
260
261 j = 1
262 startoflooop:
263 if symbol('data.j.caption')\='VAR' then signal endoftesst
264
265 call notify data.j.caption
266 i = 1
267 startofloop:
268 if symbol('data.j.i')\='VAR' then do
269 say 'Inconsistent data for DATA.'j'.'i
270 exit
271 end
272
273 if data.j.i=='' then do
274 do k=i+1 for 10
275 if symbol('data.j.k')=='VAR' then do
276 say 'Extra data for DATA.'j'.'k
277 exit
278 end
279 end
280 signal endoftest
281 end
282
283 signal on syntax
284 parse var data.j.i num string
285 num = num + 0
286 interpret string
287 say
288 say 'Didn''t catch "'string'" as syntax error' num
289 signal endofloop
290
291 syntax:
292 if rc\=num then do
293 say
294 say 'Reports "'string'" as syntax error' rc', not' num
295 say condition('e')
296 end
297
298 endofloop:
299 i = i + 1
300 signal startofloop
301
302 endoftest:
303 endoflooop:
304 j = j + 1
305 signal startoflooop
306
307 endoftesst:
308 say
309 exit 0
310
311
312 notify:
313 parse arg word .
314 written = written + length(word) + 2
315 if written>75 then do
316 written = length(word)
317 say ' '
318 end
319 call charout , word || ', '
320 return
321
322
323 oops:
324 say 'Naa har du driti paa draget igjen, Anders!'
325 exit 1
326
327
328