summaryrefslogtreecommitdiff
path: root/tests/general/tpp.ok
blob: a309f8a6b51d1df9508338df7efce6c5d83f1b85 (plain)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
tpp.icn:
File bad.ppdirs; Line 2 # $line: no line number
File bad.ppdirs; Line 3 # $line: too many arguments
File bad.ppdirs; Line 4 # $line: too many arguments
File bad.ppdirs; Line 5 # $line: too many arguments
File bad.ppdirs; Line 6 # $line: too many arguments
File bad.ppdirs; Line 7 # $line: invalid file name
File bad.ppdirs; Line 8 # $line: invalid file name
File bad.ppdirs; Line 9 # $line: invalid file name
File bad.ppdirs; Line 10 # "unknown": invalid preprocessing directive
File include.tests; Line 6 # "abcdef"ghi#jkl#mno\pqr stu": cannot open
File include.tests; Line 8 # $include: invalid file name
File include.tests; Line 10 # $include: invalid file name
File include.tests; Line 12 # $include: invalid file name
File include.tests; Line 14 # $include: invalid file name
File include.tests; Line 16 # "nonexistent": cannot open
File include.tests; Line 18 # $include: too many arguments
File include.tests; Line 20 # $include: too many arguments
File tpp3.icn; Line 3 # "tpp1.icn": circular include
File tpp2.icn; Line 3 # "tpp3.icn": circular include
File define.tst; Line 4 # $define: missing name
File define.tst; Line 5 # $define: missing name
File define.tst; Line 6 # $define: missing name
File define.tst; Line 7 # $define: unterminated literal
File define.tst; Line 8 # $define: unterminated literal
File define.tst; Line 9 # $define: "(" after name requires preceding space
File define.tst; Line 32 # "pi": value redefined
File error.tst; Line 2 # explicit $error
File error.tst; Line 3 # explicit $error
File error.tst; Line 4 # explicit $error
File error.tst; Line 5 # "this program does not work": explicit $error
File if.tst; Line 117 # $ifdef/$ifndef: missing name
File if.tst; Line 119 # $ifdef/$ifndef: missing name
File if.tst; Line 124 # "notdef": extraneous arguments on $else/$endif
File if.tst; Line 125 # "notdef": extraneous arguments on $else/$endif
File if.tst; Line 127 # "notdef": extraneous arguments on $else/$endif
File if.tst; Line 128 # "notdef": extraneous arguments on $else/$endif
File if.tst; Line 131 # unexpected $endif
File if.tst; Line 132 # unexpected $else
File tpp5.icn; Line 3 # unexpected $endif
File tpp5.icn; Line 5 # unexpected $else
File tpp5.icn; Line 12 # unterminated $if
File if.tst; Line 134 # unexpected $else
File if.tst; Line 135 # unexpected $endif
File tpp5.icn; Line 3 # unexpected $endif
File tpp5.icn; Line 5 # unexpected $else
File tpp5.icn; Line 12 # unterminated $if
File if.tst; Line 139 # unexpected $else
File if.tst; Line 140 # unexpected $endif
File invented; Line 113 # "(& show line)": extraneous arguments on $else/$endif
File invented; Line 224 # "(& show line)": extraneous arguments on $else/$endif
tpp9.icn:
50 errors
#line 0 "tpp.icn"
# tpp.icn -- test file for Icon preprocessor
#
# generates lots of deliberate errors
# includes tpp1.icn, tpp2.icn, tpp3.icn

# force out #lines to test that this file is called "stdin"
#line 0 "/dev/null"
#line 7 "tpp.icn"

# following should be legal
#line 11 "a.b.c"
#line 22 "defgh"
#line 33 "ijklm"
#line 44 "ijklm"
#line 55 "xyzzy"

#line 0 "bad #lines"
# following should be illegal but ignored





# line 95 "passed through unrecognized"




# following should be legal
#line 11 "a.b.c"
#line 22 "defgh"
#line 33 "ijklm"
#line 44 "ijklm"
#line 55 "xyzzy"
$( digraphs for EBCDIC $)

