1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-26 20:28:49 +08:00

Better regular expression syntax checking

And a limitation elaboration
This commit is contained in:
Robert Krimen
2012-10-12 18:55:41 -07:00
parent b6f8642fe2
commit 7dfbf6ab13
7 changed files with 83 additions and 9 deletions

10
otto.go
View File

@@ -86,9 +86,17 @@ Caveat Emptor
* For example, "use strict" will parse, but does nothing.
* Error reporting needs to be improved.
* Number.prototype.{toFixed,toExponential,toPrecision} are missing.
* Does not support the (?!) or (?=) regular expression syntax (because Go does not).
* Does not support the (?!) or (?=) regular expression syntax (because Go does not)
* Really, error reporting could use some improvement.
Regular Expression Syntax
Go translates JavaScript-style regular expressions into something that is regexp package compatible.
Unfortunately, JavaScript has positive and negative lookahead, which is not supported by Go's re2-like engine: https://code.google.com/p/re2/wiki/Syntax
A brief discussion of this limitation: "Regexp (?!re)" https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/7qgSDWPIh_E
*/
package otto