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
|
with
Unit_Tests;
use
Unit_Tests;
private with
Packrat.No_Lex,
Packrat.Parsers.Debug,
Packrat.Errors,
Packrat.Traits;
package Rat_Tests.Parsers is
function Sequence_Check return Test_Result;
function Sequence_2_Check return Test_Result;
function Choice_Check return Test_Result;
function Choice_2_Check return Test_Result;
function Count_Check return Test_Result;
function Many_Nomin_Check return Test_Result;
function Many_Min_Check return Test_Result;
function Followed_By_Check return Test_Result;
function Not_Followed_By_Check return Test_Result;
function Many_Until_Nomin_Check return Test_Result;
function Many_Until_Min_Check return Test_Result;
function Satisfy_Check return Test_Result;
function Satisfy_With_Check return Test_Result;
function Match_Check return Test_Result;
function Match_With_Check return Test_Result;
function Multimatch_Check return Test_Result;
function Take_Check return Test_Result;
function Take_While_Check return Test_Result;
function Take_Until_Check return Test_Result;
function Empty_Check return Test_Result;
function Not_Empty_Check return Test_Result;
Combinator_Tests : Test_Array :=
((+"Sequence", Sequence_Check'Access),
(+"Sequence_2", Sequence_2_Check'Access),
(+"Choice", Choice_Check'Access),
(+"Choice_2", Choice_2_Check'Access),
(+"Count", Count_Check'Access),
(+"Many No Minimum", Many_Nomin_Check'Access),
(+"Many With Minimum", Many_Min_Check'Access),
(+"Followed_By", Followed_By_Check'Access),
(+"Not_Followed_By", Not_Followed_By_Check'Access),
(+"Many_Until No Minimum", Many_Until_Nomin_Check'Access),
(+"Many_Until With Minimum", Many_Until_Min_Check'Access),
(+"Satisfy", Satisfy_Check'Access),
(+"Satisfy_With", Satisfy_With_Check'Access),
(+"Match", Match_Check'Access),
(+"Match_With", Match_With_Check'Access),
(+"Multimatch", Multimatch_Check'Access),
(+"Take", Take_Check'Access),
(+"Take_While", Take_While_Check'Access),
(+"Take_Until", Take_Until_Check'Access),
(+"Empty", Empty_Check'Access),
(+"Not_Empty", Not_Empty_Check'Access));
function Default_Result_Check return Test_Result;
Other_Tests : Test_Array :=
(1 => (+"Default Combinator Result", Default_Result_Check'Access));
private
type Parser_Labels_One is (One, Two, Three, Four, Five, Six);
package Pone is new Packrat.No_Lex
(Parser_Labels_One, Character, String);
package One_Debug is new Pone.Parsers.Debug;
function Match_AB is new Pone.Parsers.Multimatch ("ab");
function Match_CDE is new Pone.Parsers.Multimatch ("cde");
function Match_FG is new Pone.Parsers.Multimatch ("fg");
function Seq_ABCDEFG is new Pone.Parsers.Sequence
((Match_AB'Access, Match_CDE'Access, Match_FG'Access));
function Match_C is new Pone.Parsers.Match ('c');
function Many_C is new Pone.Parsers.Many (Match_C, 1);
function Match_CC is new Pone.Parsers.Multimatch ("cc");
function Match_CCCDE is new Pone.Parsers.Multimatch ("cccde");
function Choose_CCCDE is new Pone.Parsers.Choice
((Many_C'Access, Match_CC'Access, Match_CCCDE'Access));
function Alphanum_Switch
(Char : in Character)
return Character;
end Rat_Tests.Parsers;
|