summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjaortega <jaortega>2000-12-30 02:15:54 +0000
committerjaortega <jaortega>2000-12-30 02:15:54 +0000
commit1b48163d8b757b5ed0b377ea6b11a30d7b70e891 (patch)
treed58476084b2d9f64a0b18173dc2cf26245becb93
parentee41f92e693815835d65f4675728b1be2336721b (diff)
downloadmdk-1b48163d8b757b5ed0b377ea6b11a30d7b70e891.tar.gz
mdk-1b48163d8b757b5ed0b377ea6b11a30d7b70e891.tar.bz2
corrected handling of successive * in expressions
-rw-r--r--mixlib/mix_eval_scanner.l29
1 files changed, 19 insertions, 10 deletions
diff --git a/mixlib/mix_eval_scanner.l b/mixlib/mix_eval_scanner.l
index af7fd67..7f759d9 100644
--- a/mixlib/mix_eval_scanner.l
+++ b/mixlib/mix_eval_scanner.l
@@ -1,7 +1,7 @@
/* -*-c-*- ------------------ mix_eval_scanner.l :
* scanner used by mix_eval_t
* ------------------------------------------------------------------
- * Last change: Time-stamp: <00/12/03 11:33:21 jose>
+ * Last change: Time-stamp: <00/12/30 03:11:51 jose>
* ------------------------------------------------------------------
* Copyright (C) 2000 jose antonio ortega ruiz <jaortega@acm.org>
*
@@ -73,7 +73,8 @@ locsymbol {digit}H
flocsymbol {digit}F
blocsymbol {digit}B
symbol {digit}*{letter}+[A-Z0-9]*
-binop "+"|"-"|"*"|"/"|"//"|":"
+binops "+"|"-"|"/"|"//"|":"
+binop {binops}|"*"
atexpr {digit}+|{symbol}|\*
expr [+-]?{atexpr}({binop}{1}{atexpr})*
fpart \({expr}\)
@@ -145,10 +146,23 @@ wexpr {expr}({fpart})?(,{expr}({fpart})?)*
wexpr_val);
}
}
- {number} {
+ {number}/({ws}*\n) {
wexpr_val = mix_word_new (atol (yytext));
}
- {expr} yypos -= yyleng; yyless (0); yy_push_state (EVAL);
+ {expr}/({ws}*\n) {
+ if (yytext[0] != '*')
+ {
+ yypos -= yyleng;
+ yyless (0);
+ }
+ else
+ {
+ yypos -= yyleng - 1;
+ expr_val = mix_short_to_word_fast (data->loc);
+ yyless (1);
+ }
+ yy_push_state (EVAL);
+ }
,/{expr} /* eat comma if followed by expression */
[\t\n ] { /* ok if not inside an f-part */
if ( is_fp ) {
@@ -175,16 +189,11 @@ wexpr {expr}({fpart})?(,{expr}({fpart})?)*
expr_val = eval_binop_ (yytext, expr_val,
mix_symbol_table_value (data->table, s));
}
- "***" {
- mix_word_t loc = mix_short_to_word_fast (data->loc);
- (void)mix_word_mul (loc, loc, NULL, &loc);
- yypos -= unput_word_ (loc);
- }
{binop}"*" {
expr_val = eval_binop_ (yytext, expr_val,
mix_short_to_word_fast (data->loc));
}
- "*" yypos -= unput_word_ (mix_short_to_word_fast (data->loc));
+ "*" yypos -= unput_word_ (mix_short_to_word_fast (data->loc));
{number} expr_val = mix_word_new (atol (yytext));
{symbol} {
if ( !mix_symbol_table_is_defined (data->table, yytext) ) {