#line 0 "bad.ppdirs"
# following should be illegal and diagnosed










#line 0 "include.tests"
=a=
#line 0 "/dev/null"
#line 2 "include.tests"
=b=
#line 0 "/dev/null"
#line 4 "include.tests"
=c=

=d=

=e=

=f=

=g=

=h=

=i=

=j=

=k=
#line 0 "tpp1.icn"
#  tpp1.icn: part 1 of circular include test
   =1=
#line 0 "tpp2.icn"
#  tpp2.icn: part 1 of circular include test
      =2=
#line 0 "tpp3.icn"
#  tpp3.icn: part 1 of circular include test
         =3=

         =3=
#line 3 "tpp2.icn"
      =2=
#line 3 "tpp1.icn"
   =1=
#line 22 "include.tests"
=l=
#line 0 "tpp3.icn"
#  tpp3.icn: part 1 of circular include test
         =3=
#line 0 "tpp1.icn"
#  tpp1.icn: part 1 of circular include test
   =1=
#line 0 "tpp2.icn"
#  tpp2.icn: part 1 of circular include test
      =2=

      =2=
#line 3 "tpp1.icn"
   =1=
#line 3 "tpp3.icn"
         =3=
#line 24 "include.tests"
=m=

#line 0 "predef.tst"
#== predef test ==
should be defined as 1:  1  1  1
should not be defined:  _VMS  _EBCDIC  _DOS_FUNCTIONS
it depends: _COMPILED _INTERPRETED




bogus:  pipes:_PIPES  ascii:128  ebcdic:0

#line 0 "define.tst"
#== define test ==

#= illegal =







#= null =


a==b==c

#= simple =









1 3.14159 + "string" 'aeiou' ((sqrt(5) + 1) / 2) "fffrtb"
1+3.14159,+/"string",'aeiou'\((sqrt(5) + 1) / 2)?"fffrtb"!	# one pi plus etc
1"pi"+"twine"'aeiou'"expr""fffrtb"
'one'3.14159'plus'"string"'vowels'((sqrt(5) + 1) / 2)'xy_47_Hike'

#= redefinition =

3.14159


2.7183

#= deferred interpretation =


42 42



47 47

#= dubious pasting=


123e3  456e+3

#= recursion =

r

rr rr



a a a a a a a a a a a a a a a a a a a a a a a a a a a
b b b b b b b b b b b b b b b b b b b b b b b b b b b
c c c c c c c c c c c c c c c c c c c c c c c c c c c

= context =

123_abc+<%>+123<%>+abc_+<%>"_"<%>+36rX<%>+123e10<%>+12.e+5<%>+e7_+<%>#_

#line 0 "error.tst"
#= $error =





#line 0 "if.tst"
#= conditional compilation =



# $ifdef & $ifndef both true and false, with and without $else


   "isdef is defined"


#line 13 "if.tst"

#line 17 "if.tst"


   "notdef is not defined"



   "isdef is defined"
#line 27 "if.tst"

#line 31 "if.tst"
   "notdef is not defined"


# nesting without $else


   (true...)
#line 45 "if.tst"
   (...true)


# full nesting, with some nonstandard spacing


   (begin true branch)

      "isdef is defined"
#line 57 "if.tst"
   (end true branch)
#line 67 "if.tst"

# test all paths through four nested ifs
#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test
#line 32 "tpp4.icn"
#line 47 "tpp4.icn"
#line 54 "tpp4.icn"
#line 57 "tpp4.icn"
	    - - - - : id1 id2 id3 id4




#line 70 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test
#line 32 "tpp4.icn"
#line 47 "tpp4.icn"
#line 54 "tpp4.icn"

	    - - - + : id1 id2 id3 *4*
#line 59 "tpp4.icn"



#line 72 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test
#line 32 "tpp4.icn"
#line 47 "tpp4.icn"


	    - - + + : id1 id2 *3* *4*
#line 53 "tpp4.icn"
#line 60 "tpp4.icn"


