Look-behind proposal

Jason Orendorff jason.orendorff at gmail.com
Mon May 18 21:20:01 UTC 2015

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!

>  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.


More information about the es-discuss mailing list