summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2020-12-05 18:53:34 +1100
committerJed Barber <jjbarber@y7mail.com>2020-12-05 18:53:34 +1100
commit303d4adff90279d0c9ac79adc667abc4d65df945 (patch)
treefc052cc73fbf75ee07a035f98d3ffda543f4b3e3
parentee04783f617da18c15ca2b554081bcb7df418cf4 (diff)
Bug in parameter visibility when using Traits to instantiate other packages fixed
-rw-r--r--src/packrat-no_lex.ads6
-rw-r--r--src/packrat-standard.ads14
-rw-r--r--src/packrat-traits.ads16
3 files changed, 22 insertions, 14 deletions
diff --git a/src/packrat-no_lex.ads b/src/packrat-no_lex.ads
index bde416f..58a5627 100644
--- a/src/packrat-no_lex.ads
+++ b/src/packrat-no_lex.ads
@@ -20,9 +20,9 @@ package Packrat.No_Lex is
package Parser_Traits is new Packrat.Traits
- (Label_Enum => Parser_Labels,
- Element_Type => Element_Type,
- Element_Array => Element_Array);
+ (Lab_Enum => Parser_Labels,
+ Elem_Type => Element_Type,
+ Elem_Array => Element_Array);
package Parse_Graphs is new Packrat.Parse_Graphs
(Traits => Parser_Traits);
diff --git a/src/packrat-standard.ads b/src/packrat-standard.ads
index b51804d..005d17a 100644
--- a/src/packrat-standard.ads
+++ b/src/packrat-standard.ads
@@ -22,9 +22,9 @@ package Packrat.Standard is
package Lexer_Traits is new Packrat.Traits
- (Label_Enum => Lexer_Labels,
- Element_Type => Element_Type,
- Element_Array => Element_Array);
+ (Lab_Enum => Lexer_Labels,
+ Elem_Type => Element_Type,
+ Elem_Array => Element_Array);
package Lexers is new Packrat.Lexers
(Traits => Lexer_Traits);
@@ -35,10 +35,10 @@ package Packrat.Standard is
package Parser_Traits is new Packrat.Traits
- (Label_Enum => Parser_Labels,
- Element_Type => Lexer_Tokens.Token_Type,
- Element_Array => Lexer_Tokens.Token_Array,
- "<" => Lexer_Tokens."<");
+ (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);
diff --git a/src/packrat-traits.ads b/src/packrat-traits.ads
index cf4ba89..7f25dd9 100644
--- a/src/packrat-traits.ads
+++ b/src/packrat-traits.ads
@@ -7,15 +7,23 @@ with
generic
- type Label_Enum is (<>);
- type Element_Type is private;
- type Element_Array is array (Positive range <>) of Element_Type;
+ type Lab_Enum is (<>);
+ type Elem_Type is private;
+ type Elem_Array is array (Positive range <>) of Elem_Type;
- with function "<" (Left, Right : in Element_Type) return Boolean is <>;
+ with function "<" (Left, Right : in Elem_Type) return Boolean is <>;
package Packrat.Traits is
+ -- Should these even really be necessary, or should the original
+ -- types be visible even to packages that Traits gets passed to?
+ -- I have no idea.
+ subtype Label_Enum is Lab_Enum;
+ subtype Element_Type is Elem_Type;
+ subtype Element_Array is Elem_Array;
+
+
function "<"
(Left, Right : in Element_Array)
return Boolean;