bool GreaterThan(MetaSymbol a, MetaSymbol b) { if (a.Type != b.Type) { return(false); } switch (a.Type) { case Tokens.NUM: return(MetaSymbol.Cast <float>(Tokens.NUM, a).Value > MetaSymbol.Cast <float>(Tokens.NUM, b).Value); case Tokens.INT: return(MetaSymbol.Cast <int>(Tokens.INT, a).Value < MetaSymbol.Cast <int>(Tokens.INT, b).Value); default: throw new SyntaxError("<num>|<int>", a.Type); } }
bool Equal(MetaSymbol a, MetaSymbol b) { if (a.Type != b.Type) { return(false); } switch (a.Type) { case Tokens.NUM: return(MetaSymbol.Cast <float>(Tokens.NUM, a).Value == MetaSymbol.Cast <float>(Tokens.NUM, b).Value); case Tokens.STR: return(MetaSymbol.Cast <string>(Tokens.STR, a).Value == MetaSymbol.Cast <string>(Tokens.STR, b).Value); case Tokens.INT: return(MetaSymbol.Cast <int>(Tokens.INT, a).Value == MetaSymbol.Cast <int>(Tokens.INT, b).Value); default: throw new SyntaxError("<num>|<str>|<int>", a.Type); } }