]> granicus.if.org Git - yasm/commitdiff
Support .set in GAS parser.
authorPeter Johnson <peter@tortall.net>
Sat, 26 May 2007 17:39:42 +0000 (17:39 -0000)
committerPeter Johnson <peter@tortall.net>
Sat, 26 May 2007 17:39:42 +0000 (17:39 -0000)
Contributed by: Sebastian D'Alessandro <sejawoya@yahoo.com.ar>

svn path=/trunk/yasm/; revision=1850

modules/parsers/gas/gas-parse.c
modules/parsers/gas/tests/bin/Makefile.inc
modules/parsers/gas/tests/bin/gas-set.asm [new file with mode: 0644]
modules/parsers/gas/tests/bin/gas-set.hex [new file with mode: 0644]

index ff78f9e76743b8481ea5cd83e425b68e19fe81b1..45b36c3200b352a03465f16e5d543b55a964d2ed 100644 (file)
@@ -600,6 +600,26 @@ parse_line(yasm_parser_gas *parser_gas)
         }
 
         /* Other directives */
+        case DIR_EQU:
+            /* ID ',' expr */
+            get_next_token(); /* DIR_EQU */
+            if (!expect(ID)) return NULL;
+            id = ID_val;
+            get_next_token(); /* ID */
+            if (!expect(',')) {
+                yasm_xfree(id);
+                return NULL;
+            }
+            get_next_token(); /* ',' */
+            e = parse_expr(parser_gas);
+            if (e)
+                yasm_symtab_define_equ(p_symtab, id, e, cur_line);
+            else
+                yasm_error_set(YASM_ERROR_SYNTAX,
+                               N_("expression expected after `%s'"), ",");
+            yasm_xfree(id);
+            return NULL;
+
         case DIR_FILE:
             get_next_token(); /* DIR_FILE */
             if (curtok == STRING) {
index 93b08f27eadc991b48ec73ab97473e0f1677397d..8132e69ccedeb1f13e243aee98c8dd1674cba28b 100644 (file)
@@ -6,6 +6,8 @@ EXTRA_DIST += modules/parsers/gas/tests/bin/gas_bin_test.sh
 EXTRA_DIST += modules/parsers/gas/tests/bin/gas-comment.asm
 EXTRA_DIST += modules/parsers/gas/tests/bin/gas-comment.errwarn
 EXTRA_DIST += modules/parsers/gas/tests/bin/gas-comment.hex
+EXTRA_DIST += modules/parsers/gas/tests/bin/gas-set.asm
+EXTRA_DIST += modules/parsers/gas/tests/bin/gas-set.hex
 EXTRA_DIST += modules/parsers/gas/tests/bin/rept-err.asm
 EXTRA_DIST += modules/parsers/gas/tests/bin/rept-err.errwarn
 EXTRA_DIST += modules/parsers/gas/tests/bin/reptempty.asm
diff --git a/modules/parsers/gas/tests/bin/gas-set.asm b/modules/parsers/gas/tests/bin/gas-set.asm
new file mode 100644 (file)
index 0000000..24f278f
--- /dev/null
@@ -0,0 +1,2 @@
+.set foo,5
+.byte foo
diff --git a/modules/parsers/gas/tests/bin/gas-set.hex b/modules/parsers/gas/tests/bin/gas-set.hex
new file mode 100644 (file)
index 0000000..f62fa93
--- /dev/null
@@ -0,0 +1 @@
+05