summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Johnson <peter@tortall.net>2008-10-30 07:36:25 +0000
committerPeter Johnson <peter@tortall.net>2008-10-30 07:36:25 +0000
commitbb1aaf9efd64c6d1df378111f9ddd3a9a96f49a1 (patch)
treead3fa74aa87f6e5bf731f01f0438e3b889099c59
parent7b901e3596309180400de5e5c30421abf3a3af55 (diff)
downloadyasm-bb1aaf9efd64c6d1df378111f9ddd3a9a96f49a1.tar.gz
Fix #161: Don't require 0d/0e/0f/0t prefix on floating point numbers.
While this is not mentioned in the GAS documentation, GAS doesn't require it. svn path=/trunk/yasm/; revision=2158
-rw-r--r--modules/parsers/gas/gas-token.re16
-rw-r--r--modules/parsers/gas/tests/Makefile.inc2
-rw-r--r--modules/parsers/gas/tests/gas-float.asm2
-rw-r--r--modules/parsers/gas/tests/gas-float.hex376
4 files changed, 395 insertions, 1 deletions
diff --git a/modules/parsers/gas/gas-token.re b/modules/parsers/gas/gas-token.re
index c08da11a..0ac61f12 100644
--- a/modules/parsers/gas/gas-token.re
+++ b/modules/parsers/gas/gas-token.re
@@ -350,7 +350,21 @@ scan:
}
/* floating point value */
- "0" [DdEeFfTt] [-+]? (digit+)? ("." digit*)? ('e' [-+]? digit+)? {
+ [-+]? digit* "." digit+ ('e' [-+]? digit+)? {
+ savech = s->tok[TOKLEN];
+ s->tok[TOKLEN] = '\0';
+ lvalp->flt = yasm_floatnum_create(TOK);
+ s->tok[TOKLEN] = savech;
+ RETURN(FLTNUM);
+ }
+ [-+]? digit+ "." digit* ('e' [-+]? digit+)? {
+ savech = s->tok[TOKLEN];
+ s->tok[TOKLEN] = '\0';
+ lvalp->flt = yasm_floatnum_create(TOK);
+ s->tok[TOKLEN] = savech;
+ RETURN(FLTNUM);
+ }
+ "0" [DdEeFfTt] [-+]? digit* ("." digit*)? ('e' [-+]? digit+)? {
savech = s->tok[TOKLEN];
s->tok[TOKLEN] = '\0';
lvalp->flt = yasm_floatnum_create(TOK+2);
diff --git a/modules/parsers/gas/tests/Makefile.inc b/modules/parsers/gas/tests/Makefile.inc
index 44827334..756e3251 100644
--- a/modules/parsers/gas/tests/Makefile.inc
+++ b/modules/parsers/gas/tests/Makefile.inc
@@ -14,6 +14,8 @@ EXTRA_DIST += modules/parsers/gas/tests/execsect.asm
EXTRA_DIST += modules/parsers/gas/tests/execsect.hex
EXTRA_DIST += modules/parsers/gas/tests/gas-fill.asm
EXTRA_DIST += modules/parsers/gas/tests/gas-fill.hex
+EXTRA_DIST += modules/parsers/gas/tests/gas-float.asm
+EXTRA_DIST += modules/parsers/gas/tests/gas-float.hex
EXTRA_DIST += modules/parsers/gas/tests/gas-instlabel.asm
EXTRA_DIST += modules/parsers/gas/tests/gas-instlabel.hex
EXTRA_DIST += modules/parsers/gas/tests/gas-line-err.asm
diff --git a/modules/parsers/gas/tests/gas-float.asm b/modules/parsers/gas/tests/gas-float.asm
new file mode 100644
index 00000000..7101eed6
--- /dev/null
+++ b/modules/parsers/gas/tests/gas-float.asm
@@ -0,0 +1,2 @@
+.double 0.1
+.double -.0
diff --git a/modules/parsers/gas/tests/gas-float.hex b/modules/parsers/gas/tests/gas-float.hex
new file mode 100644
index 00000000..4daadf4c
--- /dev/null
+++ b/modules/parsers/gas/tests/gas-float.hex
@@ -0,0 +1,376 @@
+7f
+45
+4c
+46
+01
+01
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+03
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+b0
+00
+00
+00
+00
+00
+00
+00
+34
+00
+00
+00
+00
+00
+28
+00
+05
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+9a
+99
+99
+99
+99
+99
+b9
+3f
+00
+00
+00
+00
+00
+00
+00
+80
+00
+2e
+74
+65
+78
+74
+00
+2e
+73
+74
+72
+74
+61
+62
+00
+2e
+73
+79
+6d
+74
+61
+62
+00
+2e
+73
+68
+73
+74
+72
+74
+61
+62
+00
+00
+00
+00
+00
+2d
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+01
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+04
+00
+f1
+ff
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+03
+00
+04
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+17
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+50
+00
+00
+00
+21
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+07
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+74
+00
+00
+00
+03
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+0f
+00
+00
+00
+02
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+78
+00
+00
+00
+30
+00
+00
+00
+02
+00
+00
+00
+03
+00
+00
+00
+04
+00
+00
+00
+10
+00
+00
+00
+01
+00
+00
+00
+01
+00
+00
+00
+06
+00
+00
+00
+00
+00
+00
+00
+40
+00
+00
+00
+10
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+00
+10
+00
+00
+00
+00
+00
+00
+00