diff options
author | Jed Barber <jjbarber@y7mail.com> | 2020-12-05 00:28:15 +1100 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2020-12-05 00:28:15 +1100 |
commit | 01862116fefc0fb241beca2fb5402195dc933f7e (patch) | |
tree | 43f1bf4882dd8a80348cd743a63f453df2be713d /test | |
parent | a21cc8153592700ae7cb2cdfbb24b377e096a22a (diff) |
Moved Finished_Tokens and related types to Tokens package
Diffstat (limited to 'test')
-rw-r--r-- | test/packrat-lexers-debug.adb | 2 | ||||
-rw-r--r-- | test/packrat-lexers-debug.ads | 2 | ||||
-rw-r--r-- | test/rat_tests-lexers.adb | 4 | ||||
-rw-r--r-- | test/rat_tests-parse_graphs.adb | 92 | ||||
-rw-r--r-- | test/rat_tests-tokens.adb | 12 | ||||
-rw-r--r-- | test/test_main.adb | 2 |
6 files changed, 57 insertions, 57 deletions
diff --git a/test/packrat-lexers-debug.adb b/test/packrat-lexers-debug.adb index d748fd4..f7121e1 100644 --- a/test/packrat-lexers-debug.adb +++ b/test/packrat-lexers-debug.adb @@ -91,7 +91,7 @@ package body Packrat.Lexers.Debug is function Element (Vec : in Token_Vector; Dex : in Positive) - return Traits.Tokens.Token is + return Traits.Tokens.Token_Type is begin return Token_Vectors.Vector (Vec).Element (Dex); end Element; diff --git a/test/packrat-lexers-debug.ads b/test/packrat-lexers-debug.ads index 0dace45..0a8d1fe 100644 --- a/test/packrat-lexers-debug.ads +++ b/test/packrat-lexers-debug.ads @@ -63,7 +63,7 @@ package Packrat.Lexers.Debug is function Element (Vec : in Token_Vector; Dex : in Positive) - return Traits.Tokens.Token; + return Traits.Tokens.Token_Type; diff --git a/test/rat_tests-lexers.adb b/test/rat_tests-lexers.adb index 95324a9..e216461 100644 --- a/test/rat_tests-lexers.adb +++ b/test/rat_tests-lexers.adb @@ -555,7 +555,7 @@ package body Rat_Tests.Lexers is function Stamp_Check return Test_Result is - use type Slexy_Traits.Tokens.Token; + use type Slexy_Traits.Tokens.Token_Type; use type Packrat.Result_Status; use type Slexy.Component_Result; @@ -654,7 +654,7 @@ package body Rat_Tests.Lexers is package Swordy is new Packrat.Lexers (Swordy_Traits); package Swolbug is new Swordy.Debug; - use type Swordy_Traits.Tokens.Token; + use type Swordy_Traits.Tokens.Token_Type; use type Swordy_Traits.Tokens.Token_Array; function Satisfy_Letter is new Swordy.Satisfy (PU.Is_Letter); diff --git a/test/rat_tests-parse_graphs.adb b/test/rat_tests-parse_graphs.adb index 5cc0edb..06f977b 100644 --- a/test/rat_tests-parse_graphs.adb +++ b/test/rat_tests-parse_graphs.adb @@ -21,31 +21,31 @@ package body Rat_Tests.Parse_Graphs is -- These tokens are defined here purely to reduce verbosity when -- manually constructing the various test graphs in the package initialisation. - Noun_1 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Noun, 1, "i"); - Noun_4 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Noun, 4, "man"); - Noun_7 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Noun, 7, "park"); - Noun_10 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Noun, 10, "bat"); + Noun_1 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Noun, 1, "i"); + Noun_4 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Noun, 4, "man"); + Noun_7 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Noun, 7, "park"); + Noun_10 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Noun, 10, "bat"); - Det_3 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Determiner, 3, "a"); - Det_6 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Determiner, 6, "the"); - Det_9 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Determiner, 9, "a"); + Det_3 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Determiner, 3, "a"); + Det_6 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Determiner, 6, "the"); + Det_9 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Determiner, 9, "a"); - NP_1 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Noun_Phrase, 1, ""); - NP_3 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Noun_Phrase, 3, ""); - NP_6 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Noun_Phrase, 6, ""); - NP_9 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Noun_Phrase, 9, ""); + NP_1 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Noun_Phrase, 1, ""); + NP_3 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Noun_Phrase, 3, ""); + NP_6 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Noun_Phrase, 6, ""); + NP_9 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Noun_Phrase, 9, ""); - Prep_5 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Preposition, 5, "in"); - Prep_8 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Preposition, 8, "with"); + Prep_5 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Preposition, 5, "in"); + Prep_8 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Preposition, 8, "with"); - PP_5 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Prepositional_Phrase, 5, ""); - PP_8 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Prepositional_Phrase, 8, ""); + PP_5 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Prepositional_Phrase, 5, ""); + PP_8 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Prepositional_Phrase, 8, ""); - Verb_2 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Verb, 2, "saw"); + Verb_2 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Verb, 2, "saw"); - VP_2 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Verb_Phrase, 2, ""); + VP_2 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Verb_Phrase, 2, ""); - Sen_1 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Sentence, 1, ""); + Sen_1 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Sentence, 1, ""); -- This should be set up to be identical to the example parse in the paper @@ -62,13 +62,13 @@ package body Rat_Tests.Parse_Graphs is -- A simple subgraph of the above, slid to start at position 1, -- covering the phrase "in the park". - Prep_1 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Preposition, 1, "in"); - Det_2 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Determiner, 2, "the"); - Noun_3 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Noun, 3, "park"); + Prep_1 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Preposition, 1, "in"); + Det_2 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Determiner, 2, "the"); + Noun_3 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Noun, 3, "park"); - NP_2 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Noun_Phrase, 2, ""); + NP_2 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Noun_Phrase, 2, ""); - PP_1 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Prepositional_Phrase, 1, ""); + PP_1 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Prepositional_Phrase, 1, ""); Slide_Graph : Graphs.Parse_Graph; @@ -76,13 +76,13 @@ package body Rat_Tests.Parse_Graphs is -- A slid version of Small_Graph, covering the same "saw a man" phrase. - Verb_1 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Verb, 1, "saw"); - Det_2a : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Determiner, 2, "a"); - Noun_3a : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Noun, 3, "man"); + Verb_1 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Verb, 1, "saw"); + Det_2a : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Determiner, 2, "a"); + Noun_3a : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Noun, 3, "man"); -- NP_2 as above is fine - VP_1 : My_Traits.Tokens.Token := My_Traits.Tokens.Create (Verb_Phrase, 1, ""); + VP_1 : My_Traits.Tokens.Token_Type := My_Traits.Tokens.Create (Verb_Phrase, 1, ""); Slid_Small_Graph : Graphs.Parse_Graph; @@ -299,8 +299,8 @@ package body Rat_Tests.Parse_Graphs is function Is_Sorted_Check return Test_Result is - Test_1 : Graphs.Finish_Array := (1, 3, 5, 6, 7, 11); - Test_2 : Graphs.Finish_Array := (3, 5, 2, 8, 4, 10); + Test_1 : My_Traits.Tokens.Finish_Array := (1, 3, 5, 6, 7, 11); + Test_2 : My_Traits.Tokens.Finish_Array := (3, 5, 2, 8, 4, 10); begin if not Graphs.Is_Sorted (Test_1) or Graphs.Is_Sorted (Test_2) @@ -314,8 +314,8 @@ package body Rat_Tests.Parse_Graphs is function No_Duplicates_Check return Test_Result is - Test_1 : Graphs.Finish_Array := (1, 2, 3, 4, 8, 10, 5); - Test_2 : Graphs.Finish_Array := (5, 6, 8, 2, 4, 5, 5, 8); + Test_1 : My_Traits.Tokens.Finish_Array := (1, 2, 3, 4, 8, 10, 5); + Test_2 : My_Traits.Tokens.Finish_Array := (5, 6, 8, 2, 4, 5, 5, 8); begin if not Graphs.No_Duplicates (Test_1) or Graphs.No_Duplicates (Test_2) @@ -371,8 +371,8 @@ package body Rat_Tests.Parse_Graphs is function Prune_Check return Test_Result is - use type My_Traits.Tokens.Token; - use type Graphs.Finished_Token_Array; + use type My_Traits.Tokens.Token_Type; + use type My_Traits.Tokens.Finished_Token_Array; Paper : Graphs.Parse_Graph := Paper_Graph; begin if not Paper.Contains (Prep_5) then @@ -465,7 +465,7 @@ package body Rat_Tests.Parse_Graphs is function Root_Elements_Check return Test_Result is - use type Graphs.Finished_Token_Array; + use type My_Traits.Tokens.Finished_Token_Array; begin if Paper_Graph.Root_Elements /= ((Sen_1, 4), (Sen_1, 7), (Sen_1, 10)) then return Fail; @@ -480,7 +480,7 @@ package body Rat_Tests.Parse_Graphs is function Finish_List_Check return Test_Result is - use type Graphs.Finish_Array; + use type My_Traits.Tokens.Finish_Array; begin if Paper_Graph.Finish_List (Sen_1) /= (4, 7, 10) or Paper_Graph.Finish_List (NP_3) /= (4, 7, 10) or @@ -528,7 +528,7 @@ package body Rat_Tests.Parse_Graphs is return Test_Result is use type Ada.Containers.Count_Type; - use type Graphs.Finished_Token_Array; + use type My_Traits.Tokens.Finished_Token_Array; Paper : Graphs.Token_Group_Array := Paper_Graph.Subgroups ((NP_3, 10)); Extra : Graphs.Token_Group_Array := Paper_Graph.Subgroups ((NP_1, 1)); begin @@ -629,7 +629,7 @@ package body Rat_Tests.Parse_Graphs is function Element_Check return Test_Result is - use type Graphs.Finished_Token; + use type My_Traits.Tokens.Finished_Token_Type; Paper : Graphs.Token_Group_Array := Paper_Graph.Subgroups ((NP_3, 10)); begin if Graphs.Element (Paper (1), 1) /= (NP_3, 4) or @@ -644,7 +644,7 @@ package body Rat_Tests.Parse_Graphs is function Elements_Check return Test_Result is - use type Graphs.Finished_Token_Array; + use type My_Traits.Tokens.Finished_Token_Array; Paper : Graphs.Token_Group_Array := Paper_Graph.Subgroups ((NP_3, 10)); begin if Graphs.Elements (Paper (1)) /= ((NP_3, 4), (PP_5, 10)) or @@ -659,7 +659,7 @@ package body Rat_Tests.Parse_Graphs is function Parent_Check return Test_Result is - use type Graphs.Finished_Token; + use type My_Traits.Tokens.Finished_Token_Type; Paper_1 : Graphs.Token_Group_Array := Paper_Graph.Subgroups ((Sen_1, 4)); Paper_2 : Graphs.Token_Group_Array := Paper_Graph.Subgroups ((NP_3, 10)); Paper_3 : Graphs.Token_Group_Array := Paper_Graph.Subgroups ((NP_1, 1)); @@ -680,7 +680,7 @@ package body Rat_Tests.Parse_Graphs is function Finish_Check return Test_Result is - use type Graphs.Finish_Type; + use type My_Traits.Tokens.Finish_Type; Paper_1 : Graphs.Token_Group_Array := Paper_Graph.Subgroups ((Sen_1, 4)); Paper_2 : Graphs.Token_Group_Array := Paper_Graph.Subgroups ((NP_3, 10)); Paper_3 : Graphs.Token_Group_Array := Paper_Graph.Subgroups ((NP_1, 1)); @@ -731,19 +731,19 @@ package body Rat_Tests.Parse_Graphs is function Ambiguities_Check return Test_Result is - use type Graphs.Finished_Token_Array; + use type My_Traits.Tokens.Finished_Token_Array; Paper_Root, Small_Root, Slide_Root : Boolean; - Paper_Result : Graphs.Finished_Token_Array := + Paper_Result : My_Traits.Tokens.Finished_Token_Array := Paper_Graph.Ambiguities (Paper_Root); - Small_Result : Graphs.Finished_Token_Array := + Small_Result : My_Traits.Tokens.Finished_Token_Array := Small_Graph.Ambiguities (Small_Root); - Slide_Result : Graphs.Finished_Token_Array := + Slide_Result : My_Traits.Tokens.Finished_Token_Array := Slide_Graph.Ambiguities (Slide_Root); -- Result is expected to be sorted - Expected_Paper_Result : Graphs.Finished_Token_Array := + Expected_Paper_Result : My_Traits.Tokens.Finished_Token_Array := ((Sen_1, 7), (Sen_1, 10), (NP_3, 10)); begin if Paper_Result /= Expected_Paper_Result or @@ -795,7 +795,7 @@ begin -- Constructing the various test graphs Paper_Graph.Connect ((NP_1, 1), - (1 => Graphs.Finished_Token'(Noun_1, 1))); + (1 => My_Traits.Tokens.Finished_Token_Type'(Noun_1, 1))); Paper_Graph.Connect ((NP_3, 4), ((Det_3, 3), (Noun_4, 4))); Paper_Graph.Connect ((NP_3, 7), diff --git a/test/rat_tests-tokens.adb b/test/rat_tests-tokens.adb index 74a3c0a..95fe5ff 100644 --- a/test/rat_tests-tokens.adb +++ b/test/rat_tests-tokens.adb @@ -17,10 +17,10 @@ package body Rat_Tests.Tokens is function Adjust_Check return Test_Result is - A : My_Tokens.Token; + A : My_Tokens.Token_Type; begin declare - B : My_Tokens.Token := My_Tokens.Create (One, 1, "abc"); + B : My_Tokens.Token_Type := My_Tokens.Create (One, 1, "abc"); begin A := B; end; @@ -37,9 +37,9 @@ package body Rat_Tests.Tokens is function Equals_Check return Test_Result is - use type My_Tokens.Token; - A : My_Tokens.Token := My_Tokens.Create (One, 1, "abc"); - B : My_Tokens.Token := My_Tokens.Create (One, 1, "abc"); + use type My_Tokens.Token_Type; + A : My_Tokens.Token_Type := My_Tokens.Create (One, 1, "abc"); + B : My_Tokens.Token_Type := My_Tokens.Create (One, 1, "abc"); begin if A /= B then return Fail; @@ -54,7 +54,7 @@ package body Rat_Tests.Tokens is function Store_Check return Test_Result is - T : My_Tokens.Token := My_Tokens.Create (One, 1, "abc"); + T : My_Tokens.Token_Type := My_Tokens.Create (One, 1, "abc"); begin if My_Tokens.Label (T) /= One or else My_Tokens.Start (T) /= 1 or else diff --git a/test/test_main.adb b/test/test_main.adb index af59fdf..1edf4e6 100644 --- a/test/test_main.adb +++ b/test/test_main.adb @@ -44,7 +44,7 @@ procedure Test_Main is package My_Tokens is new Packrat.Tokens (My_Labels, Character, String); Err : Packrat.Errors.Error_Message := Packrat.Errors.Encode ("A", 1); - Tok : My_Tokens.Token := My_Tokens.Create (A, 1, "abc"); + Tok : My_Tokens.Token_Type := My_Tokens.Create (A, 1, "abc"); begin |