2011/6/6 Brendan Eich <[email protected]>:
> Escapes are a pain, due to the double-backslash burden.
Yep. To fit into this kind of library, you could use a quasi syntax like
regexp`...`.ignoreSpaces().nonCapturingByDefault().build()
Not as pithy as flags, but extensible via
regexp.prototype.nonCapturingByDefault = function (parseTree) { ...
return parseTree; };
and you can make the build() bit optional in a lot of cases by
overriding toString, since
String.prototype.replace and friends do implicit value -> string ->
RegExp unless value is a RegExp.
> We really want quasis for this kind of extensibility. Quasis solve the
> multiline problem too (I hope... :-).
Off-topic, quasis do solve the multiline problem as written.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss