Skip to content

Commit b9efb74

Browse files
committed
make a working example
1 parent de581cb commit b9efb74

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

doc/Language/variables.pod

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -941,12 +941,26 @@ match and so usually contains objects of type L<Match>.
941941
say $/.Str; # abc
942942
943943
The C<Grammar.parse> method also sets the caller's C<$/> to the resulting
944-
L<Match> object.
944+
L<Match> object. For the following code:
945945
946-
use XML;
947-
XML.parse(slurp "filename.xml")
946+
use XML::Grammar; # panda install XML
947+
XML.Grammar.parse("<p>some text</p>");
948948
say $/;
949949
950+
the output is:
951+
952+
「<p>some text</p>」
953+
root => 「<p>some text</p>」
954+
name => 「p」
955+
child => 「some text」
956+
text => 「some text」
957+
textnode => 「some text」
958+
element => 「<p>some text</p>」
959+
name => 「p」
960+
child => 「some text」
961+
text => 「some text」
962+
textnode => 「some text」
963+
950964
=head4 X«Positional Attributes|variable,$0;variable,$1;variable,@()»
951965
952966
C<$/> can have positional attributes if the L<Regex|regex> had

0 commit comments

Comments
 (0)