www.pudn.com > cppcc.rar > cw_re_node_builder.cc
/*
* File: cw_re_node_builder.cc
* $Id: cw_re_node_builder.cc,v 1.2 2003/06/04 10:18:27 alec Exp $
*
* Author: Alec Panoviciu (alecu@email.com)
*
* Comments:
*
* Revision history:
*
* $Log: cw_re_node_builder.cc,v $
* Revision 1.2 2003/06/04 10:18:27 alec
* 0.0.6
*
* Revision 1.1 2002/04/29 17:57:35 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
*/
#include "debug.h"
#include "cw_re_node_builder.h"
#include "ire_node_builder.hh"
IReNodeBuilder *cw_reNodeBuilder = NULL;
CLINK void* IReNodeBuilder_createOrNode (void *pre, void *post)
{
ASSERT(((pre != NULL) && (post != NULL)),
"NULL arguments in call to IReNodeBuilder_createOrNode");
return cw_reNodeBuilder->createOrNode(static_cast(pre),
static_cast(post),
Position(yylineno));
}
CLINK void* IReNodeBuilder_createCatNode (void *pre, void *post)
{
ASSERT(((pre != NULL) && (post != NULL)),
"NULL arguments in call to IReNodeBuilder_createCatNode");
return cw_reNodeBuilder->createCatNode(static_cast(pre),
static_cast(post),
Position(yylineno));
}
CLINK void* IReNodeBuilder_createPlusNode (void *in)
{
ASSERT((in != NULL), "NULL arguments in call to IReNodeBuilder_createPlusNode");
return cw_reNodeBuilder->createPlusNode(static_cast(in),
Position(yylineno));
}
CLINK void* IReNodeBuilder_createOptionalNode (void *in)
{
ASSERT((in != NULL), "NULL arguments in call to IReNodeBuilder_createOptionalNode");
return cw_reNodeBuilder->createOptionalNode(static_cast(in),
Position(yylineno));
}
CLINK void* IReNodeBuilder_createStarNode (void *in)
{
ASSERT((in != NULL), "NULL arguments in call to IReNodeBuilder_createStarNode");
return cw_reNodeBuilder->createStarNode(static_cast(in),
Position(yylineno));
}
CLINK void* IReNodeBuilder_createStringLiteralNode (char *s, int len)
{
ASSERT((s != NULL),
"NULL arguments in call to IReNodeBuilder_createStringLiteralNode");
string ss(s, len);
ss.erase(0,1); // remove
ss.erase(ss.length()-1, 1); // quotes from ss
return cw_reNodeBuilder->createStringLiteralNode(ss, Position(yylineno));
}
CLINK void* IReNodeBuilder_createCharListNode (int negated, CwCharClassList chars)
{
ASSERT((chars != NULL),
"NULL arguments in call to IReNodeBuilder_createStringLiteralNode");
vector *v = CwCharClassList2vector (chars);
ReNode *res = cw_reNodeBuilder->createCharListNode(negated != 0, *v,
Position(yylineno));
delete v;
return res;
}