[gnome-calculator] equation-lexer.vala: Additional syntax for unit conversion



commit b597a8a9dd5fa5668fc2eb8763cf469e52f137a3
Author: Tuomas Mikkola <ttjmikkola gmail com>
Date:   Wed Feb 6 17:36:51 2019 +0200

    equation-lexer.vala: Additional syntax for unit conversion
    
    Extends the unit conversion functionality by adding an
    additional "to" keyword to function the same way as "in".
    
    (e.g. 1 EUR to USD and 1 EUR in USD now do conversions)
    
    Reference: GNOME/gnome-calculator#94
    GNOME/gnome-calculator#94

 lib/equation-lexer.vala | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/lib/equation-lexer.vala b/lib/equation-lexer.vala
index fbbcd03e..405f062c 100644
--- a/lib/equation-lexer.vala
+++ b/lib/equation-lexer.vala
@@ -46,7 +46,7 @@ public enum LexerTokenType
     AND,                /* Bitwise AND */
     OR,                 /* Bitwise OR */
     XOR,                /* Bitwise XOR */
-    IN,                 /* IN ( for converter ) */
+    IN,                 /* IN ( for converter e.g. 1 EUR in USD / 1 EUR to USD) */
     NUMBER,             /* Number */
     SUP_NUMBER,         /* Super Number */
     NSUP_NUMBER,        /* Negative Super Number */
@@ -700,8 +700,8 @@ public class Lexer : Object
             return insert_token (LexerTokenType.XOR);
         if (name == "not")
             return insert_token (LexerTokenType.NOT);
-        // Translators: conversion keyword, used e.g. 1 EUR in USD
-        if (name == _("in"))
+        // Translators: conversion keyword, used e.g. 1 EUR in USD, 1 EUR to USD
+        if (name == _("in") || name == _("to"))
             return insert_token (LexerTokenType.IN);
         if (check_if_function ())
             return insert_token (LexerTokenType.FUNCTION);


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