www.pudn.com > cppcc.rar > dfa_re_node_builder.hh
/*
* File: dfa_re_node_builder.hh
* $Id: dfa_re_node_builder.hh,v 1.2 2002/05/22 01:23:23 alec Exp $
*
* Author: Alec Panoviciu (alecu@email.com)
*
* Comments:
*
* Revision history:
*
* $Log: dfa_re_node_builder.hh,v $
* Revision 1.2 2002/05/22 01:23:23 alec
* case sensitivity support
*
* Revision 1.1 2002/04/29 09:40:01 alec
* *** empty log message ***
*
*/
/*
Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __DFA_RE_NODE_BUILDER_HH__
#define __DFA_RE_NODE_BUILDER_HH__
#include "ire_node_builder.hh"
class DfaSourceRe;
class PropRegistry;
class DfaReNodeBuilder : public IReNodeBuilder
{
public:
DfaReNodeBuilder (PropRegistry ®istry_) : registry(registry_)
{}
virtual ReNode* createOrNode (ReNode *pre,
ReNode *post, const Position &pos);
virtual ReNode* createCatNode (ReNode *pre, ReNode *post,
const Position &pos);
virtual ReNode* createPlusNode (ReNode *in, const Position &pos);
virtual ReNode* createOptionalNode (ReNode *in, const Position &pos);
virtual ReNode* createStarNode (ReNode *in, const Position &pos);
virtual ReNode* createStringLiteralNode (const string& s,
const Position &pos);
virtual ReNode* createCharListNode (bool negated,
const vector &chars,
const Position &pos);
/**
* Creates a new reEotNode that signals the end of the token with the given
* id.
*/
DfaSourceRe* createEotNode (int tokId, const Position &pos);
protected:
/**
* This is where the "CASE_SENSITIVE" option is implemented. This method
* does char node(s) construction according to the given option. If the
* scanner is case-insensitive, for the character 'a' it will actually
* create the nodes for expression 'a' | 'A'.
*/
DfaSourceRe* createCharNode (unsigned char match, const Position &pos);
private:
PropRegistry ®istry;
/**
* Caches the CASE_SENSITIVE property from the registry.
*/
bool caseSensitive;
};
#endif /* #ifndef __DFA_RE_NODE_BUILDER_HH__ */