private static (bool, string, string) IsMathsKeyword(ref XmlDocument lookup, string value)
        {
            (bool success, XmlNode group, XmlNode keyword)match = XmlManager.GetSecondLevelChild(value, ref lookup, matchInnerXml: true);

            XmlNode firstChild = lookup.FirstChild;

            if (match.success)
            {
                if (value == match.keyword.InnerXml)
                {
                    if (match.group.Attributes["symbol"] == null)
                    {
                        throw new Exception($"XML lookup group missing symbol attribute at: {lookup.InnerXml}");
                    }

                    string symbol = "";

                    if (match.group.Attributes["loperand"] != null)
                    {
                        symbol += $"{match.group.Attributes["loperand"].Value} ";
                    }

                    symbol += match.group.Attributes["symbol"].Value;

                    if (match.keyword.Attributes["append"] != null)
                    {
                        symbol += match.keyword.Attributes["append"].Value;
                    }

                    symbol += $"_{match.group.Attributes["priority"].Value}";

                    symbol += $"_{match.group.Attributes["operandIdentifier"].Value}";

                    if (match.group.Attributes["roperand"] != null)
                    {
                        symbol += $" {match.group.Attributes["roperand"].Value}";
                    }

                    return(true, symbol, match.keyword.InnerXml);
                }
            }

            return(false, null, null);
        }
Beispiel #2
0
        private static (double, WordGroups) GetMappedWordValue(string word)
        {
            (bool success, XmlNode group, XmlNode word)match = XmlManager.GetSecondLevelChild(word, ref map, "name");

            WordGroups matchedGroup = WordGroups.UNMATCHED;

            double matchedValue = 0;

            if (match.success)
            {
                matchedGroup = (WordGroups)int.Parse(match.group.Attributes["name"].Value);

                if (matchedGroup != WordGroups.CONNECTOR)
                {
                    matchedValue = double.Parse(match.word.Attributes["value"].Value);
                }
            }

            return(matchedValue, matchedGroup);
        }
Beispiel #3
0
 private static bool IsNumericalWord(string word)
 {
     return(XmlManager.GetSecondLevelChild(word, ref map, "name").Item1);
 }