summaryrefslogtreecommitdiff
path: root/test/checkeofact.txl
blob: 81890133558a8551358dc7c77a62d3b0058b2db1 (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
include "testcase.txl"

define program
		[lang_indep]
	|	'yes
	|	'no
end define

rule findEof1
	match [machine_expr_item]
		'>/
end rule

rule findEof2
	match [machine_expr_item]
		'</
end rule

rule findEof3
	match [machine_expr_item]
		'$/
end rule

rule findEof4
	match [machine_expr_item]
		'%/
end rule

rule findEof5
	match [machine_expr_item]
		'@/
end rule

rule findEof6
	match [machine_expr_item]
		'<>/
end rule

rule findEof7
	match [repeat machine_expr_item]
		'> 'eof _ [repeat machine_expr_item]
end rule

rule findEof8
	match [repeat machine_expr_item]
		'< 'eof _ [repeat machine_expr_item]
end rule

rule findEof9
	match [repeat machine_expr_item]
		'$ 'eof _ [repeat machine_expr_item]
end rule

rule findEof10
	match [repeat machine_expr_item]
		'% 'eof _ [repeat machine_expr_item]
end rule

rule findEof11
	match [repeat machine_expr_item]
		'@ 'eof _ [repeat machine_expr_item]
end rule

rule findEof12
	match [repeat machine_expr_item]
		'<> 'eof _ [repeat machine_expr_item]
end rule

rule findScanner
	match [machine_expr_item]
		'|* _ [repeat scanner_item] '*|
end rule

function findEof P [program]
	replace [program]
		_ [program]
	where
		P 
			[findEof1] [findEof2] [findEof3]
			[findEof4] [findEof5] [findEof6]
			[findEof7] [findEof8] [findEof9]
			[findEof10] [findEof11] [findEof12]
			[findScanner]
	by
		'yes
end function
		
function main
	replace [program]
		P [program]
	construct NewP [program]
		'no
	by
		NewP [findEof P]
end function