in reply to Parsing Statements with Quotes in Parse::RecDescent

As for the string literal,
{ use strict; use warnings; sub dequote_single { for (my $s = @_ ? $_[0] : $_) { s/^'//; s/'$//; s{\\([\\'])}{$1}gs; return STR_LIT => $_; } } sub dequote_double { for (my $s = @_ ? $_[0] : $_) { ... if (@pieces) { return $pieces[0]; } else { return CONCAT => \@pieces; } } } } STR_LIT: /'(?:\\.|[^\\'])*'/s { [ dequote_single($item[1]) ] } | /"(?:...)*'/s { [ dequote_double($item[1]) ] }

(assuming Perl-like literals)