예제 #1
0
 protected override void Write(object value, bool isProperty)
 {
     if (value is Regex)
     {
         if (isProperty && base.Settings.PrettyPrint)
         {
             base.TextWriter.Write(' ');
         }
         EcmaScriptWriter.WriteEcmaScriptRegExp(this, (Regex)value);
         return;
     }
     base.Write(value, isProperty);
 }
예제 #2
0
 /// <summary>
 /// Outputs a .NET Regex as an ECMAScript RegExp literal.
 /// Defaults to global matching off.
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="regex"></param>
 /// <remarks>
 /// http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
 /// </remarks>
 public static void WriteEcmaScriptRegExp(JsonWriter writer, Regex regex)
 {
     EcmaScriptWriter.WriteEcmaScriptRegExp(writer, regex, false);
 }