I'm implementing a parser using MARPA::R2.
I have a G1 rule like :
PARAM ::= STRING | REGEX_STRING
and L0 rule like:
STRING ~ [^ \/\(\),&:\"~]+ -----> works fine
REGEX_STRING ~ [\"([^:]*?)\"] -----> doesn't work
Using REGEX_STRING, I'm trying to parse strings enclosed in double quotes, but something is wrong with the regex. Also, I want to remove the double quotes and only keep the content between quotes.
So, if i give input using below code :
my $recce = Marpa::R2::Scanless::R->new({grammar => $grammar});
my $input = "\"foo\""; --> here, it should parse "foo" and give me foo.
print "Trying to parse:\n$input\n\n";
$recce->read(\$input);
my $value_ref = ${$recce->value};
print "Output:\n".Dumper($value_ref);
Other examples : "bar123", "foo(123)" etc.