WIP: major error handling refactoring

switching to setjmp instead of the really bad global 'panic' flag
This commit is contained in:
2023-08-28 21:13:00 -05:00
committed by cpunch
parent 3f39211081
commit 75d27afe2c
7 changed files with 86 additions and 104 deletions

View File

@@ -389,9 +389,8 @@ static CToken parseIdentifier(CLexState *state)
return makeToken(state, identifierType(state)); // is it a reserved word?
}
CLexState *cosmoL_newLexState(CState *cstate, const char *source)
void cosmoL_initLexState(CState *cstate, CLexState *state, const char *source)
{
CLexState *state = cosmoM_xmalloc(cstate, sizeof(CLexState));
state->startChar = (char *)source;
state->currentChar = (char *)source;
state->line = 1;
@@ -400,13 +399,11 @@ CLexState *cosmoL_newLexState(CState *cstate, const char *source)
state->cstate = cstate;
resetBuffer(state);
return state;
}
void cosmoL_freeLexState(CState *state, CLexState *lstate)
void cosmoL_cleanupLexState(CState *state, CLexState *lstate)
{
cosmoM_free(state, CLexState, lstate);
// stubbed
}
CToken cosmoL_scanToken(CLexState *state)