Look-behind proposal
Allen Wirfs-Brock
allen at wirfs-brock.com
Mon May 18 22:08:13 UTC 2015
On May 18, 2015, at 2:20 PM, Jason Orendorff wrote:
> On Mon, May 18, 2015 at 8:50 AM, Nozomu Katō <noz.ka at akenotsuki.com> wrote:
>> I submit a proposal for adding the look-behind assertions to RegExp.
>
> Fantastic! I'm not a TC39 member but I've been hoping this would
> happen for some time.
>
> I have often thought that the major obstacle was that no one has done
> this work. I hope I was not wrong!
You're exactly right, we've been waiting for somebody (anybody) to create a technically complete proposal
>
>> It is a Syntax Error if Disjunction contains Quantifier ::
>> QuantifierPrefix except QuantifierPrefix :: { DecimalDigits }.
>
> Backreferences must be ruled out, too.
>
>> 1. Let n be the exact number of the sequence of code points which
>> Disjunction matches [NOTE].
>
> I don't think a NOTE is strong enough for spec purposes, so you can
> improve the proposal by adding a "Static Semantics:" section that
> formally specifies this.
>
> The spec uses attribute grammars for dozens of things like this, where
> some piece of information has to be determined from the parse tree.
> See "Static Semantics: ElisionWidth" for a simple example.
>
The proposal also needs to follow the conventions and terminology of the ES6 RegExp spec. In particular, the RegExp pattern matching algorithms use the term "character" with a specific meaning rather than using "code unit" or "code point" (see http://people.mozilla.org/~jorendorff/es6-draft.html#sec-pattern-semantics ). It does this so that the same algorithms can be use to describe the matching semantic of both "normal" and "unicode" patterns. Any extensions also will need t work with both kinds of patterns.
Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150518/ff8e4edc/attachment.html>
More information about the es-discuss
mailing list