diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-18 00:35:01 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-18 00:35:01 -0400 |
| commit | 4e670c8bca3e1b7db6b0258a6e4b5734a834ad84 (patch) | |
| tree | bffbc11214cc57a6e60b137a28f0879dfde8c9f5 /parse.c | |
| parent | 5a5fc9c031c4aa83b1ebf575ea2c9af1556895ee (diff) | |
Clean up some dead code
Diffstat (limited to 'parse.c')
| -rw-r--r-- | parse.c | 18 |
1 files changed, 4 insertions, 14 deletions
@@ -61,12 +61,11 @@ static const char *keywords[] = { }; enum {NORMAL_FUNCTION=0, EXTERN_FUNCTION=1}; -typedef enum {WHITESPACE_NONE=0, WHITESPACE_SPACES=1, WHITESPACE_NEWLINES=2, WHITESPACE_COMMENTS=4} whitespace_types_e; static inline size_t some_of(const char **pos, const char *allow); static inline size_t some_not(const char **pos, const char *forbid); static inline size_t spaces(const char **pos); -static inline whitespace_types_e whitespace(const char **pos); +static inline void whitespace(const char **pos); static inline size_t match(const char **pos, const char *target); static inline void expect_str(parse_ctx_t *ctx, const char *start, const char **pos, const char *target, const char *fmt, ...); static inline void expect_closing(parse_ctx_t *ctx, const char **pos, const char *target, const char *fmt, ...); @@ -262,18 +261,9 @@ size_t spaces(const char **pos) { return some_of(pos, " \t"); } -whitespace_types_e whitespace(const char **pos) { - whitespace_types_e spaces = WHITESPACE_NONE; - for (;;) { - if (some_of(pos, " \t")) { - spaces |= WHITESPACE_SPACES; - } else if (some_of(pos, "\r\n")) { - spaces |= WHITESPACE_NEWLINES; - } else if (comment(pos)) { - spaces |= WHITESPACE_COMMENTS; - } else break; - } - return spaces; +void whitespace(const char **pos) { + while (some_of(pos, " \t\r\n") || comment(pos)) + continue; } size_t match(const char **pos, const char *target) { |
