[gcalctool] Allow hexadecimal numbers to be entered in lower-case



commit 32a509cd771d7c8fb12a3b705a45ee0111aaeaa6
Author: Robert Ancell <robert ancell gmail com>
Date:   Thu Feb 25 09:06:24 2010 +1100

    Allow hexadecimal numbers to be entered in lower-case

 NEWS                    |    4 +++-
 src/mp-equation-lexer.l |    2 +-
 src/unittest.c          |    6 ++++++
 3 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index c4ec1da..51711bf 100644
--- a/NEWS
+++ b/NEWS
@@ -14,7 +14,9 @@ Overview of changes in gcalctool 5.29.92
       
     * Only allow superscript minus to be entered if can make a valid superscript
       number, otherwise revert to standard minus.
- 
+
+    * Allow hexadecimal numbers to be entered in lower-case
+
 Overview of changes in gcalctool 5.29.91
 
     * Fix bug where backspace deletes all input in locales with no thousands
diff --git a/src/mp-equation-lexer.l b/src/mp-equation-lexer.l
index d13f006..1c660fe 100644
--- a/src/mp-equation-lexer.l
+++ b/src/mp-equation-lexer.l
@@ -48,7 +48,7 @@ EIGHT         "8"|"Ù¨"|"Û¸"|"ß?"|"८"|"৮"|"à©®"|"à«®"|"à­®"|"௮"|"à±®"|"à³®"
 NINE          "9"|"Ù©"|"Û¹"|"ß?"|"९"|"৯"|"੯"|"૯"|"à­¯"|"௯"|"౯"|"೯"|"൯"|"à¹?"|"à»?"|"༩"|"á??"|"á??"|"á?©"|"á ?"|"á¥?"|"á§?"|"á­?"|"᮹"|"á±?"|"á±?"|"ê?©"|"ê£?"|"ê¤?"|"ê©?"|"ð??©"
 DECIMAL	      "."|","
 DEC           {ZERO}|{ONE}|{TWO}|{THREE}|{FOUR}|{FIVE}|{SIX}|{SEVEN}|{EIGHT}|{NINE}
-HEX           {DEC}|[A-F]
+HEX           {DEC}|[A-F]|[a-f]
 SUPER_DIGITS  "�"|"¹"|"²"|"³"|"�"|"�"|"�"|"�"|"�"|"�"
 SUPER_MINUS   "â?»"
 SUB_DIGITS    "â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"
diff --git a/src/unittest.c b/src/unittest.c
index 15b0059..62c637e 100644
--- a/src/unittest.c
+++ b/src/unittest.c
@@ -122,6 +122,12 @@ test_parser()
     test("Dâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("Dâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("D", "", PARSER_ERR_UNKNOWN_VARIABLE); test("Dâ??â??", "13", 0);
     test("Eâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("Eâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("E", "", PARSER_ERR_UNKNOWN_VARIABLE); test("Eâ??â??", "14", 0);
     test("Fâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("Fâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("F", "", PARSER_ERR_UNKNOWN_VARIABLE); test("Fâ??â??", "15", 0);
+    test("aâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("aâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("a", "", PARSER_ERR_UNKNOWN_VARIABLE); test("aâ??â??", "10", 0);
+    test("bâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("bâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("b", "", PARSER_ERR_UNKNOWN_VARIABLE); test("bâ??â??", "11", 0);
+    test("câ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("câ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("c", "", PARSER_ERR_UNKNOWN_VARIABLE); test("câ??â??", "12", 0);
+    test("dâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("dâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("d", "", PARSER_ERR_UNKNOWN_VARIABLE); test("dâ??â??", "13", 0);
+    test("eâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("eâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); /* e is a built-in variable */              test("eâ??â??", "14", 0);
+    test("fâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("fâ??", "", PARSER_ERR_UNKNOWN_VARIABLE); test("f", "", PARSER_ERR_UNKNOWN_VARIABLE); test("fâ??â??", "15", 0);
 
     test("+1", "1", 0);
     test("â??1", "â??1", 0);



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