Example #1
0
        /// <summary>
        /// Creates a pattern builder that builds a pattern as part of the current group.
        /// </summary>
        /// <param name="declaration">Pattern declaration.</param>
        /// <returns>Pattern builder.</returns>
        public PatternBuilder Pattern(Declaration declaration)
        {
            var builder = new PatternBuilder(Scope, declaration);

            _nestedBuilders.Add(builder);
            return(builder);
        }
Example #2
0
        /// <summary>
        /// Creates a pattern builder that builds the source of the negative existential element.
        /// </summary>
        /// <param name="declaration">Pattern declaration.</param>
        /// <returns>Pattern builder.</returns>
        public PatternBuilder Pattern(Declaration declaration)
        {
            AssertSingleSource();
            var sourceBuilder = new PatternBuilder(declaration);

            _sourceBuilder = sourceBuilder;
            return(sourceBuilder);
        }
Example #3
0
        /// <summary>
        /// Creates a pattern builder that builds a pattern of the forall element.
        /// </summary>
        /// <param name="type">Type of the element the pattern matches.</param>
        /// <returns>Pattern builder.</returns>
        public PatternBuilder Pattern(Type type)
        {
            Declaration declaration    = Scope.Declare(type, null);
            var         patternBuilder = new PatternBuilder(Scope, declaration);

            _patternBuilders.Add(patternBuilder);
            return(patternBuilder);
        }
Example #4
0
        /// <summary>
        /// Creates a pattern builder that builds a pattern of the forall element.
        /// </summary>
        /// <param name="type">Type of the element the pattern matches.</param>
        /// <returns>Pattern builder.</returns>
        public PatternBuilder Pattern(Type type)
        {
            var declaration    = new Declaration(type, DeclarationName(null));
            var patternBuilder = new PatternBuilder(declaration);

            _patternBuilders.Add(patternBuilder);
            return(patternBuilder);
        }
Example #5
0
        /// <summary>
        /// Creates a pattern builder that builds the base pattern of the forall element.
        /// </summary>
        /// <param name="type">Type of the element the pattern matches.</param>
        /// <returns>Pattern builder.</returns>
        public PatternBuilder BasePattern(Type type)
        {
            AssertSingleSource();
            var declaration = new Declaration(type, DeclarationName(null));
            var builder     = new PatternBuilder(declaration);

            _sourceBuilder = builder;
            return(builder);
        }
Example #6
0
        /// <summary>
        /// Creates a pattern builder that builds a pattern as part of the current group.
        /// </summary>
        /// <param name="type">Pattern type.</param>
        /// <param name="name">Pattern name (optional).</param>
        /// <returns>Pattern builder.</returns>
        public PatternBuilder Pattern(Type type, string name = null)
        {
            SymbolTable scope       = Scope.New();
            Declaration declaration = scope.Declare(type, name);

            var builder = new PatternBuilder(scope, declaration);

            _nestedBuilders.Add(builder);

            return(builder);
        }
Example #7
0
        /// <summary>
        /// Creates a pattern builder that builds the base pattern of the forall element.
        /// </summary>
        /// <param name="type">Type of the element the pattern matches.</param>
        /// <returns>Pattern builder.</returns>
        public PatternBuilder BasePattern(Type type)
        {
            if (_basePatternBuilder != null)
            {
                throw new InvalidOperationException("FORALL element can only have a single source");
            }

            Declaration declaration = Scope.Declare(type, null);

            _basePatternBuilder = new PatternBuilder(Scope, declaration);
            return(_basePatternBuilder);
        }
Example #8
0
        /// <summary>
        /// Creates a pattern builder that builds the source of the aggregate.
        /// </summary>
        /// <param name="type">Type of the element the pattern matches.</param>
        /// <returns>Pattern builder.</returns>
        public PatternBuilder SourcePattern(Type type)
        {
            if (_sourceBuilder != null)
            {
                throw new InvalidOperationException("Aggregate can only have a single source pattern");
            }

            SymbolTable scope       = Scope.New();
            Declaration declaration = scope.Declare(type, null);

            _sourceBuilder = new PatternBuilder(scope, declaration);

            return(_sourceBuilder);
        }
Example #9
0
 /// <summary>
 /// Sets a pattern builder as the source of the negative existential element.
 /// </summary>
 /// <param name="builder">Element builder to set as the source.</param>
 public void Pattern(PatternBuilder builder)
 {
     AssertSingleSource();
     _sourceBuilder = builder;
 }
Example #10
0
 /// <summary>
 /// Adds a pattern builder to the group element.
 /// </summary>
 /// <param name="builder">Element builder to add.</param>
 public void Pattern(PatternBuilder builder)
 {
     _nestedBuilders.Add(builder);
 }
Example #11
0
 /// <summary>
 /// Adds a pattern builder to the forall element.
 /// </summary>
 /// <param name="builder">Element builder to add.</param>
 public void Pattern(PatternBuilder builder)
 {
     _patternBuilders.Add(builder);
 }