00001 /* 00002 * File: ebnf_node.cc 00003 * $Id: ebnf_node.cc,v 1.4 2002/05/16 21:35:44 alec Exp $ 00004 * 00005 * Author: Alec Panoviciu (alecu@email.com) 00006 * 00007 * Comments: 00008 * 00009 * Revision history: 00010 * 00011 * $Log: ebnf_node.cc,v $ 00012 * Revision 1.4 2002/05/16 21:35:44 alec 00013 * parser generation done 00014 * 00015 * Revision 1.3 2002/05/10 18:08:25 alec 00016 * *** empty log message *** 00017 * 00018 * Revision 1.2 2002/04/29 09:34:10 alec 00019 * scanner ptree building compiles 00020 * 00021 */ 00022 00023 /* 00024 Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com) 00025 00026 This program is free software; you can redistribute it and/or modify 00027 it under the terms of the GNU General Public License as published by 00028 the Free Software Foundation; either version 2 of the License, or 00029 (at your option) any later version. 00030 00031 This program is distributed in the hope that it will be useful, 00032 but WITHOUT ANY WARRANTY; without even the implied warranty of 00033 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00034 GNU General Public License for more details. 00035 00036 You should have received a copy of the GNU General Public License 00037 along with this program; if not, write to the Free Software 00038 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00039 00040 */ 00041 00042 00043 #include "ebnf_node.hh" 00044 #include "ebnf_node_algo.hh" 00045 00046 bool EbnfNode::dfTraverse (EbnfNodeAlgo &algo) throw (EbnfNodeAlgoException) 00047 { 00048 for (int i = 0; i < getChildCount(); i++) 00049 if (!(*this)[i].dfTraverse(algo)) 00050 return false; 00051 00052 return algo(*this); 00053 } 00054 00055 bool EbnfNode::rdfTraverse (EbnfNodeAlgo &algo) throw (EbnfNodeAlgoException) 00056 { 00057 if (algo(*this)) { 00058 for (int i = 0; i < getChildCount(); i++) 00059 if (!(*this)[i].rdfTraverse(algo)) 00060 return false; 00061 return true; 00062 } 00063 }