public VarSpec(OperatorInfo operatorInfo) { _operatorInfo = operatorInfo; }
private void ProcessExpression(StringBuilder currentExpression, Result result) { if (currentExpression.Length == 0) { result.ErrorDetected = true; result.Append("{}"); return; } OperatorInfo op = GetOperator(currentExpression[0]); var firstChar = op.Default ? 0 : 1; bool multivariableExpression = false; var varSpec = new VarSpec(op); for (int i = firstChar; i < currentExpression.Length; i++) { char currentChar = currentExpression[i]; switch (currentChar) { case '*': varSpec.Explode = true; break; case ':': // Parse Prefix Modifier var prefixText = new StringBuilder(); currentChar = currentExpression[++i]; while (currentChar >= '0' && currentChar <= '9' && i < currentExpression.Length) { prefixText.Append(currentChar); i++; if (i < currentExpression.Length) { currentChar = currentExpression[i]; } } varSpec.PrefixLength = int.Parse(prefixText.ToString()); i--; break; case ',': multivariableExpression = true; var success = ProcessVariable(varSpec, result, multivariableExpression); bool isFirst = varSpec.First; // Reset for new variable varSpec = new VarSpec(op); if (success || !isFirst || _resolvePartially) { varSpec.First = false; } if (!success && _resolvePartially) { result.Append(","); } break; default: if (IsVarNameChar(currentChar)) { varSpec.VarName.Append(currentChar); } else { result.ErrorDetected = true; } break; } } ProcessVariable(varSpec, result, multivariableExpression); if (multivariableExpression && _resolvePartially) { result.Append("}"); } }