Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

VRegExpr.cpp File Reference

#include "VRegExpr.hpp"
#include "FSM.hpp"

Go to the source code of this file.

Compounds

struct  RegExprStackItem

Defines

#define STACKITEM_REGEXPR   0
#define STACKITEM_OPENPARENC   1
#define STACKITEM_BINOPSTART   2
#define STACKITEM_SEQ   2
#define STACKITEM_MINUS   3
#define STACKITEM_ALT   4
#define STACKITEM_AND   5

Functions

char ConvertOpCode (unsigned long type)
void ReduceAll (RegExprStackItem **stackptr)
void HandleBinOp (RegExprStackItem **stackptr, unsigned opcode)
void HandleRegExpr (RegExprStackItem **stackptr, VRegExpr *regexpr)
void HandleUnaryOp (RegExprStackItem **stackptr, char opcode, char *curptr)
void HandleOpenParenc (RegExprStackItem **stackptr)
void HandleCloseParenc (RegExprStackItem **stackptr, char *curptr)

Variables

MemStreamer tmpmem
MemStreamer mainmem
MemStreamervregexprmem
TLabelID elementpoundlabelid
TLabelID attribpoundlabelid
char * vregexprerrptr
char * vregexprerrstr


Define Documentation

#define STACKITEM_ALT   4
 

Definition at line 252 of file VRegExpr.cpp.

#define STACKITEM_AND   5
 

Definition at line 253 of file VRegExpr.cpp.

#define STACKITEM_BINOPSTART   2
 

Definition at line 249 of file VRegExpr.cpp.

#define STACKITEM_MINUS   3
 

Definition at line 251 of file VRegExpr.cpp.

#define STACKITEM_OPENPARENC   1
 

Definition at line 248 of file VRegExpr.cpp.

#define STACKITEM_REGEXPR   0
 

Definition at line 247 of file VRegExpr.cpp.

#define STACKITEM_SEQ   2
 

Definition at line 250 of file VRegExpr.cpp.


Function Documentation

char ConvertOpCode unsigned long    type [inline]
 

Definition at line 282 of file VRegExpr.cpp.

Referenced by HandleBinOp(), and ReduceAll().

00283 {
00284    switch(type)
00285    {
00286    case STACKITEM_SEQ:  return VP_ITEMTYPE_SEQ;
00287    case STACKITEM_MINUS:return VP_ITEMTYPE_MINUS;
00288    case STACKITEM_ALT:  return VP_ITEMTYPE_ALT;
00289    case STACKITEM_AND:  return VP_ITEMTYPE_AND;
00290    }
00291    return 0;
00292 }

void HandleBinOp RegExprStackItem **    stackptr,
unsigned    opcode
[inline]
 

Definition at line 308 of file VRegExpr.cpp.

Referenced by HandleOpenParenc(), and VRegExpr::ParseVRegExpr().

00309 {
00310    VRegExpr *regexpr;
00311 
00312    if((*stackptr==NULL)||((*stackptr)->type!=STACKITEM_REGEXPR))
00313    {
00314       Error("Binary operation !!\n");
00315       Exit();
00316    }
00317 
00318    while(((*stackptr)->prev!=NULL)&&
00319          ((*stackptr)->prev->type>=opcode))
00320    {
00321       regexpr=new VRegExpr(ConvertOpCode((*stackptr)->prev->type),
00322                            (*stackptr)->prev->prev->regexpr,
00323                            (*stackptr)->regexpr);
00324       *stackptr=new RegExprStackItem(regexpr,(*stackptr)->prev->prev->prev);
00325    }
00326    *stackptr=new RegExprStackItem(opcode,*stackptr);
00327 }

void HandleCloseParenc RegExprStackItem **    stackptr,
char *    curptr
[inline]
 

Definition at line 361 of file VRegExpr.cpp.

Referenced by VRegExpr::ParseVRegExpr().

00362 {
00363    ReduceAll(stackptr);
00364 
00365    if(((*stackptr)->prev==NULL)||
00366       ((*stackptr)->prev->type!=STACKITEM_OPENPARENC))
00367    {
00368       Error("Unexpected closing bracket");
00369       Exit();
00370    }
00371    VRegExpr *regexpr=new VRegExpr(VP_ITEMTYPE_GROUP,(*stackptr)->regexpr,NULL);
00372 
00373    *stackptr=new RegExprStackItem(regexpr,(*stackptr)->prev->prev);
00374 }

void HandleOpenParenc RegExprStackItem **    stackptr [inline]
 

Definition at line 352 of file VRegExpr.cpp.

Referenced by VRegExpr::ParseVRegExpr().

00353 {
00354    if((*stackptr!=NULL)&&
00355       ((*stackptr)->type==STACKITEM_REGEXPR))
00356       HandleBinOp(stackptr,STACKITEM_SEQ);
00357 
00358    *stackptr=new RegExprStackItem(STACKITEM_OPENPARENC,*stackptr);
00359 }

void HandleRegExpr RegExprStackItem **    stackptr,
VRegExpr   regexpr
[inline]
 

Definition at line 329 of file VRegExpr.cpp.

Referenced by VRegExpr::ParseVRegExpr().

00331 {
00332    if((*stackptr!=NULL)&&
00333       ((*stackptr)->type==STACKITEM_REGEXPR))
00334       HandleBinOp(stackptr,STACKITEM_SEQ);
00335 
00336    *stackptr=new RegExprStackItem(regexpr,*stackptr);
00337 }

void HandleUnaryOp RegExprStackItem **    stackptr,
char    opcode,
char *    curptr
[inline]
 

Definition at line 339 of file VRegExpr.cpp.

Referenced by VRegExpr::ParseVRegExpr().

00340 {
00341    if((*stackptr==NULL)||
00342       ((*stackptr)->type!=STACKITEM_REGEXPR))
00343    {
00344       Error("Unexpected unary operator");
00345       Exit();
00346    }
00347 
00348    VRegExpr *regexpr=new VRegExpr(opcode,(*stackptr)->regexpr);
00349    *stackptr=new RegExprStackItem(regexpr,(*stackptr)->prev);
00350 }

void ReduceAll RegExprStackItem **    stackptr [inline]
 

Definition at line 294 of file VRegExpr.cpp.

Referenced by HandleCloseParenc(), and VRegExpr::ParseVRegExpr().

00295 {
00296    VRegExpr *regexpr;
00297 
00298    while(((*stackptr)->prev!=NULL)&&
00299          ((*stackptr)->prev->type>=STACKITEM_BINOPSTART))
00300    {
00301       regexpr=new VRegExpr(ConvertOpCode((*stackptr)->prev->type),
00302                            (*stackptr)->prev->prev->regexpr,
00303                            (*stackptr)->regexpr);
00304       *stackptr=new RegExprStackItem(regexpr,(*stackptr)->prev->prev->prev);
00305    }
00306 }


Variable Documentation

TLabelID attribpoundlabelid
 

Definition at line 10 of file VRegExpr.cpp.

TLabelID elementpoundlabelid
 

Definition at line 9 of file VRegExpr.cpp.

MemStreamer mainmem
 

Definition at line 5 of file VRegExpr.cpp.

MemStreamer tmpmem
 

Definition at line 4 of file VRegExpr.cpp.

char* vregexprerrptr
 

Definition at line 205 of file VRegExpr.cpp.

char* vregexprerrstr
 

Definition at line 206 of file VRegExpr.cpp.

MemStreamer* vregexprmem
 

Definition at line 7 of file VRegExpr.cpp.


Generated on Sat Oct 13 16:08:50 2001 for XMILL by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001