From f02d615052e325616d7042096cea6e5247a980dc Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 20 Feb 2008 09:54:58 +0000 Subject: - basic implementation of expression parser parsing done - improved ABNF a bit --- ctok.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ctok.c') diff --git a/ctok.c b/ctok.c index eca6daa5..0cf1eeb2 100644 --- a/ctok.c +++ b/ctok.c @@ -95,7 +95,8 @@ ctokGetCharFromStream(ctok_t *pThis, uchar *pc) ISOBJ_TYPE_assert(pThis, ctok); ASSERT(pc != NULL); - if(*pThis->pp == '\0') { + /* end of string or begin of comment terminates the "stream" */ + if(*pThis->pp == '\0' || *pThis->pp == '#') { ABORT_FINALIZE(RS_RET_EOS); } else { *pc = *pThis->pp; @@ -359,7 +360,7 @@ ctokGetToken(ctok_t *pThis, ctok_token_t **ppToken) uchar szWord[128]; ISOBJ_TYPE_assert(pThis, ctok); - ASSERT(pToken != NULL); + ASSERT(ppToken != NULL); /* first check if we have an ungotten token and, if so, provide that * one back (without any parsing). -- rgerhards, 2008-02-20 @@ -450,6 +451,8 @@ ctokGetToken(ctok_t *pThis, ctok_token_t **ppToken) pToken->tok = ctok_OR; } else if(!strcasecmp((char*)szWord, "not")) { pToken->tok = ctok_NOT; + } else if(!strcasecmp((char*)szWord, "then")) { + pToken->tok = ctok_THEN; } else { /* finally, we check if it is a function */ CHKiRet(ctokGetCharFromStream(pThis, &c)); /* read a charater */ -- cgit