//private static bool IsDot(Parser.ParseContext context, out OperatorType operatorType, out int offset) //{ // offset = 0; // operatorType = OperatorType.None; // string c = context.Expression.Substring(context.TokenPosition, 1); // if (c == "."){ // operatorType = OperatorType.Dot; // offset = 1; // return true; // } // return false; //} internal static bool ParseBinary(Parser.ParseContext context) { int offset = 0; OperatorType operatorType = OperatorType.None; bool isBinary = IsNumeric(context, out operatorType, out offset); if (!isBinary) { isBinary = IsEquality(context, out operatorType, out offset); } if (!isBinary) { isBinary = IsComparator(context, out operatorType, out offset); } if (!isBinary) { isBinary = IsLogical(context, out operatorType, out offset); } if (!isBinary) { return(false); } ValidateTokenOrder(context, TokenType.BinaryOperator); ElementOperator element = new ElementBinaryOperator(operatorType); ProcessOperator(context, element); context.TokenPosition += offset; return(true); }
internal static bool Parse(Parser.ParseContext context) { if (ElementBinaryOperator.ParseBinary(context)) { return(true); } else if (ElementUnitaryOperator.ParseUnitary(context)) { return(true); } else if (ElementDot.ParseDot(context)) { return(true); } else if (ElementFunction.ParseFunction(context)) { return(true); } return(false); }