private static void TestText( string endLine, string[] strings, int index, int endCount, StatementPosition position )
        {
            var textStatement2StartPos = string.Join( endLine, strings.Take( index ).ToArray() ).Length;
            var textStatement2EndPos = textStatement2StartPos + strings[index].Length + endCount * endLine.Length - 1;

            AssertHelper.AssertStatementPosition( textStatement2StartPos, textStatement2EndPos, position );
        }
Пример #2
0
 public ApplyStatement( StatementPosition position, string applyMethod, string parameters, string from )
     : base(position)
 {
     this.applyMethod = applyMethod;
     this.parameters = parameters;
     this.from = from;
 }
Пример #3
0
 public TextStatement( StatementPosition position, string text )
     : base(position)
 {
     this.text = text;
     this.lines = ExtractLines( text, out this.cropLastLine );
     this.Lines = this.lines.AsReadOnly();
 }
Пример #4
0
 public MethodStatement( StatementPosition position, Type returnType, string name, IList<Variable> variables,
     string code)
     : base(position)
 {
     this.returnType = returnType;
     this.name = name;
     this.variables = variables;
     this.code = code;
 }
        public RuleMethodStatement( StatementPosition position, MatchMethodStatement matchMethodStatement, string name,
            IList<Variable> variables, IList<RuleStatement> statements)
            : base(position)
        {
            this.matchMethodStatement = matchMethodStatement;
            this.name = name;
            this.variables = variables ?? emptyVariableList;
            this.statements = statements ?? emptyRuleStatementList;

            if (this.matchMethodStatement != null) this.matchMethodStatement.RuleMethod = this;
        }
Пример #6
0
        public JoinStatement( StatementPosition position, string @string, AppendType appendType,
            IList<RuleStatement> statements)
            : base(position)
        {
            this.@string = @string;
            this.appendType = appendType;
            this.statements = statements ?? new RuleStatement[0];

            foreach (var statement in this.statements)
            {
                if (statement is ValueStatement) continue;
                if (statement is ApplyStatement) continue;
                if (statement is CallStatement) continue;
                throw new JoinBuildException( "Can't contain statement of type: " + statement.GetType() );
            }
        }
Пример #7
0
        public RuleClassStatement( StatementPosition position, string name, IList<UsingStatement> usingStatements,
            IList<RuleClassMethodStatement> ruleMethodStatements)
            : base(position)
        {
            this.name = name;
            this.usingStatements = usingStatements;
            this.ruleMethodStatements = ruleMethodStatements ?? emptyRuleMethodStatementList;

            this.matchMethodGroups = (from statement in this.ruleMethodStatements.OfType<RuleMethodStatement>()
                                      group statement by
                                          new
                                          {
                                              statement.Name,
                                              Count = statement.Variables != null ? statement.Variables.Count : 0
                                          }
                                      into g select new RuleMethodGroup( g )).ToList().AsReadOnly();
        }
Пример #8
0
 public Type( StatementPosition position, string typeName, IList<Type> genericParameters )
     : base(position)
 {
     this.typeName = typeName;
     this.genericParameters = genericParameters ?? emptyListGenericParameters;
 }
Пример #9
0
 public Type( StatementPosition position, string typeName, params Type[] genericParameters )
     : this(position, typeName, (IList<Type>)genericParameters)
 {
 }
Пример #10
0
 public CallStatement( StatementPosition position, string name, string parameters )
     : base(position)
 {
     this.name = name;
     this.parameters = parameters;
 }