#177: [PATCH] ignore trailing spaces in action keys
----------------------+-----------------------------------------------------
Reporter: riffraff | Owner: pmichaud
Type: patch | Status: new
Priority: minor | Milestone: 0.9.0
Component: PGE | Version: trunk
Severity: low | Keywords: parsing pge action whitespace
Lang: | Patch: new
Platform: all |
----------------------+-----------------------------------------------------
While writing parsers with PGE I hit the following problem multiple times:
{{{
rule foo {
<bar> {*} #= key
<baz> {*} #= other
}
}}}
'key' is actually followed by whitespace, which causes subsequent
manipulations to fail miserably and it was a considerable waste of time
the first time and still relevant the second.
The attached patch adds an additional step to the parsing of Perl6Regex to
strip trailing whitespace.
This fixes the common problem (trailing non-space whitespace is much less
likely to happen), but IMO it would be better to do an actual 'trim' of
the string, possibly importing perl6's multimethod in String/Util.pir, in
the end most HLL have/need a trim function.
Two tests are included, everything still passes in parrot 35590
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/177>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets