#include <string.h>
#include <assert.h>
#include "util.h"
#include "token.h"
#include "ezxml.h"
#include "read_xml_util.h"
Go to the source code of this file.
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)
Jason Luu July 22, 2009 Tokenizer
Definition at line 101 of file token.c.
108 }
else if (cur ==
']') {
110 }
else if (cur ==
'{') {
112 }
else if (cur ==
'}') {
114 }
else if (cur ==
':') {
116 }
else if (cur ==
'.') {
118 }
else if (cur >=
'0' && cur <=
'9' && cur_token_type !=
TOKEN_STRING) {
boolean IsWhitespace(char c)
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)