diff options
-rw-r--r-- | packrat_parser_lib_notes.txt | 8 | ||||
-rw-r--r-- | src/packrat-lexer-combinators.adb | 16 | ||||
-rw-r--r-- | src/packrat-lexer-combinators.ads | 10 | ||||
-rw-r--r-- | test/ratnest-tests.adb | 116 | ||||
-rw-r--r-- | test/ratnest-tests.ads | 44 | ||||
-rw-r--r-- | test/test_main.adb | 4 |
6 files changed, 180 insertions, 18 deletions
diff --git a/packrat_parser_lib_notes.txt b/packrat_parser_lib_notes.txt index 40b2820..8c6117c 100644 --- a/packrat_parser_lib_notes.txt +++ b/packrat_parser_lib_notes.txt @@ -221,10 +221,10 @@ Take Take_While Take_Until -Start_Of_Line -End_Of_Line -Start_Of_Input -End_Of_Input +Line_Start +Line_End +Input_Start +Input_End diff --git a/src/packrat-lexer-combinators.adb b/src/packrat-lexer-combinators.adb index ef53bb1..1d51262 100644 --- a/src/packrat-lexer-combinators.adb +++ b/src/packrat-lexer-combinators.adb @@ -141,7 +141,7 @@ package body Packrat.Lexer.Combinators is - function Start_Of_Line + function Line_Start (Input : in Element_Array; Start : in Positive; Length : out Natural; @@ -149,10 +149,10 @@ package body Packrat.Lexer.Combinators is return Result is begin return Failure; - end Start_Of_Line; + end Line_Start; - function End_Of_Line + function Line_End (Input : in Element_Array; Start : in Positive; Length : out Natural; @@ -160,10 +160,10 @@ package body Packrat.Lexer.Combinators is return Result is begin return Failure; - end End_Of_Line; + end Line_End; - function Start_Of_Input + function Input_Start (Input : in Element_Array; Start : in Positive; Length : out Natural; @@ -171,10 +171,10 @@ package body Packrat.Lexer.Combinators is return Result is begin return Failure; - end Start_Of_Input; + end Input_Start; - function End_Of_Input + function Input_End (Input : in Element_Array; Start : in Positive; Length : out Natural; @@ -182,7 +182,7 @@ package body Packrat.Lexer.Combinators is return Result is begin return Failure; - end End_Of_Input; + end Input_End; end Packrat.Lexer.Combinators; diff --git a/src/packrat-lexer-combinators.ads b/src/packrat-lexer-combinators.ads index 08bdbec..b346b0a 100644 --- a/src/packrat-lexer-combinators.ads +++ b/src/packrat-lexer-combinators.ads @@ -155,7 +155,7 @@ package Packrat.Lexer.Combinators is generic EOL_Item : in Element; - function Start_Of_Line + function Line_Start (Input : in Element_Array; Start : in Positive; Length : out Natural; @@ -164,21 +164,23 @@ package Packrat.Lexer.Combinators is generic EOL_Item : in Element; - function End_Of_Line + function Line_End (Input : in Element_Array; Start : in Positive; Length : out Natural; Value : out Element_Array) return Result; - function Start_Of_Input + function Input_Start (Input : in Element_Array; Start : in Positive; Length : out Natural; Value : out Element_Array) return Result; - function End_Of_Input + generic + EOF_Item : in Element; + function Input_End (Input : in Element_Array; Start : in Positive; Length : out Natural; diff --git a/test/ratnest-tests.adb b/test/ratnest-tests.adb index 1f0950d..72023d0 100644 --- a/test/ratnest-tests.adb +++ b/test/ratnest-tests.adb @@ -4,6 +4,7 @@ with Ada.Characters.Latin_1, Ada.Strings.Maps, + Packrat.Lexer.Combinators, Packrat.Util; @@ -204,6 +205,121 @@ package body Ratnest.Tests is + function Lex_Sequence_Check + return Test_Result is + begin + return Failure; + end Lex_Sequence_Check; + + + function Lex_Count_Check + return Test_Result is + begin + return Failure; + end Lex_Count_Check; + + + function Lex_Many_Check + return Test_Result is + begin + return Failure; + end Lex_Many_Check; + + + function Lex_Many_Until_Check + return Test_Result is + begin + return Failure; + end Lex_Many_Until_Check; + + + function Lex_Satisfy_Check + return Test_Result is + begin + return Failure; + end Lex_Satisfy_Check; + + + function Lex_Satisfy_With_Check + return Test_Result is + begin + return Failure; + end Lex_Satisfy_With_Check; + + + function Lex_Match_Check + return Test_Result is + begin + return Failure; + end Lex_Match_Check; + + + function Lex_Match_With_Check + return Test_Result is + begin + return Failure; + end Lex_Match_With_Check; + + + function Lex_Multimatch_Check + return Test_Result is + begin + return Failure; + end Lex_Multimatch_Check; + + + function Lex_Take_Check + return Test_Result is + begin + return Failure; + end Lex_Take_Check; + + + function Lex_Take_While_Check + return Test_Result is + begin + return Failure; + end Lex_Take_While_Check; + + + function Lex_Take_Until_Check + return Test_Result is + begin + return Failure; + end Lex_Take_Until_Check; + + + function Line_Start_Check + return Test_Result is + begin + return Failure; + end Line_Start_Check; + + + function Line_End_Check + return Test_Result is + begin + return Failure; + end Line_End_Check; + + + function Input_Start_Check + return Test_Result is + begin + return Failure; + end Input_Start_Check; + + + function Input_End_Check + return Test_Result is + begin + return Failure; + end Input_End_Check; + + + + + function In_Set_Check return Test_Result is diff --git a/test/ratnest-tests.ads b/test/ratnest-tests.ads index 3c83a23..e9ea347 100644 --- a/test/ratnest-tests.ads +++ b/test/ratnest-tests.ads @@ -29,8 +29,48 @@ package Ratnest.Tests is function Token_Store_Check return Test_Result; Token_Tests : Test_Array := - ((+"Token Adjust", Token_Adjust_Check'Access), - (+"Token Storage", Token_Store_Check'Access)); + ((+"Adjust", Token_Adjust_Check'Access), + (+"Storage", Token_Store_Check'Access)); + + + + + function Lex_Sequence_Check return Test_Result; + function Lex_Count_Check return Test_Result; + function Lex_Many_Check return Test_Result; + function Lex_Many_Until_Check return Test_Result; + + function Lex_Satisfy_Check return Test_Result; + function Lex_Satisfy_With_Check return Test_Result; + function Lex_Match_Check return Test_Result; + function Lex_Match_With_Check return Test_Result; + function Lex_Multimatch_Check return Test_Result; + function Lex_Take_Check return Test_Result; + function Lex_Take_While_Check return Test_Result; + function Lex_Take_Until_Check return Test_Result; + + function Line_Start_Check return Test_Result; + function Line_End_Check return Test_Result; + function Input_Start_Check return Test_Result; + function Input_End_Check return Test_Result; + + Lexer_Combinator_Tests : Test_Array := + ((+"Sequence", Lex_Sequence_Check'Access), + (+"Count", Lex_Count_Check'Access), + (+"Many", Lex_Many_Check'Access), + (+"Many_Until", Lex_Many_Until_Check'Access), + (+"Satisfy", Lex_Satisfy_Check'Access), + (+"Satisfy With", Lex_Satisfy_With_Check'Access), + (+"Match", Lex_Match_Check'Access), + (+"Match With", Lex_Match_With_Check'Access), + (+"Multimatch", Lex_Multimatch_Check'Access), + (+"Take", Lex_Take_Check'Access), + (+"Take While", Lex_Take_While_Check'Access), + (+"Take Until", Lex_Take_Until_Check'Access), + (+"Line Start", Line_Start_Check'Access), + (+"Line End", Line_End_Check'Access), + (+"Input Start", Input_Start_Check'Access), + (+"Input_End", Input_End_Check'Access)); diff --git a/test/test_main.adb b/test/test_main.adb index a2682f4..d181b3e 100644 --- a/test/test_main.adb +++ b/test/test_main.adb @@ -34,6 +34,10 @@ begin Put (Tok.Debug_String); New_Line; + Put_Line ("Running tests for Packrat.Lexer.Combinators..."); + Run_Tests (Lexer_Combinator_Tests); + New_Line; + Put_Line ("Running tests for Packrat.Util..."); Put_Line ("Testing set predicates..."); Run_Tests (Set_Predicate_Tests); |