From 8782928ff807c49c921945109538e118e22e4590 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 11 Jun 2024 00:18:25 +0200 Subject: Formatting --- src/lexer.c | 20 ++++---------------- src/lexer.h | 36 ++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/lexer.c b/src/lexer.c index 4df1e52..4a71746 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -44,21 +44,9 @@ lexstring(const uchar *code, size_t codesz) switch (ch) { /* Single-byte literals */ - case '&': - case '(': - case ')': - case '*': - case '+': - case '-': - case ':': - case ';': - case '=': - case '[': - case ']': - case '{': - case '|': - case '}': - case '~': + case '&': case '(': case ')': case '*': case '+': + case '-': case ':': case ';': case '=': case '[': + case ']': case '{': case '|': case '}': case '~': data.kinds[data.len++] = ch; break; @@ -143,7 +131,7 @@ mk_lexemes_soa(void) static_assert(offsetof(struct lexemes_soa, kinds) < offsetof(struct lexemes_soa, strs), "KINDS is not the first field before STRS"); - static_assert((LEXEMES_DFLT_CAP * sizeof(*soa.kinds) % alignof(*soa.strs)) + static_assert(LEXEMES_DFLT_CAP * sizeof(*soa.kinds) % alignof(*soa.strs) == 0, "Additional padding is required to properly align STRS"); diff --git a/src/lexer.h b/src/lexer.h index e2862bb..7fd8533 100644 --- a/src/lexer.h +++ b/src/lexer.h @@ -7,26 +7,26 @@ #include "types.h" enum { - LEXIDENT, + LEXIDENT, /* Identifier */ - LEXAMP = '&', - LEXCOLON = ':', - LEXEQ = '=', - LEXLANGL = '<', + LEXAMP = '&', + LEXCOLON = ':', + LEXEQ = '=', + LEXLANGL = '<', LEXLBRACE = '{', - LEXLBRKT = '[', - LEXLPAR = '(', - LEXMINUS = '-', - LEXPIPE = '|', - LEXPLUS = '+', - LEXRANGL = '>', + LEXLBRKT = '[', + LEXLPAR = '(', + LEXMINUS = '-', + LEXPIPE = '|', + LEXPLUS = '+', + LEXRANGL = '>', LEXRBRACE = '}', - LEXRBRKT = ']', - LEXRPAR = ')', - LEXSEMI = ';', - LEXSLASH = '/', - LEXSTAR = '*', - LEXTILDE = '~', + LEXRBRKT = ']', + LEXRPAR = ')', + LEXSEMI = ';', + LEXSLASH = '/', + LEXSTAR = '*', + LEXTILDE = '~', /* We keep these exactly 2 away from each other, because ‘<’ and ‘>’ are 2 away from each other in ASCII. This gives us a simple mapping from some @@ -45,7 +45,7 @@ struct lexemes_soa { size_t len, cap; }; -#define lexemes_free(x) free(x.kinds) +#define lexemes_free(x) free((x).kinds) struct lexemes_soa lexstring(const uchar *, size_t); -- cgit v1.2.3