diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/packrat-no_lex.ads (renamed from src/packrat-text-no_lex.ads) | 15 | ||||
-rw-r--r-- | src/packrat-standard.ads (renamed from src/packrat-text-standard.ads) | 25 | ||||
-rw-r--r-- | src/packrat-text-wide.ads | 48 | ||||
-rw-r--r-- | src/packrat-text-wide_wide.ads | 48 | ||||
-rw-r--r-- | src/packrat-text.ads | 29 |
5 files changed, 57 insertions, 108 deletions
diff --git a/src/packrat-text-no_lex.ads b/src/packrat-no_lex.ads index 2826df5..bde416f 100644 --- a/src/packrat-text-no_lex.ads +++ b/src/packrat-no_lex.ads @@ -11,13 +11,18 @@ generic type Parser_Labels is (<>); -package Packrat.Text.No_Lex 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.No_Lex is package Parser_Traits is new Packrat.Traits (Label_Enum => Parser_Labels, - Element_Type => Character, - Element_Array => String); + Element_Type => Element_Type, + Element_Array => Element_Array); package Parse_Graphs is new Packrat.Parse_Graphs (Traits => Parser_Traits); @@ -26,9 +31,11 @@ package Packrat.Text.No_Lex is (Traits => Parser_Traits, Graphs => Parse_Graphs); + package Parser_Tokens renames Parser_Traits.Tokens; + subtype Parser_Result is Parse_Graphs.Parse_Graph; -end Packrat.Text.No_Lex; +end Packrat.No_Lex; diff --git a/src/packrat-text-standard.ads b/src/packrat-standard.ads index 6e70431..bf0b815 100644 --- a/src/packrat-text-standard.ads +++ b/src/packrat-standard.ads @@ -13,25 +13,32 @@ generic type Lexer_Labels is (<>); type Parser_Labels is (<>); -package Packrat.Text.Standard 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 => Character, - Element_Array => String); + Element_Type => Element_Type, + Element_Array => Element_Array); package Lexers is new Packrat.Lexers (Traits => Lexer_Traits); - subtype Lexer_Result is Lexer_Traits.Tokens.Token_Array; + 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_Traits.Tokens.Token, - Element_Array => Lexer_Traits.Tokens.Token_Array, - "<" => Lexer_Traits.Tokens."<"); + Element_Type => Lexer_Tokens.Token, + Element_Array => Lexer_Tokens.Token_Array, + "<" => Lexer_Tokens."<"); package Parse_Graphs is new Packrat.Parse_Graphs (Traits => Parser_Traits); @@ -40,9 +47,11 @@ package Packrat.Text.Standard is (Traits => Parser_Traits, Graphs => Parse_Graphs); + package Parser_Tokens renames Parser_Traits.Tokens; + subtype Parser_Result is Parse_Graphs.Parse_Graph; -end Packrat.Text.Standard; +end Packrat.Standard; diff --git a/src/packrat-text-wide.ads b/src/packrat-text-wide.ads deleted file mode 100644 index 7fc6ca1..0000000 --- a/src/packrat-text-wide.ads +++ /dev/null @@ -1,48 +0,0 @@ - - -with - - Packrat.Traits, - Packrat.Lexers, - Packrat.Parse_Graphs, - Packrat.Parsers; - - -generic - - type Lexer_Labels is (<>); - type Parser_Labels is (<>); - -package Packrat.Text.Wide is - - - package Lexer_Traits is new Packrat.Traits - (Label_Enum => Lexer_Labels, - Element_Type => Wide_Character, - Element_Array => Wide_String); - - package Lexers is new Packrat.Lexers - (Traits => Lexer_Traits); - - subtype Lexer_Result is Lexer_Traits.Tokens.Token_Array; - - - package Parser_Traits is new Packrat.Traits - (Label_Enum => Parser_Labels, - Element_Type => Lexer_Traits.Tokens.Token, - Element_Array => Lexer_Traits.Tokens.Token_Array, - "<" => Lexer_Traits.Tokens."<"); - - package Parse_Graphs is new Packrat.Parse_Graphs - (Traits => Parser_Traits); - - package Parsers is new Packrat.Parsers - (Traits => Parser_Traits, - Graphs => Parse_Graphs); - - subtype Parser_Result is Parse_Graphs.Parse_Graph; - - -end Packrat.Text.Wide; - - diff --git a/src/packrat-text-wide_wide.ads b/src/packrat-text-wide_wide.ads deleted file mode 100644 index dad33db..0000000 --- a/src/packrat-text-wide_wide.ads +++ /dev/null @@ -1,48 +0,0 @@ - - -with - - Packrat.Traits, - Packrat.Lexers, - Packrat.Parse_Graphs, - Packrat.Parsers; - - -generic - - type Lexer_Labels is (<>); - type Parser_Labels is (<>); - -package Packrat.Text.Wide_Wide is - - - package Lexer_Traits is new Packrat.Traits - (Label_Enum => Lexer_Labels, - Element_Type => Wide_Wide_Character, - Element_Array => Wide_Wide_String); - - package Lexers is new Packrat.Lexers - (Traits => Lexer_Traits); - - subtype Lexer_Result is Lexer_Traits.Tokens.Token_Array; - - - package Parser_Traits is new Packrat.Traits - (Label_Enum => Parser_Labels, - Element_Type => Lexer_Traits.Tokens.Token, - Element_Array => Lexer_Traits.Tokens.Token_Array, - "<" => Lexer_Traits.Tokens."<"); - - package Parse_Graphs is new Packrat.Parse_Graphs - (Traits => Parser_Traits); - - package Parsers is new Packrat.Parsers - (Traits => Parser_Traits, - Graphs => Parse_Graphs); - - subtype Parser_Result is Parse_Graphs.Parse_Graph; - - -end Packrat.Text.Wide_Wide; - - diff --git a/src/packrat-text.ads b/src/packrat-text.ads index 3d239e8..c3a5c51 100644 --- a/src/packrat-text.ads +++ b/src/packrat-text.ads @@ -1,8 +1,37 @@ +with + + Packrat.Standard; + + +generic + + type Lexer_Labels is (<>); + type Parser_Labels is (<>); + package Packrat.Text is + package Standard is new Packrat.Standard + (Lexer_Labels => Lexer_Labels, + Parser_Labels => Parser_Labels, + Element_Type => Character, + Element_Array => String); + + package Wide is new Packrat.Standard + (Lexer_Labels => Lexer_Labels, + Parser_Labels => Parser_Labels, + Element_Type => Wide_Character, + Element_Array => Wide_String); + + package Wide_Wide is new Packrat.Standard + (Lexer_Labels => Lexer_Labels, + Parser_Labels => Parser_Labels, + Element_Type => Wide_Wide_Character, + Element_Array => Wide_Wide_String); + + end Packrat.Text; |