C
ccm news
Hi,
( using parse::recdescent 1.94 )
I want to parse a string and search for a word (and exactly this word). I
use the following grammar:
my $grammar = <<'_EOGRAMMAR_';
any : /[a-zA-Z0-9\d\., +-]+/
cmd_unknown : any(s)
{ main::cmd_unknown(); $return = 1;}
cmd_doit : /doit/
{ main::cmd_doit(); $return = 1; }
cmd : cmd_doit
| cmd_unknown
startrule: <skip: qr/[ \t]*/> cmd
_EOGRAMMAR_
The input "doit\r\n" works and executes the cmd_doit. But using the string
"doitnow\r\n" as input it also executes the cmd_doit function.
I want something like:
cmd_doit : /^doit$/ # saying the sentence must begin and end with doit. but
this syntax doesnt work?!
Any suggestions?
Thanx for your time.
( using parse::recdescent 1.94 )
I want to parse a string and search for a word (and exactly this word). I
use the following grammar:
my $grammar = <<'_EOGRAMMAR_';
any : /[a-zA-Z0-9\d\., +-]+/
cmd_unknown : any(s)
{ main::cmd_unknown(); $return = 1;}
cmd_doit : /doit/
{ main::cmd_doit(); $return = 1; }
cmd : cmd_doit
| cmd_unknown
startrule: <skip: qr/[ \t]*/> cmd
_EOGRAMMAR_
The input "doit\r\n" works and executes the cmd_doit. But using the string
"doitnow\r\n" as input it also executes the cmd_doit function.
I want something like:
cmd_doit : /^doit$/ # saying the sentence must begin and end with doit. but
this syntax doesnt work?!
Any suggestions?
Thanx for your time.