summaryrefslogtreecommitdiff
path: root/example/sentence.adb
diff options
context:
space:
mode:
Diffstat (limited to 'example/sentence.adb')
-rw-r--r--example/sentence.adb41
1 files changed, 9 insertions, 32 deletions
diff --git a/example/sentence.adb b/example/sentence.adb
index 7e9114b..c8493cb 100644
--- a/example/sentence.adb
+++ b/example/sentence.adb
@@ -3,8 +3,6 @@
with
Ada.Text_IO,
- Ada.Characters.Latin_1,
- Ada.Strings.Maps,
Packrat.Text.Standard,
Packrat.Utilities;
@@ -16,16 +14,8 @@ use
procedure Sentence is
- package Latin renames Ada.Characters.Latin_1;
-
-
-
-
Input : String := "i saw a man in the park with a bat";
-
-
-
type Lexer_Labels is (Word, Whitespace);
type Parser_Labels is (S, NP, PP, VP, Det, Noun, Verb, Prep);
@@ -47,28 +37,15 @@ procedure Sentence is
- generic
- Match : in String;
- function Is_Value
- (Element : in My_Rat.Lexer_Traits.Tokens.Token)
- return Boolean;
-
- function Is_Value
- (Element : in My_Rat.Lexer_Traits.Tokens.Token)
- return Boolean is
- begin
- return My_Rat.Lexer_Traits.Tokens.Value (Element) = Match;
- end Is_Value;
-
- function Is_I is new Is_Value ("i");
- function Is_Saw is new Is_Value ("saw");
- function Is_A is new Is_Value ("a");
- function Is_Man is new Is_Value ("man");
- function Is_In is new Is_Value ("in");
- function Is_The is new Is_Value ("the");
- function Is_Park is new Is_Value ("park");
- function Is_With is new Is_Value ("with");
- function Is_Bat is new Is_Value ("bat");
+ function Is_I is new My_Rat.Lexer_Traits.Tokens.Is_Value ("i");
+ function Is_Saw is new My_Rat.Lexer_Traits.Tokens.Is_Value ("saw");
+ function Is_A is new My_Rat.Lexer_Traits.Tokens.Is_Value ("a");
+ function Is_Man is new My_Rat.Lexer_Traits.Tokens.Is_Value ("man");
+ function Is_In is new My_Rat.Lexer_Traits.Tokens.Is_Value ("in");
+ function Is_The is new My_Rat.Lexer_Traits.Tokens.Is_Value ("the");
+ function Is_Park is new My_Rat.Lexer_Traits.Tokens.Is_Value ("park");
+ function Is_With is new My_Rat.Lexer_Traits.Tokens.Is_Value ("with");
+ function Is_Bat is new My_Rat.Lexer_Traits.Tokens.Is_Value ("bat");
function Sat_In is new My_Rat.Parsers.Satisfy (Is_In);
function Sat_With is new My_Rat.Parsers.Satisfy (Is_With);