// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

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
