inc/kxTok.h

Go to the documentation of this file.
00001 /* kxTok - quick little tokenizer for stuff first
00002  * loaded into memory.  Originally developed for
00003  * "Key eXpression" evaluator. 
00004  *
00005  * This file is copyright 2002 Jim Kent, but license is hereby
00006  * granted for all use - public, private or commercial. */
00007 
00008 #ifndef KXTOK_H
00009 #define KXTOK_H
00010 
00011 enum kxTokType
00012     {
00013     kxtEnd,
00014     kxtString,
00015     kxtWildString,
00016     kxtEquals,
00017     kxtGT,      /* Greater Than */
00018     kxtGE,      /* Greater Than or Equal */
00019     kxtLT,      /* Less Than */
00020     kxtLE,      /* Less Than or Equal */
00021     kxtAnd,
00022     kxtOr,
00023     kxtXor,
00024     kxtNot,
00025     kxtOpenParen,
00026     kxtCloseParen,
00027     kxtAdd,
00028     kxtSub,
00029     kxtDiv,
00030     kxtMul,
00031     kxtDot,
00032     kxtMod,
00033     kxtPunct,
00034     };
00035 
00036 struct kxTok
00037 /* A key expression token.   Input text is tokenized
00038  * into a list of these. */
00039     {
00040     struct kxTok *next;
00041     enum kxTokType type;
00042     bool spaceBefore;   /* True if there is a space before */
00043     char string[1];  /* Allocated at run time */
00044     };
00045 
00046 struct kxTok *kxTokenize(char *text, boolean wildAst);
00047 /* Convert text to stream of tokens. If 'wildAst' is
00048  * TRUE then '*' character will be treated as wildcard
00049  * rather than multiplication sign. */
00050 
00051 struct kxTok *kxTokenizeFancy(char *text, boolean wildAst,
00052                               boolean wildPercent, boolean includeHyphen);
00053 /* Convert text to stream of tokens. If 'wildAst' is
00054  * TRUE then '*' character will be treated as wildcard
00055  * rather than multiplication sign.  
00056  * If wildPercent is TRUE then the '%' character will be treated as a 
00057  * wildcard (as in SQL) rather than a modulo (kxtMod) or percent sign.
00058  * If includeHyphen is TRUE then a '-' character in the middle of a String 
00059  * token will be treated as a hyphen (part of the String token) instead of 
00060  * a new kxtSub token. */
00061 
00062 void kxTokIncludeQuotes(boolean val);
00063 /* Pass in TRUE if kxTok should include quote characters in string tokens. */
00064 
00065 #endif /* KXTOK_K */

Generated on Tue Dec 25 18:39:29 2007 for blat by  doxygen 1.5.2