[gcalctool/gnome-2-28] Fix negative exponential detection e.g. "2e−3" = 0.002



commit 598c3472e3aeb8f9cd0b22880df64593c1c95f05
Author: Robert Ancell <robert ancell gmail com>
Date:   Tue Nov 17 09:50:26 2009 -0600

    Fix negative exponential detection e.g. "2eâ??3" = 0.002

 ChangeLog               |    4 ++++
 src/mp-equation-lexer.l |    2 +-
 src/unittest.c          |    1 +
 3 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 760d1fe..b59113e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,10 @@
 gcalctool change history.
 =========================
 
+2009-11-17 Robert Ancell <robert ancell gmail com>
+
+    * Fix negative exponential detection e.g. "2eâ??3" = 0.002
+
 2009-11-05 Robert Ancell <robert ancell gmail com>
 
     * Only disable trailing zeroes option in basic mode (Bug #600700)
diff --git a/src/mp-equation-lexer.l b/src/mp-equation-lexer.l
index 8d06567..f1f9ecf 100644
--- a/src/mp-equation-lexer.l
+++ b/src/mp-equation-lexer.l
@@ -83,7 +83,7 @@ BIN           {ZERO}|{ONE}
 OCT           {ZERO}|{ONE}|{TWO}|{THREE}|{FOUR}|{FIVE}|{SIX}|{SEVEN}
 DEC           {ZERO}|{ONE}|{TWO}|{THREE}|{FOUR}|{FIVE}|{SIX}|{SEVEN}|{EIGHT}|{NINE}
 HEX           {DEC}|[A-F]|[a-f]
-EXP           "e"|"e+"|"e-"|"E"|"E+"|"E-"
+EXP           "e"|"e+"|"e-"|"eâ??"|"E"|"E+"|"E-"|"Eâ??"
 SI_SUFFIX     "T"|"G"|"M"|"k"|"d"|"c"|"m"|"u"|"µ"|"n"|"p"|"f"
 SUPER_DIGITS  "�"|"¹"|"²"|"³"|"�"|"�"|"�"|"�"|"�"|"�"
 SUB_DIGITS    "â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"
diff --git a/src/unittest.c b/src/unittest.c
index 39ce089..87e266c 100644
--- a/src/unittest.c
+++ b/src/unittest.c
@@ -198,6 +198,7 @@ test_parser()
     test("2e3", "2000", 0);
     test("2e+3", "2000", 0);
     test("2e-3", "0.002", 0);
+    test("2eâ??3", "0.002", 0);
     test("2Ã?10^3", "2000", 0);
     test("2Ã?10^â??3", "0.002", 0);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]