[gnome-calculator] Fix error reporting bug for malformed expression



commit 6f7526822afc9eb73a4544c8141961b66085e4c6
Author: PioneerAxon <arth svnit gmail com>
Date:   Tue Mar 26 18:26:09 2013 +0530

    Fix error reporting bug for malformed expression

 src/equation-parser.vala |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/equation-parser.vala b/src/equation-parser.vala
index 4d1f293..d3cf977 100644
--- a/src/equation-parser.vala
+++ b/src/equation-parser.vala
@@ -777,7 +777,7 @@ public class Parser
             if (token.type != LexerTokenType.PL_EOS)
             {
                 /* Full string is not parsed. */
-                if (error == 0)
+                if (error == ErrorCode.NONE)
                     set_error (ErrorCode.INVALID, token.text, token.start_index, token.end_index);
 
                 error_code = error;
@@ -790,7 +790,7 @@ public class Parser
         if (token.type != LexerTokenType.PL_EOS)
         {
             /* Full string is not parsed. */
-            if (error == 0)
+            if (error == ErrorCode.NONE)
                 set_error (ErrorCode.INVALID, token.text, token.start_index, token.end_index);
 
             error_code = error;
@@ -803,6 +803,9 @@ public class Parser
         /* Input can't be parsed with grammar. */
         if (!ret)
         {
+            if (error == ErrorCode.NONE)
+                set_error (ErrorCode.INVALID);
+
             error_code = error;
             error_token = this.error_token;
             error_start = error_token_start;


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