- or download this
my $grammar = <<'END_OF_GRAMMAR';
...
id: m{ \d+ }xms
END_OF_GRAMMAR
- or download this
my $text = "employee Joe 10";
...
defined $parser->employee_info($text)
or die "Text doesn't match";
- or download this
my $grammar = <<'END_OF_GRAMMAR';
...
END_OF_GRAMMAR
- or download this
use strict;
...
employee
Joe
10
- or download this
myrule: brace_clause
brace_clause: '{' word '}'
word: m{ [a-z]+ }xms
- or download this
myrule: brace_clause
...
{ print "$_\n" for @item; }
word: m{ [a-z]+ }xms
- or download this
brace_clause #the rule name
{ #the match for '{'
hello #the match for word
} #the match for '}'
- or download this
myrule: brace_clause
{ print "$_\n" for @item; }
...
brace_clause: '{' word '}'
word: m{ [a-z]+ }xms
- or download this
myrule
{ hello }
- or download this
myrule
}
- or download this
myrule: brace_clause
{ print "$_\n" for @item; }
...
myrule
{ hello }
- or download this
my $grammar = <<'END_OF_GRAMMAR';
...
…
END_OF_GRAMMAR
- or download this
my $grammar = <<'END_OF_GRAMMAR';
...
];
- or download this
use strict;
use warnings;
...
];
- or download this
employee_info: 'employee'
name
...
name: m{ \S+ }xms
id: m{ \d+ }xms
- or download this
employee_info: 'employee'
name
{ say $item[1]; }
id
{ say $item[3] } #print match for id
- or download this
my $grammar = <<'END_OF_GRAMMAR';
...
}
...
- or download this
my $grammar = <<'END_OF_GRAMMAR';
...
...
- or download this
Unknown starting rule (Parse::RecDescent::namespace000001::startrule)
+called
at 3.pl line 76.
- or download this
defined $parser->another_rule($text)
or die "Text doesn't match";
- or download this
word_list: word(s /,/)
word : m{ [^,]+ }xms
- or download this
word_list: word(s /,/)
...
word : m{ [^,]+ }xms
- or download this
$VAR1 = [
'word_list',
...
'mars'
]
];
- or download this
my $grammar = <<'END_OF_GRAMMAR';
...
]
];
- or download this
some_rule_name: 'hello' word(s /,/)
word : m{ [^,]+ }xms
- or download this
$item{'word(s /,/)'}
- or download this
$item[-1]
- or download this
$VAR1 = [
...
]
];
- or download this
cmd_choices: 'commands->' quoted_string(s)
{
...
--output:--
go to
stop
- or download this
use strict;
use warnings;
...
'phone_numbers' => '10'
};
- or download this
my $text = <<'END_OF_TEXT';
{{ hello }}
...
lbrace: / [{] /xms
END_OF_GRAMMAR
- or download this
my $text = <<'END_OF_TEXT';
...
END_OF_GRAMMAR