[DGD]Parse String

Felix A. Croes felix at dworkin.nl
Thu Jun 7 13:26:44 CEST 2001


"S. Foley" <s_d_foley at hotmail.com> wrote:

>[...]
> Now from what I understand '?' is frequently used in regular expressions
> to indicate 0 or 1 occurences of what precedes it.  Is that what it is
> being used for here?  If so, are there any other 'operators' like this
> that are frequently used in regular expressions that are useable in
> token rules that are undocumented (assuming I have an up to date help
> file for parse_string)?

I had failed to document '?'.  This will be fixed in the forthcoming patch.


>[...]
> I have one last theoretical question.  I've been told that for every
> regular expression it is possible to write an inverse regular expression.  
> That is to say, if I have a regular expression A, I can
> write a regular expression B such that everything that A matches, B will
> not match, and everything A does not match, B will match.  How difficult
> would it be to implement an 'operator' (like * or +) for token rules
> that could be used to mean any string that does not match the regular
> expression that precedes it?  Would it be possible to write a front
> end to parse_string using parse_string itself to generate B from A?

It is possible to do so, and this would be a legitimate use of
parse_string().

When I wrote the string parser, I envisioned a whole range of possible
front ends in LPC to make it more useful for the non-expert user.  I
perhaps underestimated the difficulty that even an expert may have with
some of its features, though.

Regards,
Dworkin

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list