N
Nisse Engström
Consider the following RegExp:
/[\1]/
ECMA-262 says:
<quote (with slight modification of non-ASCII character)>
15.10.2.11 DecimalEscape
The production DecimalEscape :: DecimalIntegerLiteral
[lookahead != DecimalDigit] evaluates as follows.
1. Let i be the MV of DecimalIntegerLiteral.
2. If i is zero, return the EscapeValue consisting of a <NUL>
character (Unicode value 0000).
3. Return the EscapeValue consisting of the integer i.
...
15.10.2.19 ClassEscape
The production ClassEscape :: DecimalEscape evaluates as follows:
1. Evaluate DecimalEscape to obtain an EscapeValue E.
2. If E is not a character then throw a SyntaxError exception.
3. Let ch be E's character.
4. Return the one-element CharSet containing the character ch.
</>
a) The DecimalEscape returns a character for "\0", and an
integer for decimals 1-9, which means that the ClassEscape
should throw an exception at step 2. Is this reading
correct?
Opera does not throw an exception.
Test case:
<http://home.swipnet.se/sigsegv/opera/bugs/js-re-class-backref.html>
Result:
<http://home.swipnet.se/sigsegv/opera/bugs/js-re-class-backref.png>
b) Interestingly, the RegExp:
/[\101-\105]+/.exec ("ABCDefgh")
results in:
* "ABCD" in FireFox 1.0.3 (octal conversion), and
* "efgh" in Opera 8.01 (decimal conversion).
An exception ought be thrown as in a), oughtn't it?
--n
/[\1]/
ECMA-262 says:
<quote (with slight modification of non-ASCII character)>
15.10.2.11 DecimalEscape
The production DecimalEscape :: DecimalIntegerLiteral
[lookahead != DecimalDigit] evaluates as follows.
1. Let i be the MV of DecimalIntegerLiteral.
2. If i is zero, return the EscapeValue consisting of a <NUL>
character (Unicode value 0000).
3. Return the EscapeValue consisting of the integer i.
...
15.10.2.19 ClassEscape
The production ClassEscape :: DecimalEscape evaluates as follows:
1. Evaluate DecimalEscape to obtain an EscapeValue E.
2. If E is not a character then throw a SyntaxError exception.
3. Let ch be E's character.
4. Return the one-element CharSet containing the character ch.
</>
a) The DecimalEscape returns a character for "\0", and an
integer for decimals 1-9, which means that the ClassEscape
should throw an exception at step 2. Is this reading
correct?
Opera does not throw an exception.
Test case:
<http://home.swipnet.se/sigsegv/opera/bugs/js-re-class-backref.html>
Result:
<http://home.swipnet.se/sigsegv/opera/bugs/js-re-class-backref.png>
b) Interestingly, the RegExp:
/[\101-\105]+/.exec ("ABCDefgh")
results in:
* "ABCD" in FireFox 1.0.3 (octal conversion), and
* "efgh" in Opera 8.01 (decimal conversion).
An exception ought be thrown as in a), oughtn't it?
--n