From 0af8d22ff6e9fbd8eb89a1612ecf4604f058f78c Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 20 Feb 2008 08:48:20 +0000 Subject: created new class ctok_token --- ctok.h | 38 ++++---------------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) (limited to 'ctok.h') diff --git a/ctok.h b/ctok.h index 1cddb68b..26dae5f1 100644 --- a/ctok.h +++ b/ctok.h @@ -24,45 +24,14 @@ #include "obj.h" #include "stringbuf.h" - -/* the tokens... I use numbers below so that the tokens can be easier - * identified in debug output. */ -typedef struct { - enum { - ctok_INVALID = 0, - ctok_OR = 1, - ctok_AND = 2, - ctok_PLUS = 3, - ctok_MINUS = 4, - ctok_TIMES = 5, /* "*" */ - ctok_DIV = 6, - ctok_MOD = 7, - ctok_NOT = 8, - ctok_RPAREN = 9, - ctok_LPAREN = 10, - ctok_COMMA = 11, - ctok_SYSVAR = 12, - ctok_MSGVAR = 13, - ctok_SIMPSTR = 14, - ctok_TPLSTR = 15, - ctok_CMP_EQ = 16, - ctok_CMP_NEQ = 17, - ctok_CMP_LT = 18, - ctok_CMP_GT = 19, - ctok_CMP_LTEQ = 20, - ctok_CMP_GTEQ = 21, - ctok_NUMBER = 22, - ctok_FUNCTION = 23 - } tok; - rsCStrObj *pstrVal; - int64 intVal; -} ctok_token_t; +#include "ctok_token.h" /* the ctokession object */ typedef struct ctok_s { BEGINobjInstance; /* Data to implement generic object - MUST be the first data element! */ uchar *pp; /* this points to the next unread character, it is a reminescent of pp in the config parser code ;) */ + ctok_token_t *pUngotToken; /* buffer for ctokUngetToken(), NULL if not set */ } ctok_t; @@ -71,7 +40,8 @@ rsRetVal ctokConstruct(ctok_t **ppThis); rsRetVal ctokConstructFinalize(ctok_t __attribute__((unused)) *pThis); rsRetVal ctokDestruct(ctok_t **ppThis); rsRetVal ctokGetpp(ctok_t *pThis, uchar **pp); -rsRetVal ctokGetNextToken(ctok_t *pThis, ctok_token_t *pToken); +rsRetVal ctokGetToken(ctok_t *pThis, ctok_token_t **ppToken); +rsRetVal ctokUngetToken(ctok_t *pThis, ctok_token_t *pToken); PROTOTYPEObjClassInit(ctok); PROTOTYPEpropSetMeth(ctok, pp, uchar*); -- cgit