move expression to func

This commit is contained in:
tocariimaa 2025-01-19 19:32:01 -03:00
parent c1d54991c0
commit ea75f19804

View file

@ -121,6 +121,14 @@ peek(LexState *ls)
return *ls->fwd; return *ls->fwd;
} }
/* Moves the forward pointer and the column count by one */
static void
next(LexState *ls)
{
++ls->fwd;
++ls->cur_loc.column;
}
static void static void
backup(LexState *ls, int n) backup(LexState *ls, int n)
{ {
@ -460,8 +468,7 @@ lex_scan(LexState *ls)
case '!': case '!':
if (peek(ls) == '=') { if (peek(ls) == '=') {
token.id = T_NOTEQUAL; token.id = T_NOTEQUAL;
++ls->fwd; next(ls);
++ls->cur_loc.column;
} else { } else {
token.id = T_EXCLAMATION; token.id = T_EXCLAMATION;
} }
@ -485,8 +492,7 @@ lex_scan(LexState *ls)
case '=': case '=':
if (peek(ls) == '=') { if (peek(ls) == '=') {
token.id = T_LOGICEQUAL; token.id = T_LOGICEQUAL;
++ls->fwd; next(ls);
++ls->cur_loc.column;
} else { } else {
token.id = T_EQUAL; token.id = T_EQUAL;
} }