internal virtual String TextposDescription() { StringBuilder Sb = new StringBuilder(); int remaining; Sb.Append(runtextpos); if (Sb.Length < 8) { Sb.Append(' ', 8 - Sb.Length); } if (runtextpos > runtextbeg) { Sb.Append(RegexCharClass.CharDescription(runtext [runtextpos - 1])); } else { Sb.Append('^'); } Sb.Append('>'); remaining = runtextend - runtextpos; for (int i = runtextpos; i < runtextend; i++) { Sb.Append(RegexCharClass.CharDescription(runtext [i])); } if (Sb.Length >= 64) { Sb.Length = 61; Sb.Append("..."); } else { Sb.Append('$'); } return(Sb.ToString()); }
internal string Description() { var ArgSb = new StringBuilder(); ArgSb.Append(TypeStr[_type]); if ((_options & RegexOptions.ExplicitCapture) != 0) { ArgSb.Append("-C"); } if ((_options & RegexOptions.IgnoreCase) != 0) { ArgSb.Append("-I"); } if ((_options & RegexOptions.RightToLeft) != 0) { ArgSb.Append("-L"); } if ((_options & RegexOptions.Multiline) != 0) { ArgSb.Append("-M"); } if ((_options & RegexOptions.Singleline) != 0) { ArgSb.Append("-S"); } if ((_options & RegexOptions.IgnorePatternWhitespace) != 0) { ArgSb.Append("-X"); } if ((_options & RegexOptions.ECMAScript) != 0) { ArgSb.Append("-E"); } switch (_type) { case Oneloop: case Notoneloop: case Onelazy: case Notonelazy: case One: case Notone: ArgSb.Append("(Ch = " + RegexCharClass.CharDescription(_ch) + ")"); break; case Capture: ArgSb.Append("(index = " + _m.ToString(CultureInfo.InvariantCulture) + ", unindex = " + _n.ToString(CultureInfo.InvariantCulture) + ")"); break; case Ref: case Testref: ArgSb.Append("(index = " + _m.ToString(CultureInfo.InvariantCulture) + ")"); break; case Multi: ArgSb.Append("(String = " + _str + ")"); break; case Set: case Setloop: case Setlazy: ArgSb.Append("(Set = " + RegexCharClass.SetDescription(_str) + ")"); break; } switch (_type) { case Oneloop: case Notoneloop: case Onelazy: case Notonelazy: case Setloop: case Setlazy: case Loop: case Lazyloop: ArgSb.Append("(Min = " + _m.ToString(CultureInfo.InvariantCulture) + ", Max = " + (_n == int.MaxValue ? "inf" : Convert.ToString(_n, CultureInfo.InvariantCulture)) + ")"); break; } return(ArgSb.ToString()); }
internal string OpcodeDescription(int offset) { var sb = new StringBuilder(); int opcode = _codes[offset]; sb.AppendFormat("{0:D6} ", offset); sb.Append(OpcodeBacktracks(opcode & Mask) ? '*' : ' '); sb.Append(OperatorDescription(opcode)); sb.Append('('); opcode &= Mask; switch (opcode) { case One: case Notone: case Onerep: case Notonerep: case Oneloop: case Notoneloop: case Onelazy: case Notonelazy: sb.Append("Ch = "); sb.Append(RegexCharClass.CharDescription((char)_codes[offset + 1])); break; case Set: case Setrep: case Setloop: case Setlazy: sb.Append("Set = "); sb.Append(RegexCharClass.SetDescription(_strings[_codes[offset + 1]])); break; case Multi: sb.Append("String = "); sb.Append(_strings[_codes[offset + 1]]); break; case Ref: case Testref: sb.Append("Index = "); sb.Append(_codes[offset + 1]); break; case Capturemark: sb.Append("Index = "); sb.Append(_codes[offset + 1]); if (_codes[offset + 2] != -1) { sb.Append(", Unindex = "); sb.Append(_codes[offset + 2]); } break; case Nullcount: case Setcount: sb.Append("Value = "); sb.Append(_codes[offset + 1]); break; case Goto: case Lazybranch: case Branchmark: case Lazybranchmark: case Branchcount: case Lazybranchcount: sb.Append("Addr = "); sb.Append(_codes[offset + 1]); break; } switch (opcode) { case Onerep: case Notonerep: case Oneloop: case Notoneloop: case Onelazy: case Notonelazy: case Setrep: case Setloop: case Setlazy: sb.Append(", Rep = "); if (_codes[offset + 2] == int.MaxValue) { sb.Append("inf"); } else { sb.Append(_codes[offset + 2]); } break; case Branchcount: case Lazybranchcount: sb.Append(", Limit = "); if (_codes[offset + 2] == int.MaxValue) { sb.Append("inf"); } else { sb.Append(_codes[offset + 2]); } break; } sb.Append(')'); return(sb.ToString()); }