Go to the source code of this file.
Jason Luu July 22, 2009 Tokenizer
Enumerator |
---|
TOKEN_NULL |
|
TOKEN_STRING |
|
TOKEN_INT |
|
TOKEN_OPEN_SQUARE_BRACKET |
|
TOKEN_CLOSE_SQUARE_BRACKET |
|
TOKEN_OPEN_SQUIG_BRACKET |
|
TOKEN_CLOSE_SQUIG_BRACKET |
|
TOKEN_COLON |
|
TOKEN_DOT |
|
Definition at line 10 of file token.h.
Definition at line 126 of file token.c.
127 if (token.type != token_type) {
Definition at line 93 of file token.c.
95 for (i = 0; i < num_tokens; i++) {
t_token* GetTokensFromString |
( |
INP const char * |
inString, |
|
|
OUTP int * |
num_tokens |
|
) |
| |
Definition at line 18 of file token.c.
21 int i, in_string_index, prev_in_string_index;
28 if (inString == NULL) {
37 if (new_token_type != cur_token_type) {
38 cur_token_type = new_token_type;
47 if (*num_tokens > 0) {
57 prev_in_string_index = 0;
65 if (new_token_type != cur_token_type) {
67 tokens[i - 1].
data[in_string_index - prev_in_string_index] =
72 tokens[i].
type = new_token_type;
74 prev_in_string_index = in_string_index;
78 cur_token_type = new_token_type;
84 assert(i == *num_tokens);
87 tokens[*num_tokens].
data = NULL;
enum e_token_type GetTokenTypeFromChar(INP enum e_token_type cur_token_type, INP char cur)
void * my_calloc(size_t nelem, size_t size)
char * my_strdup(const char *str)
void my_atof_2D |
( |
INOUTP float ** |
matrix, |
|
|
INP int |
max_i, |
|
|
INP int |
max_j, |
|
|
INP char * |
instring |
|
) |
| |
Definition at line 133 of file token.c.
136 char *cur, *cur2, *copy, *
final;
140 while (*
final !=
'\0') {
146 while (cur !=
final) {
162 assert(i < max_i && j < max_j);
163 matrix[i][j] = atof(cur);
169 assert((i == max_i && j == 0) || (i == max_i - 1 && j == max_j));
boolean IsWhitespace(char c)
char * my_strdup(const char *str)