Well your examples remind me that i proposed cut operator some time ago
so to match quoted strings you write
'"' ('"' cut | .)*
On Mon, Aug 08, 2011 at 09:40:34PM -0700, Joe Strout wrote:
> On 8/8/11 6:11 PM, Francisco Mota wrote:
>
> >You are correct in assessing that .+ and .* expressions will probably
> >never be useful. PEGs are completely different from regular expressions
> >-- don't be misled by the syntactic similarities.
>
> Fair enough.
>
> >To answer your first question, "Why should the repetition operators be
> >greedy by default?"
> >
> >Because there is no backtracking*. So X* would always match the empty
> >string, and X+ would always match X.
>
> Ah. Without backtracking, that would be true. And as you point out:
>
> >In PEGs, there is a property of any parsing expression, and it is
> >this: a parsing expression has only one possible match for any given
> >string. This property enables packrat parsing. If you add backtracking*,
> >you throw this property away.
>
> Doh. So we lose the linear parse time guarantee. It still might be
> worth it, for string searching (as opposed to language parsing), but
> I see now that the result would not be PEG in important ways.
Not really. For example if you dont use recursion you still have linear time.
>
> Thanks,
> - Joe
>
> _______________________________________________
> PEG mailing list
> [email protected]
> https://lists.csail.mit.edu/mailman/listinfo/peg
--
Quantum dynamics are affecting the transistors
_______________________________________________
PEG mailing list
[email protected]
https://lists.csail.mit.edu/mailman/listinfo/peg