@@ -43,17 +43,17 @@ Grammars are a special kind of class. You declare and define a grammar exactly
43
43
as you would any other class, except that you use the I < grammar > keyword instead
44
44
of I < class > .
45
45
46
- = begin code :skip-test
47
- grammar G { ... }
48
- = end code
46
+ = begin code :skip-test
47
+ grammar G { ... }
48
+ = end code
49
49
50
- Grammars are made up of methods that define a regex, a token, or a rule.
51
- These are all varieties of different types of match methods. Once you have a
52
- grammar defined, you call it and pass in a string for parsing.
50
+ As such classes, grammars are made up of methods that define a regex, a token,
51
+ or a rule. These are all varieties of different types of match methods. Once you
52
+ have a grammar defined, you call it and pass in a string for parsing.
53
53
54
- = begin code :preamble<grammar G{};my $string;>
55
- my $matchObject = G.parse($string);
56
- = end code
54
+ = begin code :preamble<grammar G{};my $string;>
55
+ my $matchObject = G.parse($string);
56
+ = end code
57
57
58
58
Now, you may be wondering, if I have all these regexes defined that just return
59
59
their results, how does that help with parsing strings that may be ahead
@@ -122,7 +122,6 @@ C<'clever_text_keyword'> B<must> be the first thing in the string, or
122
122
the grammar parse will fail and we'll get an empty match. This is great for
123
123
recognizing a malformed string that should be discarded.
124
124
125
-
126
125
= head1 Learning by example - a REST contrivance
127
126
128
127
Let's suppose we'd like to parse a URI into the component parts that make up a
0 commit comments