nooc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/nooc
Log | Files | Refs | LICENSE

commit c5981f652f6e524c8b3520015410052efa95eaf4
parent 3b8dd3de1d3ca7a1cf2a25a1a457e5a940e44b93
Author: Nihal Jere <nihal@nihaljere.xyz>
Date:   Tue,  7 Dec 2021 16:44:12 -0600

move whitespace cases to top

Diffstat:
Mmain.c | 20++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/main.c b/main.c @@ -41,6 +41,18 @@ lex(struct slice start) struct token *cur = head; while (start.len) { + if (isblank(*start.data)) { + ADVANCE(1); + continue; + } + + if (*start.data == '\n') { + ADVANCE(1); + line += 1; + col = 1; + continue; + } + if (slice_cmplit(&start, "if") == 0) { cur->type = TOK_IF; ADVANCE(2); @@ -53,9 +65,6 @@ lex(struct slice start) } else if (slice_cmplit(&start, "loop") == 0) { cur->type = TOK_LOOP; ADVANCE(4); - } else if (isblank(*start.data)) { - ADVANCE(1); - continue; } else if (*start.data == '>') { cur->type = TOK_GREATER; ADVANCE(1); @@ -93,11 +102,6 @@ lex(struct slice start) } ADVANCE(1); - } else if (*start.data == '\n') { - ADVANCE(1); - line += 1; - col = 1; - continue; } else if (*start.data == '+') { cur->type = TOK_PLUS; ADVANCE(1);