Data Structures | |
| struct | TokenType |
| A structure defining the type and subtype of a token. More... | |
Defines | |
| #define | BAIL_IF(value, func, errval) if(value) { func; return(errval); } |
| A macro to simplify testing bounds ranges. | |
| #define | TYPE_ENDOPEN 0xffff |
| Denotes an open-ended syntax check. | |
| #define | TYPE_ENDCLOSE 0xfffe |
| Denotes a strict syntax-check, last argument MUST be the last. | |
Typedefs | |
| typedef TokenType | TokenType |
| A structure defining the type and subtype of a token. | |
Functions | |
| void | FreeType (TokenType *types) |
| Frees an array of token-types and everything it contains. | |
| TokenType * | LineToTypes (const char *str, const char **table[]) |
| Converts a line of text to an array of token-types. | |
| int | DetermineType (const char *str, const char **table[]) |
| Determines the root type of a token. | |
| int | DetermineSubType (int type, const char *str, const char **args[]) |
| Determines the sub-type from a known type. | |
| int | CheckLineSyntax (TokenType *tarray,...) |
| Define PRINT_COMMENTS to print comments at runtime. Used for debugging. A generalized function to check the syntax of an array of token types. | |
At the root of it all, is the command table. It contains a list of pointers; each pointer points to a list of strings. Both the table and each list in it are NULL-terminated. The strings denote valid commands or valid command forms. For instance, say you have the root category of 'value'. Being the first thing in the command table, it would be at index 0, and point to a list of strings, like { "#d","\"%s",NULL }; d means accept any sequence of numbers in that spot, s means accept any integer values in that spot. So both "#100" and "\"Hello" would be accepted as valid commands. "#100" would be subcommand 0, while "\"Hello" would be subcommand 1.
|
|
A macro to simplify testing bounds ranges. If 'value' evaluates to true, then 'func' is performed before 'return (errval)'. Depreciated, now replaced by CheckLineSyntax Definition at line 56 of file toyparse.h. |
|
|
Denotes a strict syntax-check, last argument MUST be the last.
Definition at line 89 of file toyparse.h. Referenced by CheckLineSyntax(). |
|
|
Denotes an open-ended syntax check.
Definition at line 87 of file toyparse.h. Referenced by CheckLineSyntax(). |
|
|
A structure defining the type and subtype of a token. When used in arrays, if token==NULL that is the last element. |
|
||||||||||||
|
Define PRINT_COMMENTS to print comments at runtime. Used for debugging. A generalized function to check the syntax of an array of token types. Used like: CheckLineSyntax(tokens,TYPE_COMMAND,-1,TYPE_ENDOPEN); This means that the first token can be any kind of command, and that more arguments may come after it. Returns 0 on success, -1 on bad syntax. Definition at line 36 of file toyparse.c. References TokenType::subtype, TokenType::token, TokenType::type, TYPE_ENDCLOSE, and TYPE_ENDOPEN. Referenced by TMM_ParseLine(). |
|
||||||||||||||||
|
Determines the sub-type from a known type. Returns the array sub-index on success, -1 on failure. Definition at line 176 of file toyparse.c. |
|
||||||||||||
|
Determines the root type of a token. Returns the root array index on success, -1 on failure. Definition at line 205 of file toyparse.c. |
|
|
Frees an array of token-types and everything it contains. Returns no values. Definition at line 111 of file toyparse.c. References TokenType::token. Referenced by TMM_ParseLine(). |
|
||||||||||||
|
Converts a line of text to an array of token-types. Returns a tokentype array on success, NULL on failure. Definition at line 91 of file toyparse.c. Referenced by TMM_ParseLine(). |
1.3-rc3