• Home
  • Raw
  • Download

Lines Matching refs:l

46 bc_lex_invalidChar(BcLex* l, char c)  in bc_lex_invalidChar()  argument
48 l->t = BC_LEX_INVALID; in bc_lex_invalidChar()
49 bc_lex_verr(l, BC_ERR_PARSE_CHAR, c); in bc_lex_invalidChar()
53 bc_lex_lineComment(BcLex* l) in bc_lex_lineComment() argument
55 l->t = BC_LEX_WHITESPACE; in bc_lex_lineComment()
56 while (l->i < l->len && l->buf[l->i] != '\n') in bc_lex_lineComment()
58 l->i += 1; in bc_lex_lineComment()
63 bc_lex_comment(BcLex* l) in bc_lex_comment() argument
70 l->i += 1; in bc_lex_comment()
71 l->t = BC_LEX_WHITESPACE; in bc_lex_comment()
78 buf = l->buf; in bc_lex_comment()
85 for (i = l->i; !end; i += !end) in bc_lex_comment()
97 if (!vm->eof && l->mode != BC_MODE_FILE) in bc_lex_comment()
99 got_more = bc_lex_readLine(l); in bc_lex_comment()
114 l->i = i; in bc_lex_comment()
115 bc_lex_err(l, BC_ERR_PARSE_COMMENT); in bc_lex_comment()
118 l->i = i + 2; in bc_lex_comment()
119 l->line += nlines; in bc_lex_comment()
123 bc_lex_whitespace(BcLex* l) in bc_lex_whitespace() argument
127 l->t = BC_LEX_WHITESPACE; in bc_lex_whitespace()
130 for (c = l->buf[l->i]; c != '\n' && isspace(c); c = l->buf[++l->i]) in bc_lex_whitespace()
137 bc_lex_commonTokens(BcLex* l, char c) in bc_lex_commonTokens() argument
139 if (!c) l->t = BC_LEX_EOF; in bc_lex_commonTokens()
140 else if (c == '\n') l->t = BC_LEX_NLINE; in bc_lex_commonTokens()
141 else bc_lex_whitespace(l); in bc_lex_commonTokens()
152 bc_lex_num(BcLex* l, char start, bool int_only) in bc_lex_num() argument
154 const char* buf = l->buf + l->i; in bc_lex_num()
195 bc_vec_push(&l->str, &c); in bc_lex_num()
202 bc_lex_number(BcLex* l, char start) in bc_lex_number() argument
204 l->t = BC_LEX_NUMBER; in bc_lex_number()
207 bc_vec_popAll(&l->str); in bc_lex_number()
208 bc_vec_push(&l->str, &start); in bc_lex_number()
211 l->i += bc_lex_num(l, start, false); in bc_lex_number()
215 char c = l->buf[l->i]; in bc_lex_number()
222 if (BC_IS_POSIX) bc_lex_err(l, BC_ERR_POSIX_EXP_NUM); in bc_lex_number()
226 bc_vec_push(&l->str, &c); in bc_lex_number()
227 l->i += 1; in bc_lex_number()
228 c = l->buf[l->i]; in bc_lex_number()
233 bc_vec_push(&l->str, &c); in bc_lex_number()
234 l->i += 1; in bc_lex_number()
235 c = l->buf[l->i]; in bc_lex_number()
241 bc_lex_verr(l, BC_ERR_PARSE_CHAR, c); in bc_lex_number()
245 l->i += bc_lex_num(l, 0, true); in bc_lex_number()
250 bc_vec_pushByte(&l->str, '\0'); in bc_lex_number()
254 bc_lex_name(BcLex* l) in bc_lex_name() argument
257 const char* buf = l->buf + l->i - 1; in bc_lex_name()
260 l->t = BC_LEX_NAME; in bc_lex_name()
269 bc_vec_string(&l->str, i, buf); in bc_lex_name()
272 l->i += i - 1; in bc_lex_name()
276 bc_lex_init(BcLex* l) in bc_lex_init() argument
279 assert(l != NULL); in bc_lex_init()
280 bc_vec_init(&l->str, sizeof(char), BC_DTOR_NONE); in bc_lex_init()
284 bc_lex_free(BcLex* l) in bc_lex_free() argument
287 assert(l != NULL); in bc_lex_free()
288 bc_vec_free(&l->str); in bc_lex_free()
292 bc_lex_file(BcLex* l, const char* file) in bc_lex_file() argument
294 assert(l != NULL && file != NULL); in bc_lex_file()
295 l->line = 1; in bc_lex_file()
300 bc_lex_next(BcLex* l) in bc_lex_next() argument
304 assert(l != NULL); in bc_lex_next()
306 l->last = l->t; in bc_lex_next()
309 l->line += (l->i != 0 && l->buf[l->i - 1] == '\n'); in bc_lex_next()
312 if (BC_ERR(l->last == BC_LEX_EOF)) bc_lex_err(l, BC_ERR_PARSE_EOF); in bc_lex_next()
314 l->t = BC_LEX_EOF; in bc_lex_next()
317 if (l->i == l->len) return; in bc_lex_next()
323 vm->next(l); in bc_lex_next()
325 while (l->t == BC_LEX_WHITESPACE); in bc_lex_next()
336 bc_lex_fixText(BcLex* l, const char* text, size_t len) in bc_lex_fixText() argument
338 l->buf = text; in bc_lex_fixText()
339 l->len = len; in bc_lex_fixText()
343 bc_lex_readLine(BcLex* l) in bc_lex_readLine() argument
352 switch (l->mode) in bc_lex_readLine()
385 bc_lex_fixText(l, vm->buffer.v, vm->buffer.len - 1); in bc_lex_readLine()
391 bc_lex_text(BcLex* l, const char* text, BcMode mode) in bc_lex_text() argument
395 assert(l != NULL && text != NULL); in bc_lex_text()
397 bc_lex_fixText(l, text, strlen(text)); in bc_lex_text()
398 l->i = 0; in bc_lex_text()
399 l->t = l->last = BC_LEX_INVALID; in bc_lex_text()
400 l->mode = mode; in bc_lex_text()
402 bc_lex_next(l); in bc_lex_text()