protected override void OnValidate(PatternCheckContext context) { if (Value is OptionalElement) { throw new Exception("Nested optional elements don't add anything"); } Value.Validate(context); }
protected override void OnValidate(PatternCheckContext context) { if (Elements.Count == 0) { throw new Exception("Option has no elements!"); } foreach (PatternElement element in Elements) { element.Validate(context); if (element is OptionalElement) { throw new Exception("Optional Option element"); } } }
protected override void OnValidate(PatternCheckContext context) { if (Elements.Count == 0) { throw new Exception("Sequence has no elements"); } context.BeginSequenceScope(); foreach (PatternElement element in Elements) { element.Validate(context); } if (Elements.Last() is OptionalElement option && option.Value is EndElement) { throw new Exception("A final optional end will never execute"); } context.EndSequenceScope(); }
protected override void OnValidate(PatternCheckContext context) { // Nothing to check here. }