+2010-06-29 Raja R Harinath <harinath@hurrynot.org>
+
+ Make trace output resemble assembler listing
+ * compiler.cs (LinkRef.ToString) [TRACE_REGEX]: Add pretty-printer
+ in TRACE_REGEX mode.
+ (TraceRegexp): Indent the output.
+ (TraceRegexpLabel): New. Prints out a line label.
+ (EmitCount): Don't trace. All callers are traced.
+ (ResolveLink): Trace line labels.
+
2010-06-21 Rodrigo Kumpera <rkumpera@novell.com>
* compiler.cs: Use conditional compilation to enable
namespace System.Text.RegularExpressions {
abstract class LinkRef {
- // empty
+#if TRACE_REGEX
+ static int next_label = 1;
+ int label = next_label++;
+
+ public override string ToString ()
+ {
+ return "L" + label.ToString ();
+ }
+#endif
}
interface ICompiler {
[Conditional ("TRACE_REGEX")]
static void TraceRegexp (string fmt, params object[] args)
{
+ Console.Write ("\t");
Console.WriteLine (fmt, args);
}
+ [Conditional ("TRACE_REGEX")]
+ static void TraceRegexpLabel (LinkRef lref)
+ {
+ Console.Write ("{0}:", lref);
+ }
+
public static void DecodeOp (ushort word, out OpCode op, out OpFlags flags) {
op = (OpCode)(word & 0x00ff);
flags = (OpFlags)(word & 0xff00);
uint ucount = (uint) count;
Emit ((ushort) (ucount & 0xFFFF)); // lo 16bits
Emit ((ushort) (ucount >> 16)); // hi
-
- TraceRegexp ("count {0}", count);
}
public void EmitCharacter (char c, bool negate, bool ignore, bool reverse) {
while (stack.Pop ())
pgm[stack.OffsetAddress] = (ushort)stack.GetOffset (CurrentAddress);
+
+ TraceRegexpLabel (lref);
}
public void EmitBranchEnd(){}