Commit 8edb3378 authored by Guillaume Charifi's avatar Guillaume Charifi

compiler/lexer: Sort token handlers.

Dramatically decreases algorithmic complexity.
parent b0b22974
......@@ -88,6 +88,8 @@ int main(int argc, char **argv)
wprintf(L"%ls\n", prog);
lexer_init();
lexer_status = lexer((const wchar_t *)prog, &lexer_out);
if (lexer_status < 0)
{
......@@ -113,6 +115,8 @@ free_exit:
if (lexer_status == 0)
lexer_destroy(&lexer_out);
lexer_fini();
if (prog)
free(prog);
......
This diff is collapsed.
......@@ -39,5 +39,7 @@ extern int token_deinit(struct bm_token *token);
extern int token_replace(struct lexer_output *out, unsigned long id, struct bm_token *token);
extern int lexer(const wchar_t *in, struct lexer_output *out);
extern int lexer_destroy(struct lexer_output *out);
extern int lexer_init(void);
extern int lexer_fini(void);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment