summaryrefslogtreecommitdiff
path: root/src/packrat-standard.ads
blob: bf0b8153394b8eeecb7bd6a56a4b6e8e748d9953 (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
       (Label_Enum    => Lexer_Labels,
        Element_Type  => Element_Type,
        Element_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
       (Label_Enum    => Parser_Labels,
        Element_Type  => Lexer_Tokens.Token,
        Element_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;