| Joachim Durchholz 2007-05-16, 4:13 am |
| Alex Rubinsteyn schrieb:
> Well, the skip parser isn't optional. It's meant to parse elements
> which are structurually necessary but carry no information you would
> want to hang to...such as the angled brackets of HTML or lisp parens.
Ah, now *that*s an entirely different box of strings.
I was thinking you were trying to handle stuff like optional else parts.
The result of such a "syntactic element removal parser" would be
irrelevant, so it should be either void or (if that's impossible for
typing reasons) a constant of your choosing.
Whatever you do, the calling parser should not expect the skip parser to
return a value. If your framework does not properly handle that case,
you probably have to rework it in this area.
One implicit parameter and result of any parser is the read position in
the input string. If you include that in the parse result (possibly just
as a mental exercize), this may help you see the overall structure better.
(Returning the ending position of a parse is a good idea anyway. You
need it for all kinds of activity beyond parsing, such as generating
error messages or beautifying code.)
Regards,
Jo
|