aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--whichbas.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/whichbas.c b/whichbas.c
index 0aeb5d1..54a4f03 100644
--- a/whichbas.c
+++ b/whichbas.c
@@ -163,6 +163,8 @@ int is_numeric_func(unsigned char tok) {
/* return true if a token is an arithmetic operator */
int is_arith_op(unsigned char tok) {
switch(tok) {
+ case OP_UPLUS: /* not sure these two... */
+ case OP_UMINUS: /* ...really belong here */
case OP_NUM_LE:
case OP_NUM_NE:
case OP_NUM_GE:
@@ -178,8 +180,6 @@ int is_arith_op(unsigned char tok) {
case OP_OR:
case OP_AND:
case OP_NUM_ASSIGN:
- case OP_UPLUS:
- case OP_UMINUS:
case OP_GRP_LPAR: /* yes, this belongs here, (((A$))) is a syntax error! */
return 1;
default:
@@ -200,18 +200,32 @@ int is_numeric_var(unsigned char tok) {
/* return true if a token is:
- a numeric constant (including hex constants),
- a numeric variable (including arrays),
- - a math operator (plus, minus, etc),
- a function that returns a numeric (e.g. ASC(), SIN()).
for now, only standard Atari BASIC tokens are considered.
+ unary minus and plus make sense here, but binary ops don't.
*/
-int is_numeric_op(unsigned char tok) {
+int is_numeric_rval(unsigned char tok) {
return
+ (tok == OP_UMINUS) ||
+ (tok == OP_UPLUS) ||
is_numconst_op (tok) ||
- is_arith_op (tok) ||
is_numeric_func (tok) ||
is_numeric_var (tok) ;
}
+/* return true if a token is:
+ - a numeric constant (including hex constants),
+ - a numeric variable (including arrays),
+ - a math operator (plus, minus, etc),
+ - a function that returns a numeric (e.g. ASC(), SIN()).
+ for now, only standard Atari BASIC tokens are considered.
+ */
+int is_numeric_op(unsigned char tok) {
+ return
+ is_numeric_rval (tok) ||
+ is_arith_op (tok) ;
+}
+
int is_string_var(unsigned char tok) {
return (tok >= 0x80 && (get_vartype(tok) == TYPE_STRING));
}