Skip to content

Commit 8d7ebbb

Browse files
authored
Merge pull request #74 from giacomo-b/ctype
Accepted upper case letters
2 parents 779052b + 1ca3587 commit 8d7ebbb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tinyexpr.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ For log = natural log uncomment the next line. */
3939
#include <math.h>
4040
#include <string.h>
4141
#include <stdio.h>
42+
#include <ctype.h>
4243
#include <limits.h>
4344

4445
#ifndef NAN
@@ -245,8 +246,8 @@ void next_token(state *s) {
245246
if (s->next[0] >= 'a' && s->next[0] <= 'z') {
246247
const char *start;
247248
start = s->next;
248-
while ((s->next[0] >= 'a' && s->next[0] <= 'z') || (s->next[0] >= '0' && s->next[0] <= '9') || (s->next[0] == '_')) s->next++;
249-
249+
while (isalpha(s->next[0]) || isdigit(s->next[0]) || (s->next[0] == '_')) s->next++;
250+
250251
const te_variable *var = find_lookup(s, start, s->next - start);
251252
if (!var) var = find_builtin(start, s->next - start);
252253

0 commit comments

Comments
 (0)