[phc-internals] [phc commit] r1143 - in trunk/src: ast_to_hir
parsing process_ir
codesite-noreply at google.com
codesite-noreply at google.com
Thu Apr 3 16:11:31 IST 2008
Author: paul.biggar
Date: Thu Apr 3 08:10:23 2008
New Revision: 1143
Modified:
trunk/src/ast_to_hir/AST_shredder.cpp
trunk/src/parsing/Parse_buffer.cpp
trunk/src/parsing/Parse_buffer.h
trunk/src/process_ir/General.h
Log:
Convert a very small part of AST_shredder to use the parse_buffer.
These will be done is small does at the start, using the xml regression tests.
This works, and adds missing attributes. Score.
Modified: trunk/src/ast_to_hir/AST_shredder.cpp
==============================================================================
--- trunk/src/ast_to_hir/AST_shredder.cpp (original)
+++ trunk/src/ast_to_hir/AST_shredder.cpp Thu Apr 3 08:10:23 2008
@@ -359,12 +359,9 @@
Variable* old = dynamic_cast<Variable*>(in->attrs->get("phc.ast_shredder.old_error_level"));
assert(old);
- pieces->push_back(new Eval_expr(new Assignment(
- temp,
- false,
- new Method_invocation(
- "error_reporting",
- old))));
-
+ (*pieces
+ << temp << " = error_reporting (" << old << ");"
+ ).finish (in);
+
return in->expr;
}
Modified: trunk/src/parsing/Parse_buffer.cpp
==============================================================================
--- trunk/src/parsing/Parse_buffer.cpp (original)
+++ trunk/src/parsing/Parse_buffer.cpp Thu Apr 3 08:10:23 2008
@@ -37,6 +37,20 @@
return out;
}
+Parse_buffer::Parse_buffer& operator<<(List<AST::Statement*>& stmts,
AST::Node* in)
+{
+ Parse_buffer& out = *(new Parse_buffer (&stmts));
+ out.ss << "<?php ";
+
+ stringstream ss;
+ in->visit (new AST_unparser (ss, true));
+ out.ss << ss.str ();
+
+ return out;
+}
+
+
+
Parse_buffer::Parse_buffer& operator<<(Parse_buffer& out, AST::Node* in)
{
// Use the unparser
Modified: trunk/src/parsing/Parse_buffer.h
==============================================================================
--- trunk/src/parsing/Parse_buffer.h (original)
+++ trunk/src/parsing/Parse_buffer.h Thu Apr 3 08:10:23 2008
@@ -34,6 +34,7 @@
// Left-most
Parse_buffer& operator<<(List<AST::Statement*>& stmts, const char* in);
+Parse_buffer& operator<<(List<AST::Statement*>& stmts, AST::Node* in);
Parse_buffer& operator<<(Parse_buffer& out, AST::Node* in);
Parse_buffer& operator<<(Parse_buffer& out, const char* in);
Modified: trunk/src/process_ir/General.h
==============================================================================
--- trunk/src/process_ir/General.h (original)
+++ trunk/src/process_ir/General.h Thu Apr 3 08:10:23 2008
@@ -11,6 +11,7 @@
#include "debug.h"
#include "Foreach.h"
#include "Clone_blank_mixins.h"
+#include "parsing/Parse_buffer.h"
#include "HIR.h"
#include "AST.h"
More information about the phc-internals
mailing list