use superior skip_char
This commit is contained in:
parent
85adad9831
commit
0fc7993eb1
34
lexer.c
34
lexer.c
@ -217,28 +217,24 @@ Token lexer_make_string(Lexer* lexer)
|
|||||||
|
|
||||||
void lexer_skip_literal_char(Lexer* lexer)
|
void lexer_skip_literal_char(Lexer* lexer)
|
||||||
{
|
{
|
||||||
if (lexer_current(lexer) == '\\') {
|
if (lexer_current(lexer) != '\\') {
|
||||||
lexer_step(lexer);
|
lexer_step(lexer);
|
||||||
if (!lexer_done(lexer) && lexer_current(lexer) == '0') {
|
return;
|
||||||
|
}
|
||||||
|
lexer_step(lexer);
|
||||||
|
if (lexer_done(lexer))
|
||||||
|
return;
|
||||||
|
char previous = lexer_current(lexer);
|
||||||
|
lexer_step(lexer);
|
||||||
|
if (previous >= '1' && previous <= '9') {
|
||||||
|
while (!lexer_done(lexer) && isdigit(lexer_current(lexer)))
|
||||||
lexer_step(lexer);
|
lexer_step(lexer);
|
||||||
} else if (!lexer_done(lexer) && lexer_current(lexer) >= '1'
|
} else if (previous == 'x' || previous == 'X') {
|
||||||
&& lexer_current(lexer) <= '9') {
|
while (!lexer_done(lexer)
|
||||||
|
&& (isdigit(lexer_current(lexer))
|
||||||
|
|| (lexer_current(lexer) >= 'a' && lexer_current(lexer) <= 'f')
|
||||||
|
|| (lexer_current(lexer) >= 'A' && lexer_current(lexer) <= 'F')))
|
||||||
lexer_step(lexer);
|
lexer_step(lexer);
|
||||||
while (!lexer_done(lexer) && isdigit(lexer_current(lexer)))
|
|
||||||
lexer_step(lexer);
|
|
||||||
} else if (!lexer_done(lexer)
|
|
||||||
&& (lexer_current(lexer) == 'x' || lexer_current(lexer) == 'X')) {
|
|
||||||
lexer_step(lexer);
|
|
||||||
while (!lexer_done(lexer)
|
|
||||||
&& (isdigit(lexer_current(lexer))
|
|
||||||
|| (lexer_current(lexer) >= 'a' && lexer_current(lexer) <= 'f')
|
|
||||||
|| (lexer_current(lexer) >= 'A' && lexer_current(lexer) <= 'F')))
|
|
||||||
lexer_step(lexer);
|
|
||||||
} else if (!lexer_done(lexer)) {
|
|
||||||
lexer_step(lexer);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lexer_step(lexer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user