summaryrefslogtreecommitdiff
path: root/src/packrat-standard.ads
blob: 005d17a964d44c397d706347b94309fcdd404f42 (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


with

    Packrat.Traits,
    Packrat.Lexers,
    Packrat.Parse_Graphs,
    Packrat.Parsers;


generic

    type Lexer_Labels is (<>);
    type Parser_Labels is (<>);

    type Element_Type is private;
    type Element_Array is array (Positive range <>) of Element_Type;

    with function "<" (Left, Right : in Element_Type) return Boolean is <>;

package Packrat.Standard is


    package Lexer_Traits is new Packrat.Traits
       (Lab_Enum   => Lexer_Labels,
        Elem_Type  => Element_Type,
        Elem_Array => Element_Array);

    package Lexers is new Packrat.Lexers
       (Traits => Lexer_Traits);

    package Lexer_Tokens renames Lexer_Traits.Tokens;

    subtype Lexer_Result is Lexer_Tokens.Token_Array;


    package Parser_Traits is new Packrat.Traits
       (Lab_Enum   => Parser_Labels,
        Elem_Type  => Lexer_Tokens.Token_Type,
        Elem_Array => Lexer_Tokens.Token_Array,
        "<"        => Lexer_Tokens."<");

    package Parse_Graphs is new Packrat.Parse_Graphs
       (Traits => Parser_Traits);

    package Parsers is new Packrat.Parsers
       (Traits => Parser_Traits,
        Graphs => Parse_Graphs);

    package Parser_Tokens renames Parser_Traits.Tokens;

    subtype Parser_Result is Parse_Graphs.Parse_Graph;


end Packrat.Standard;