Author: [EMAIL PROTECTED]
Date: Wed Nov 26 23:21:43 2008
New Revision: 852
Modified:
branches/bleeding_edge/src/jsregexp.cc
branches/bleeding_edge/test/cctest/test-regexp.cc
Log:
Graph node attribute printing.
Modified: branches/bleeding_edge/src/jsregexp.cc
==============================================================================
--- branches/bleeding_edge/src/jsregexp.cc (original)
+++ branches/bleeding_edge/src/jsregexp.cc Wed Nov 26 23:21:43 2008
@@ -1500,6 +1500,7 @@
void PrintNode(const char* label, RegExpNode* node);
void Visit(RegExpNode* node);
void PrintOnFailure(RegExpNode* from, RegExpNode* on_failure);
+ void PrintAttributes(RegExpNode* from);
StringStream* stream() { return &stream_; }
#define DECLARE_VISIT(Type) \
virtual void Visit##Type(Type##Node* that);
@@ -1602,11 +1603,34 @@
};
+void DotPrinter::PrintAttributes(RegExpNode* that) {
+ stream()->Add(" a%p [shape=Mrecord, style=dashed, color=lightgrey, "
+ "fontcolor=lightgrey, margin=0.1, fontsize=10, label=\"{",
+ that);
+ NodeInfo* info = that->info();
+ stream()->Add("{NI|%i}|{SI|%i}|{WI|%i}",
+ info->follows_newline_interest,
+ info->follows_start_interest,
+ info->follows_word_interest);
+ stream()->Add("|{DN|%i}|{DS|%i}|{DW|%i}",
+ info->determine_newline,
+ info->determine_start,
+ info->determine_word);
+ Label* label = that->label();
+ if (label->is_bound())
+ stream()->Add("|{@|%x}", label->pos());
+ stream()->Add("}\"];\n");
+ stream()->Add(" a%p -> n%p [style=dashed, color=lightgrey, "
+ "arrowhead=none];\n", that, that);
+}
+
+
void DotPrinter::VisitChoice(ChoiceNode* that) {
stream()->Add(" n%p [shape=Mrecord, label=\"", that);
TableEntryHeaderPrinter header_printer(stream());
that->table()->ForEach(&header_printer);
stream()->Add("\"]\n", that);
+ PrintAttributes(that);
TableEntryBodyPrinter body_printer(stream(), that);
that->table()->ForEach(&body_printer);
PrintOnFailure(that, that->on_failure());
@@ -1644,6 +1668,7 @@
}
}
stream()->Add("\", shape=box, peripheries=2];\n");
+ PrintAttributes(that);
stream()->Add(" n%p -> n%p;\n", that, that->on_success());
Visit(that->on_success());
PrintOnFailure(that, that->on_failure());
@@ -1655,6 +1680,7 @@
that,
that->start_register(),
that->end_register());
+ PrintAttributes(that);
stream()->Add(" n%p -> n%p;\n", that, that->on_success());
Visit(that->on_success());
PrintOnFailure(that, that->on_failure());
@@ -1663,6 +1689,7 @@
void DotPrinter::VisitEnd(EndNode* that) {
stream()->Add(" n%p [style=bold, shape=point];\n", that);
+ PrintAttributes(that);
}
@@ -1698,6 +1725,7 @@
break;
}
stream()->Add("];\n");
+ PrintAttributes(that);
stream()->Add(" n%p -> n%p;\n", that, that->on_success());
Visit(that->on_success());
}
Modified: branches/bleeding_edge/test/cctest/test-regexp.cc
==============================================================================
--- branches/bleeding_edge/test/cctest/test-regexp.cc (original)
+++ branches/bleeding_edge/test/cctest/test-regexp.cc Wed Nov 26 23:21:43
2008
@@ -1175,5 +1175,5 @@
TEST(Graph) {
V8::Initialize(NULL);
- Execute("(x)?\\1y", "", true);
+ Execute("\\w+", "", true);
}
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---