#line 74 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test
#line 32 "tpp4.icn"
#line 47 "tpp4.icn"

#line 51 "tpp4.icn"
	    - - + - : id1 id2 *3* id4

#line 60 "tpp4.icn"


#line 76 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test
#line 32 "tpp4.icn"


#line 37 "tpp4.icn"
	    - + + - : id1 *2* *3* id4

#line 46 "tpp4.icn"
#line 61 "tpp4.icn"

#line 78 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test
#line 32 "tpp4.icn"



	    - + + + : id1 *2* *3* *4*
#line 39 "tpp4.icn"
#line 46 "tpp4.icn"
#line 61 "tpp4.icn"

#line 80 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test
#line 32 "tpp4.icn"

#line 40 "tpp4.icn"

	    - + - + : id1 *2* id3 *4*
#line 45 "tpp4.icn"

#line 61 "tpp4.icn"

#line 82 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test
#line 32 "tpp4.icn"

#line 40 "tpp4.icn"
#line 43 "tpp4.icn"
	    - + - - : id1 *2* id3 id4


#line 61 "tpp4.icn"

#line 84 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test


#line 10 "tpp4.icn"
#line 13 "tpp4.icn"
	    + + - - : *1* *2* id3 id4


#line 31 "tpp4.icn"
#line 62 "tpp4.icn"
#line 86 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test


#line 10 "tpp4.icn"

	    + + - + : *1* *2* id3 *4*
#line 15 "tpp4.icn"

#line 31 "tpp4.icn"
#line 62 "tpp4.icn"
#line 88 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test




	    + + + + : *1* *2* *3* *4*
#line 9 "tpp4.icn"
#line 16 "tpp4.icn"
#line 31 "tpp4.icn"
#line 62 "tpp4.icn"
#line 90 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test



#line 7 "tpp4.icn"
	    + + + - : *1* *2* *3* id4

#line 16 "tpp4.icn"
#line 31 "tpp4.icn"
#line 62 "tpp4.icn"
#line 92 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test

#line 17 "tpp4.icn"

#line 21 "tpp4.icn"
	    + - + - : *1* id2 *3* id4

#line 30 "tpp4.icn"

#line 62 "tpp4.icn"
#line 94 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test

#line 17 "tpp4.icn"


	    + - + + : *1* id2 *3* *4*
#line 23 "tpp4.icn"
#line 30 "tpp4.icn"

#line 62 "tpp4.icn"
#line 96 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test

#line 17 "tpp4.icn"
#line 24 "tpp4.icn"

	    + - - + : *1* id2 id3 *4*
#line 29 "tpp4.icn"


#line 62 "tpp4.icn"
#line 98 "if.tst"

#line 0 "tpp4.icn"
#  tpp4.icn: nested $if test

#line 17 "tpp4.icn"
#line 24 "tpp4.icn"
#line 27 "tpp4.icn"
	    + - - - : *1* id2 id3 id4



#line 62 "tpp4.icn"
#line 100 "if.tst"


# make sure it accepts anything resembling an $if when skipping

#line 113 "if.tst"
<should pass this line>

# test diagnostics for missing args





# test diagnostics for extraneous args
#line 124 "if.tst"


#line 128 "if.tst"

# test else/endif out of place


#line 0 "tpp5.icn"
# tpp5.icn: test for unterminated $if






#line 133 "if.tst"


# now try again when unterminated $if succeeds

#line 0 "tpp5.icn"
# tpp5.icn: test for unterminated $if






#line 9 "tpp5.icn"


#outer unterminated $ifdef should get error
#line 138 "if.tst"



# test line directives encountered while skipping

#line 113 "invented"

#line 224 "invented"
#line 0 "tpp9.icn"
# tpp9.icn: test that predefined symbols revert
# to correct values with the start of a new file

pipes:1  ascii:1  ebcdic:_EBCDIC   # were redefined in tpp.icn

should be defined as 1:  1  1  1
should not be defined:  _VMS  _EBCDIC  _DOS_FUNCTIONS
it depends: _COMPILED _INTERPRETED