summaryrefslogtreecommitdiffhomepage
path: root/mixlib/mix_scanner.l
diff options
context:
space:
mode:
authorjaortega <jaortega>2000-11-18 12:04:24 +0000
committerjaortega <jaortega>2000-11-18 12:04:24 +0000
commitcf46fd449bd2b7a6ff41ac174c46af5ac41eb509 (patch)
tree275e408fb2835b6b461a327c8af30d0fdf2f8675 /mixlib/mix_scanner.l
parentc70563a847c233deb4ba407c7c52a7ee430e26bc (diff)
downloadmdk-cf46fd449bd2b7a6ff41ac174c46af5ac41eb509.tar.gz
mdk-cf46fd449bd2b7a6ff41ac174c46af5ac41eb509.tar.bz2
fixed 3H ORIG 3B problem (samples/stress{1,2}.mixal)
Diffstat (limited to 'mixlib/mix_scanner.l')
-rw-r--r--mixlib/mix_scanner.l43
1 files changed, 34 insertions, 9 deletions
diff --git a/mixlib/mix_scanner.l b/mixlib/mix_scanner.l
index c6ed5d8..c5529da 100644
--- a/mixlib/mix_scanner.l
+++ b/mixlib/mix_scanner.l
@@ -37,20 +37,28 @@
g_free (symbol); \
symbol = NULL; \
} \
+ if (lsymbol != NULL) \
+ { \
+ g_free (lsymbol); \
+ lsymbol = NULL; \
+ } \
} while (FALSE)
-#define NEXT() \
- do { \
- parser->loc_count++; \
- RESET (); \
- ++lineno; \
- BEGIN (INITIAL); \
+#define NEXT() \
+ do { \
+ if (lsymbol != NULL) \
+ mix_parser_manage_local_symbol (parser,lsymbol, \
+ loc); \
+ parser->loc_count++; \
+ RESET (); \
+ ++lineno; \
+ BEGIN (INITIAL); \
} while (FALSE)
#define ADD_INS() \
do { \
mix_parser_add_ins (parser, &ins, lineno); \
- NEXT (); \
+ NEXT (); \
} while (FALSE)
#define ADD_RAW(value) \
@@ -140,7 +148,8 @@ wexpr {expr}({fpart})?(,{expr}({fpart})?)*
gboolean nof = FALSE, is_fp = FALSE, end = FALSE, lsf = FALSE;
mix_word_t expr_val = MIX_WORD_ZERO, wexpr_val = MIX_WORD_ZERO,
wexpr_val_tmp = MIX_WORD_ZERO;
- gchar *symbol = NULL;
+ gchar *symbol = NULL, *lsymbol = NULL;
+ mix_address_t loc = MIX_SHORT_ZERO;
guint lineno = 1;
mix_ins_fill_from_id (ins, mix_NOP);
ins.address = 0;
@@ -172,9 +181,25 @@ wexpr {expr}({fpart})?(,{expr}({fpart})?)*
<LOC>{
{ws}+ BEGIN (OP); /* LOC field is empty */
{locsymbol} { /* manage local symbol */
- mix_parser_manage_local_symbol (parser,yytext);
+ loc = get_ploc_ (parser);
+ lsymbol = g_strdup (yytext);
+ if ( lsymbol == NULL ) {
+ mix_parser_log_error (parser, MIX_PERR_INTERNAL, lineno, NULL, FALSE);
+ return MIX_PERR_INTERNAL;
+ }
BEGIN (OP);
}
+ {locsymbol}/({ws}+EQU) {/* local symbol with value */
+ loc = get_ploc_ (parser);
+ symbol = g_strdup (yytext);
+ lsymbol = g_strdup (yytext);
+ if ( symbol == NULL || lsymbol == NULL) {
+ mix_parser_log_error (parser, MIX_PERR_INTERNAL, lineno, NULL, FALSE);
+ return MIX_PERR_INTERNAL;
+ }
+ symbol[1] = 'B'; /* this will be referred as nB afterwards */
+ BEGIN (OP);
+ }
{flocsymbol}|{blocsymbol} RETURN_ERROR (MIX_PERR_UNEX_LOC, yytext);
{symbol}/({ws}+EQU) { /* store symbol name for future definition */
symbol = g_strdup (yytext);