summaryrefslogtreecommitdiffstats
path: root/dimension
diff options
context:
space:
mode:
Diffstat (limited to 'dimension')
-rw-r--r--dimension/lexer.l16
-rw-r--r--dimension/tokenize.c10
2 files changed, 11 insertions, 15 deletions
diff --git a/dimension/lexer.l b/dimension/lexer.l
index cd02da1..eb5184c 100644
--- a/dimension/lexer.l
+++ b/dimension/lexer.l
@@ -285,17 +285,11 @@ dmnsn_tokenize(FILE *file, const char *filename)
while ((token.type = dmnsn_yylex_impl(&item, &location, filename, scanner))
!= 0) {
- if (token.type == DMNSN_T_LEX_ERROR) {
- dmnsn_delete_tokens(tokens);
- tokens = NULL;
- break;
- } else {
- token.value = item.value;
- token.filename = location.first_filename;
- token.line = location.first_line;
- token.col = location.first_column;
- dmnsn_array_push(tokens, &token);
- }
+ token.value = item.value;
+ token.filename = location.first_filename;
+ token.line = location.first_line;
+ token.col = location.first_column;
+ dmnsn_array_push(tokens, &token);
}
yylex_destroy(scanner);
diff --git a/dimension/tokenize.c b/dimension/tokenize.c
index 8e696ed..cc912b6 100644
--- a/dimension/tokenize.c
+++ b/dimension/tokenize.c
@@ -263,9 +263,6 @@ dmnsn_if_buffer(int token, dmnsn_token_buffer *prev,
"syntax error, unexpected end-of-file");
dmnsn_delete_token_buffer(tbuffer);
return NULL;
- } else if (buffered.type == DMNSN_T_LEX_ERROR) {
- dmnsn_delete_token_buffer(tbuffer);
- return NULL;
}
switch (buffered.type) {
@@ -294,7 +291,12 @@ dmnsn_if_buffer(int token, dmnsn_token_buffer *prev,
}
if (cond) {
- dmnsn_array_push(tbuffer->buffered, &buffered);
+ if (buffered.type == DMNSN_T_LEX_ERROR) {
+ dmnsn_delete_token_buffer(tbuffer);
+ return NULL;
+ } else {
+ dmnsn_array_push(tbuffer->buffered, &buffered);
+ }
} else {
free(buffered.lval.value);
}