--- freem/src/operator.c 2025/05/05 22:52:32 1.9
+++ freem/src/operator.c 2025/05/05 23:09:19 1.11
@@ -1,5 +1,5 @@
/*
- * $Id: operator.c,v 1.9 2025/05/05 22:52:32 snw Exp $
+ * $Id: operator.c,v 1.11 2025/05/05 23:09:19 snw Exp $
* operators pattern-match, divide, multiply, add, power
*
*
@@ -24,6 +24,12 @@
* along with FreeM. If not, see .
*
* $Log: operator.c,v $
+ * Revision 1.11 2025/05/05 23:09:19 snw
+ * Revert errors in E notation parsing
+ *
+ * Revision 1.10 2025/05/05 23:02:39 snw
+ * More fixes around E notation
+ *
* Revision 1.9 2025/05/05 22:52:32 snw
* Make E notation error message more appropriate
*
@@ -47,6 +53,7 @@
#include "mpsdef.h"
#include
#include
+#include
int unit (char *str);
extern void cond_round (char *a, int digits); /* defined in expr.c */
@@ -1979,17 +1986,34 @@ int numlit (char *str)
}
continue;
}
- if (expflg) {
+ if (expflg) {
if (ch == MINUS) {
- if (str[i + 1] == '-') {
+ /* TODO: revisit this; it breaks string coercion
+ if (str[i + 1] == '-') {
+ merr_raise (INVEXPR);
+ return (0);
+ }
+ if (!isdigit (str[i + 1])) {
merr_raise (INVEXPR);
return (0);
}
+ */
expflg = (-expflg);
continue;
}
- if (ch == PLUS)
+ if (ch == PLUS) {
+ /* TODO: revisit this; it breaks string coercion
+ if (str[i + 1] == '+') {
+ merr_raise (INVEXPR);
+ return (0);
+ }
+ if (!isdigit (str[i + 1])) {
+ merr_raise (INVEXPR);
+ return (0);
+ }
+ */
continue;
+ }
}
if ((result = unit (&str[i])))
ch = str[i] = EOL;