Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ire_node_builder.hh

Go to the documentation of this file.
00001 /*
00002  *  File:       ire_node_builder.hh
00003  *              $Id: ire_node_builder.hh,v 1.4 2002/06/26 20:47:25 alec Exp $
00004  *
00005  *  Author:     Alec Panoviciu (alecu@email.com)
00006  *
00007  *  Comments:
00008  *
00009  *  Revision history:
00010  *
00011  *  $Log: ire_node_builder.hh,v $
00012  *  Revision 1.4  2002/06/26 20:47:25  alec
00013  *  g++ 3.x happy
00014  *
00015  *  Revision 1.3  2002/04/30 16:24:38  alec
00016  *  tested the scanner ptree & vBitVector implementation -> ok
00017  *
00018  *  Revision 1.2  2002/04/29 09:34:10  alec
00019  *  scanner ptree building compiles
00020  *
00021  */
00022 
00023 
00024 /* 
00025   Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com)
00026 
00027   This program is free software; you can redistribute it and/or modify
00028   it under the terms of the GNU General Public License as published by
00029   the Free Software Foundation; either version 2 of the License, or
00030   (at your option) any later version.
00031 
00032   This program is distributed in the hope that it will be useful,
00033   but WITHOUT ANY WARRANTY; without even the implied warranty of
00034   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00035   GNU General Public License for more details.
00036 
00037   You should have received a copy of the GNU General Public License
00038   along with this program; if not, write to the Free Software
00039   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00040 
00041  */
00042 
00043 #ifndef __IRE_NODE_BUILDER_HH__
00044 #define __IRE_NODE_BUILDER_HH__
00045 
00046 
00047 #include <string>
00048 #include <vector>
00049 using namespace std;
00050 
00051 #include "debug.h"
00052 #include "parse_util.hh"
00053 
00054 
00055 class ReNode;
00056 
00057 
00062 typedef struct t_CharClassDescriptor
00063 {
00064   unsigned char first;
00065   unsigned char last;
00066 
00070   t_CharClassDescriptor (unsigned char first_, unsigned char last_) :
00071     first(first_), last(last_)
00072   {
00073     ASSERT(first <= last, "Bad character descriptor: reversed range");
00074   }
00075 
00079   t_CharClassDescriptor (unsigned char c = 0) :
00080     first(c), last(c)
00081   {}
00082   
00083 } CharClassDescriptor;
00084 
00095 class IReNodeBuilder
00096 {
00097 public:
00098   
00102   virtual ReNode* createOrNode (ReNode *pre, ReNode *post,
00103                                 const Position &pos) = 0;
00104 
00108   virtual ReNode* createCatNode (ReNode *pre, ReNode *post,
00109                                  const Position &pos) = 0;
00110 
00114   virtual ReNode* createPlusNode (ReNode *in, const Position &pos) = 0;
00115 
00116 
00120   virtual ReNode* createOptionalNode (ReNode *in, const Position &pos) = 0;
00121 
00125   virtual ReNode* createStarNode (ReNode *in, const Position &pos) = 0;
00126 
00130   virtual ReNode* createStringLiteralNode (const string& s,
00131                                            const Position &pos) = 0;
00132 
00138   virtual ReNode* createCharListNode (bool negated,
00139                                       const vector<CharClassDescriptor> &chars,
00140                                       const Position &pos) = 0;
00141 };
00142 
00143 #endif /* #ifndef __IRE_NODE_BUILDER_HH__ */

Generated at Tue Jul 9 21:05:44 2002 for CppCC by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001