From a3cb4c5d02f0ee75094fc27814c71f8a025d034b Mon Sep 17 00:00:00 2001 From: sbrandt Date: Wed, 3 Apr 2013 19:12:46 +0000 Subject: Add the basic grammar files, and the changes to the piraha code necessary to parse all of Cactus. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4990 17b73243-c579-4c4c-a9d2-2d5706c11dac --- src/piraha/Group.cc | 73 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 6 deletions(-) (limited to 'src/piraha/Group.cc') diff --git a/src/piraha/Group.cc b/src/piraha/Group.cc index 544e12be..95079800 100644 --- a/src/piraha/Group.cc +++ b/src/piraha/Group.cc @@ -2,22 +2,83 @@ using namespace piraha; -void Group::dump(int indent) { +void Group::dump(std::ostream& o) { + dump(-1,o,0); +} +void Group::dump(int n,std::ostream& o,int indent) { for(int i=0;i= 0) { + o << "[" << n << "] "; + } + o << pattern << ": "; if(children.size()==0) { for(int i=start_;i >::iterator group_iter; + int nn = 0; for(group_iter gi = children.begin(); gi != children.end(); ++gi) { - (*gi)->dump(indent+2); + (*gi)->dump(nn++,o,indent+2); } } +void Group::dumpPerl(std::ostream& o) { + o << "$VAR = "; + dumpPerl(o,0); + o << ";" << std::endl; +} +void Group::dumpPerl(std::ostream &o,int indent) { + for(int i=0;i \"" << getPatternName() << "\"," << std::endl; + if(children.size()==0) { + for(int i=0;i[]," << std::endl; + for(int i=0;i\""; + for(int i=start_;i[" << std::endl; + typedef vector >::iterator group_iter; + for(group_iter gi = children.begin(); + gi != children.end(); + ++gi) { + (*gi)->dumpPerl(o,indent+2); + for(int i=0;i" << start() << "," << std::endl; + for(int i=0;i" << end() << "," << std::endl; + for(int i=0;i" << line() << "," << std::endl; + indent -= 2; + for(int i=0;i