summaryrefslogtreecommitdiffstats
path: root/4/10.c
diff options
context:
space:
mode:
Diffstat (limited to '4/10.c')
-rw-r--r--4/10.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/4/10.c b/4/10.c
index 36f038a..39119d2 100644
--- a/4/10.c
+++ b/4/10.c
@@ -116,19 +116,29 @@ int getop(char s[]) {
s[1] = 0;
// special characters and operators
- if (c == 0 || c == '+' || c == '*' || c == '/' || c == '%' || c == '=' ||
+ if (c == 0 || c == '+' || c == '*' || c == '/' || c == '%' ||
(c == '-' && isdigit(line[idx + 1])) || c == EOF)
return c;
i = 0;
-
+
if (isdigit(c) || c == '-' || (c == '.' && isdigit(line[idx + 1]))) {
- while (isdigit((s[++i] = c = line[idx++])) || (c == '.' && isdigit(line[idx + 1])))
+ while (isdigit((s[++i] = c = line[idx++])) ||
+ (c == '.' && isdigit(line[idx + 1])))
;
return NUM;
}
-
+ if (isalpha(c) && line[idx + 1] == ' ' && line[idx + 2] == '=') {
+ idx += 2;
+ return '=';
+ }
+
+ while (isalnum(s[++i] = c = line[idx++]))
+ ;
+ s[i] = 0;
+
+ return strcmp("LOUT", s) == 0 ? VAR : FUN;
}
int sp = 0;