/// <summary> /// Handles the next character while inside of a constraint. /// </summary> /// <param name="context">The current parsing context.</param> private void HandleInConstraint(ParserContext context) { switch (context.CurrentCharacter) { case ' ': // No spaces in names case '\'': // No quote in names case '[': // Invalid constraint start in constraint case ')': // Invalid parameter end in constraint throw new ConstraintParserException(Errors.CreateHResult(ErrorCodes.ConstraintParser_HandleInConstraint_InvalidChar), string.Format(Properties.Resources.ConstraintParser_Parse_InvalidCharInName, context.CurrentCharacter), context.StringPosition); case ']': // Constraint without parameters context.CurrentConstraintStart++; if (context.StringPosition == context.CurrentConstraintStart) { // No constraint name throw new ConstraintParserException(Errors.CreateHResult(ErrorCodes.ConstraintParser_HandleInConstraint_EmptyConstraint), Properties.Resources.ConstraintParser_Parse_EmptyConstraint, context.StringPosition); } context.CurrentConstraintName = context.GetSubstring(context.CurrentConstraintStart, context.StringPosition - context.CurrentConstraintStart); context.Constraints.Add(CreateConstraint(context)); context.ResetConstraintData(); break; case '(': // Start of parameters context.CurrentConstraintStart++; if (context.StringPosition == context.CurrentConstraintStart) { // No constraint name throw new ConstraintParserException(Errors.CreateHResult(ErrorCodes.ConstraintParser_HandleInConstraint_EmptyConstraint), Properties.Resources.ConstraintParser_Parse_EmptyConstraint, context.StringPosition); } context.CurrentConstraintName = context.GetSubstring(context.CurrentConstraintStart, context.StringPosition - context.CurrentConstraintStart); context.LogicalPosition = ConstraintPosition.InParameters; break; } }