/// <summary> /// Handles the next character while inside a parameter. /// </summary> /// <param name="context">The current parsing context.</param> private static void HandleInParameter(ParserContext context) { if (context.IsMasked) { // All characters allowed if (context.CurrentCharacter == '\'') { if (context.IsNextCharQuote()) { // Masked ', so skip next character and continue context.AppendParameter(); context.SkipOne(); } else { // End of masked parameter context.LogicalPosition = ConstraintPosition.AfterParameter; context.AddParameter(); } } else { // All characters allowed context.AppendParameter(); } } else { switch (context.CurrentCharacter) { case ' ': // Space after parameter is allowed context.LogicalPosition = ConstraintPosition.AfterParameter; if (context.CurrentParameter.Length > 0) context.AddParameter(); break; case ',': // End of parameter context.LogicalPosition = ConstraintPosition.InParameters; if (context.CurrentParameter.Length > 0) context.AddParameter(); break; case ')': // At end of parameters context.LogicalPosition = ConstraintPosition.AfterParameters; if (context.CurrentParameter.Length > 0) context.AddParameter(); break; case '[': case ']': case '(': case '\'': // Invalid delimiters without masking throw new ConstraintParserException(Errors.CreateHResult(ErrorCodes.ConstraintParser_HandleInParameter_ParamUnmaskedChar), string.Format(Properties.Resources.ConstraintParser_Parse_UnmaskedChar, context.CurrentCharacter), context.StringPosition); default: // All other characters allowed in parameter context.AppendParameter(); break; } } }