issue 5
(jsstrip.py crashes on array regexes) commented on by vapier.adi
- aaaand you'll want , in there ... like in the previous example:
AposEntity : [/^"/,/^'/,/^moo/]
(this specific case is kind of dumb, but it's a reduction of a much bigger/uglier
array of regexes)
aaaand you'll want , in there ... like in the previous example:
AposEntity : [/^"/,/^'/,/^moo/]
(this specific case is kind of dumb, but it's a reduction of a much bigger/uglier
array of regexes)
Mar 20, 2009
issue 5
(jsstrip.py crashes on array regexes) commented on by vapier.adi
- will probably also want [ in there otherwise you crash on arrays as well:
AposEntity : [/^"/, ....more stuff....
if "=:([".find(s[i-j]) != -1:
will probably also want [ in there otherwise you crash on arrays as well:
AposEntity : [/^"/, ....more stuff....
if "=:([".find(s[i-j]) != -1:
Mar 20, 2009
issue 5
(jsstrip.py crashes on array regexes) reported by vapier.adi
- an array of regexes will cause a crash in jsstrip.py:
var foo =
{
AposEntity : /^"/i,
};
fix here is to accept : as a regex starter
debug("REGEXP: " +str(j)+" backup found '" + s[i-j] + "'")
if "=:(".find(s[i-j]) != -1:
an array of regexes will cause a crash in jsstrip.py:
var foo =
{
AposEntity : /^"/i,
};
fix here is to accept : as a regex starter
debug("REGEXP: " +str(j)+" backup found '" + s[i-j] + "'")
if "=:(".find(s[i-j]) != -1:
Mar 20, 2009
issue 4
(jsstrip.py doesnt handle whitespaced regexes) commented on by vapier.adi
- ah, simple fix ... the regex back scan only looks at spaces. simply need to use
whitespace.find() instead
# tricky. might be an RE
if ch == '/':
# rewind, skip white space
j= 1;
while whitespace.find(s[i-j]) != -1: j = j +1
ah, simple fix ... the regex back scan only looks at spaces. simply need to use
whitespace.find() instead
# tricky. might be an RE
if ch == '/':
# rewind, skip white space
j= 1;
while whitespace.find(s[i-j]) != -1: j = j +1
Mar 20, 2009
issue 4
(jsstrip.py doesnt handle whitespaced regexes) reported by vapier.adi
- simple test case:
text.replace(
/"/g, """);
Traceback (most recent call last):
File "/opt/jsstrip.py", line 320, in ?
main(sys.argv[1:])
File "/opt/jsstrip.py", line 311, in main
snew = strip(s, OPT_FIRST, OPT_WHITE, OPT_SINGLE, OPT_MULTI, OPT_DEBUG)
File "/opt/jsstrip.py", line 188, in strip
while s[i+j] != '\\' and s[i+j] != '"': j = j+1
IndexError: string index out of range
simple test case:
text.replace(
/"/g, """);
Traceback (most recent call last):
File "/opt/jsstrip.py", line 320, in ?
main(sys.argv[1:])
File "/opt/jsstrip.py", line 311, in main
snew = strip(s, OPT_FIRST, OPT_WHITE, OPT_SINGLE, OPT_MULTI, OPT_DEBUG)
File "/opt/jsstrip.py", line 188, in strip
while s[i+j] != '\\' and s[i+j] != '"': j = j+1
IndexError: string index out of range