my $grammar = <<'_EOGRAMMAR_'; QUOTED_STRING : /"/ quoted_char(s?) /"/ { " " . join "", @{$item[3]} # leading space flags a string } quoted_char : /[^\\"]+/ { $item[1] } | /\\n/ { "\n" } { $item[1] } | /\\"/ { "\"" } { $item[1] } portDefinition: "dbSetCellPortTypes" QUOTED_STRING QUOTED_STRING portLists QUOTED_STRING { return { str1 => $item[2], str2 => $item[3], portLists => $item[4], trailer => $item[5] } } portLists: "'" "(" list(s?) ")" { $item[2] } list: "(" QUOTED_STRING(s) ")" { $item[2] } _EOGRAMMAR_