diff options
Diffstat (limited to 'src/wmap_parser.c')
| -rw-r--r-- | src/wmap_parser.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/wmap_parser.c b/src/wmap_parser.c index e0cf6d6..0fa8427 100644 --- a/src/wmap_parser.c +++ b/src/wmap_parser.c @@ -1,5 +1,9 @@ #include "wmap_parser.h" +/* Forward declarations for older compilers */ +static int wmap_lexer_is_identifier_char(char c); +static int wmap_lexer_is_keyword(const char* text, const char* keyword); + static void wmap_lexer_init(wmap_lexer_t* lexer, const char* input) { lexer->input = input; lexer->pos = 0; @@ -18,7 +22,7 @@ static void wmap_lexer_skip_whitespace(wmap_lexer_t* lexer) { } } -WMAP_68K_INLINE int wmap_lexer_is_identifier_char(char c) WMAP_68K_FAST_CALL { +static int wmap_lexer_is_identifier_char(char c) { return c != '-' && c != '+' && c != ',' && c != '[' && c != ']' && c != '(' && c != ')' && c != '\n' && c != '\r' && c != '\0' && c != ' ' && c != '\t'; } @@ -104,7 +108,7 @@ static wmap_token_type_t wmap_lexer_next_token(wmap_lexer_t* lexer) { } } - if (isdigit(c) || c == '.') { + if (isdigit((unsigned char)c) || c == '.') { start = lexer->pos; has_dot = 0; @@ -112,12 +116,12 @@ static wmap_token_type_t wmap_lexer_next_token(wmap_lexer_t* lexer) { has_dot = 1; lexer->pos++; lexer->col++; - if (!isdigit(lexer->input[lexer->pos])) { + if (!isdigit((unsigned char)lexer->input[lexer->pos])) { return lexer->current_token = WMAP_TOKEN_ERROR; } } - while (isdigit(lexer->input[lexer->pos])) { + while (isdigit((unsigned char)lexer->input[lexer->pos])) { lexer->pos++; lexer->col++; } @@ -126,7 +130,7 @@ static wmap_token_type_t wmap_lexer_next_token(wmap_lexer_t* lexer) { has_dot = 1; lexer->pos++; lexer->col++; - while (isdigit(lexer->input[lexer->pos])) { + while (isdigit((unsigned char)lexer->input[lexer->pos])) { lexer->pos++; lexer->col++; } @@ -169,7 +173,7 @@ static wmap_token_type_t wmap_lexer_next_token(wmap_lexer_t* lexer) { return lexer->current_token = WMAP_TOKEN_ERROR; } -WMAP_68K_INLINE int wmap_lexer_is_keyword(const char* text, const char* keyword) WMAP_68K_FAST_CALL { +static int wmap_lexer_is_keyword(const char* text, const char* keyword) { int i = 0; while (text[i] && keyword[i]) { char tc = text[i]; |