From 1ca3587ffab64b7a73292023576224e72154b20f Mon Sep 17 00:00:00 2001 From: giacomo-b <38355805+giacomo-b@users.noreply.github.com> Date: Wed, 3 Mar 2021 20:08:39 +0100 Subject: [PATCH] Accepted upper case letters Introduced isalpha() from to check if a character belongs to the alphabet. Previously, only lower case letters were allowed. --- tinyexpr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tinyexpr.c b/tinyexpr.c index 4facfbc..4c0971e 100755 --- a/tinyexpr.c +++ b/tinyexpr.c @@ -39,6 +39,7 @@ For log = natural log uncomment the next line. */ #include #include #include +#include #include #ifndef NAN @@ -245,8 +246,8 @@ void next_token(state *s) { if (s->next[0] >= 'a' && s->next[0] <= 'z') { const char *start; start = s->next; - while ((s->next[0] >= 'a' && s->next[0] <= 'z') || (s->next[0] >= '0' && s->next[0] <= '9') || (s->next[0] == '_')) s->next++; - + while (isalpha(s->next[0]) || isdigit(s->next[0]) || (s->next[0] == '_')) s->next++; + const te_variable *var = find_lookup(s, start, s->next - start); if (!var) var = find_builtin(start, s->next - start);