Patch from Raphael Speyer git-svn-id: svn://10.0.0.236/trunk@258288 18797224-902f-48f8-a5cc-f745e15eee43
36 lines
924 B
Plaintext
36 lines
924 B
Plaintext
js> var controlChars = [
|
|
> 0x200C, 0x200D, 0x200E, 0x200F,
|
|
> 0x202A, 0x202B, 0x202C, 0x202D, 0x202E,
|
|
> 0x00AD,
|
|
> 0x2061, 0x2062, 0x2063, 0x2064,
|
|
> 0x206A, 0x206B, 0x206C, 0x206D, 0x206E, 0x206F
|
|
> ];
|
|
|
|
js> function validInRegExpLiteral(num) {
|
|
> eval('/.'+String.fromCharCode(num)+'./');
|
|
> }
|
|
js> function validInStringLiteral(num) {
|
|
> eval('"'+String.fromCharCode(num)+'"');
|
|
> }
|
|
js> function validInComments(num) {
|
|
> eval('/*'+String.fromCharCode(num)+'*/');
|
|
> }
|
|
|
|
js> function check(test) {
|
|
> return function(codePoint) {
|
|
> try {
|
|
> test(codePoint);
|
|
> return true;
|
|
> } catch (e) {
|
|
> throw "problem with U+"+codePoint.toString(16).toUpperCase()+": "+e;
|
|
> }
|
|
> };
|
|
> }
|
|
|
|
js> controlChars.every(check(validInRegExpLiteral))
|
|
true
|
|
js> controlChars.every(check(validInStringLiteral))
|
|
true
|
|
js> controlChars.every(check(validInComments))
|
|
true
|