remove usage of goto
This commit is contained in:
parent
c984c94ac8
commit
c1d54991c0
1 changed files with 2 additions and 4 deletions
|
@ -265,7 +265,7 @@ string_literal(LexState *ls)
|
||||||
while (chr.val != '"') {
|
while (chr.val != '"') {
|
||||||
if (i + 1 == STRING_LITERAL_MAX_SIZE) {
|
if (i + 1 == STRING_LITERAL_MAX_SIZE) {
|
||||||
lex_error(ls, "string literal length exceeds maximum of %d bytes", STRING_LITERAL_MAX_SIZE);
|
lex_error(ls, "string literal length exceeds maximum of %d bytes", STRING_LITERAL_MAX_SIZE);
|
||||||
goto err;
|
return make_error();
|
||||||
}
|
}
|
||||||
if (i + 1 > str_buf_len) {
|
if (i + 1 > str_buf_len) {
|
||||||
str_buf = realloc(str_buf, str_buf_len *= 2);
|
str_buf = realloc(str_buf, str_buf_len *= 2);
|
||||||
|
@ -274,7 +274,7 @@ string_literal(LexState *ls)
|
||||||
chr = read_chr(ls);
|
chr = read_chr(ls);
|
||||||
if (!chr.ok || chr.val == '\n') {
|
if (!chr.ok || chr.val == '\n') {
|
||||||
lex_error(ls, "unterminated string literal");
|
lex_error(ls, "unterminated string literal");
|
||||||
goto err;
|
return make_error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
|
@ -288,8 +288,6 @@ string_literal(LexState *ls)
|
||||||
token.str = Str_from_buf(str_buf, i);
|
token.str = Str_from_buf(str_buf, i);
|
||||||
token.len = i;
|
token.len = i;
|
||||||
return token;
|
return token;
|
||||||
err:
|
|
||||||
return make_error();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Identifies a numeric literal that may have a prefix:
|
/* Identifies a numeric literal that may have a prefix:
|
||||||
|
|
Loading…
Add table
Reference in a new issue