/// <summary>
 /// Initialize a new instance of the <see cref="VariableReferenceExpression"/> class using the specified parameters.
 /// </summary>
 /// <param name="variableName">The name of the variable.</param>
 /// <param name="linePragma">The position of the expression in the script code.</param>
 /// <exception cref="ArgumentNullException">The parameter is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentException"><pararef name="variableName"/> is empty or white space.</exception>
 public VariableReferenceExpression(Parser.Lexical.LinePragma linePragma, string variableName)
     : base(linePragma)
 {
     if (variableName == null)
         throw new ArgumentNullException();
     if (string.IsNullOrWhiteSpace(variableName))
         throw new ArgumentException(ExceptionResource.InvalidIdentifier);
     VariableName = variableName;
 }
 /// <summary>
 /// Initialize a new instance of the <see cref="FunctionExpression"/> class using the specified parameters.
 /// </summary>
 /// <param name="parameters">The parameters of the function expression.</param>
 /// <param name="statements">The statements in the function body.</param>
 /// <param name="linePragma">The position of the expression in the script code.</param>
 /// <exception cref="ArgumentNullException"><paramref name="linePragma"/> is <see langword="null"/>.</exception>
 public FunctionExpression(
     Parser.Lexical.LinePragma linePragma,
     ParameterCollection parameters,
     StatementCollection statements)
     : base(linePragma)
 {
     Parameters = parameters;
     Statements = statements;
 }
Beispiel #3
0
 /// <summary>
 /// Initialize a new instance of the <see cref="AssignExpression"/> class using the specified left and right expressions.
 /// </summary>
 /// <param name="left">The left expression of the assignment.</param>
 /// <param name="right">The right expression of the assignment.</param>
 /// <param name="linePragma">The position of the expression in the script code.</param>
 /// <exception cref="ArgumentNullException">The parameter is <see langword="null"/>.</exception>
 public AssignExpression(Parser.Lexical.LinePragma linePragma, Expression left, Expression right)
     : base(linePragma)
 {
     if (left == null || right == null)
     {
         throw new ArgumentNullException();
     }
     Left  = left;
     Right = right;
 }
Beispiel #4
0
 /// <summary>
 /// Initialize a new instance of the <see cref="NewExpression"/> class using the specified parameters.
 /// </summary>
 /// <param name="type">The expression of the type of the object to be created.</param>
 /// <param name="parameters">The expressions of the parameters for the constructor invocation.</param>
 /// <param name="linePragma">The position of the expression in the script code.</param>
 /// <exception cref="ArgumentNullException"><paramref name="linePragma"/> or <paramref name="type"/> is <see langword="null"/>.</exception>
 public NewExpression(Parser.Lexical.LinePragma linePragma, Expression type, ExpressionCollection parameters)
     : base(linePragma)
 {
     if (type == null)
     {
         throw new ArgumentNullException();
     }
     Type       = type;
     Parameters = parameters;
 }
 /// <summary>
 /// Initialize a new instance of the <see cref="FunctionInvokeExpression"/> class using the specified parameters.
 /// </summary>
 /// <param name="target">The expression of the target function.</param>
 /// <param name="parameters">The expressions of the parameters for the function invocation.</param>
 /// <param name="linePragma">The position of the expression in the script code.</param>
 /// <exception cref="ArgumentNullException"><paramref name="linePragma"/> is<see langword="null"/>, or <paramref name="target"/> is <see langword="null"/>.</exception>
 public FunctionInvokeExpression(
     Parser.Lexical.LinePragma linePragma,
     Expression target,
     ExpressionCollection parameters)
     : base(linePragma)
 {
     if (target == null)
     {
         throw new ArgumentNullException();
     }
     Target     = target;
     Parameters = parameters;
 }
Beispiel #6
0
 /// <summary>
 /// Initialize a new instance of the <see cref="Parameter"/> class using the secified parameters.
 /// </summary>
 /// <param name="name">The name of the parameter.</param>
 /// <param name="linePragma">The position of the parameter in the script code.</param>
 /// <exception cref="ArgumentNullException"><paramref name="linePragma"/> or <pararef name="name"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentException"><pararef name="name"/> is an empty string.</exception>
 public Parameter(Parser.Lexical.LinePragma linePragma, string name)
 {
     if (linePragma == null || name == null)
     {
         throw new ArgumentNullException();
     }
     if (string.IsNullOrWhiteSpace(name))
     {
         throw new ArgumentException(ExceptionResource.InvalidIdentifier);
     }
     LinePragma = linePragma;
     Name       = name;
 }
 /// <summary>
 /// Initialize a new instance of the <see cref="PrefixOperatorExpression"/> class using the specified parameters.
 /// </summary>
 /// <param name="operator">The operator.</param>
 /// <param name="left">The left expression of the operator.</param>
 /// <param name="linePragma">The position of the expression in the script code.</param>
 /// <exception cref="ArgumentNullException">The parameter is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentException"><paramref name="operator"/> is empty or white space.</exception>
 public PostfixOperatorExpression(Parser.Lexical.LinePragma linePragma, Expression left, string @operator)
     : base(linePragma)
 {
     if (left == null || @operator == null)
     {
         throw new ArgumentNullException();
     }
     if (string.IsNullOrWhiteSpace(@operator))
     {
         throw new ArgumentException(ExceptionResource.InvalidOperator);
     }
     Left     = left;
     Operator = @operator;
 }
Beispiel #8
0
 /// <summary>
 /// Initialize a new instance of the <see cref="PrefixOperatorExpression"/> class using the specified parameters.
 /// </summary>
 /// <param name="operator">The operator.</param>
 /// <param name="right">The right expression of the operator.</param>
 /// <param name="linePragma">The position of the expression in the script code.</param>
 /// <exception cref="ArgumentNullException">The parameter is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentException"><paramref name="operator"/> is empty or white space.</exception>
 public PrefixOperatorExpression(Parser.Lexical.LinePragma linePragma, string @operator, Expression right)
     : base(linePragma)
 {
     if (right == null || @operator == null)
     {
         throw new ArgumentNullException();
     }
     if (string.IsNullOrWhiteSpace(@operator))
     {
         throw new ArgumentException(ExceptionResource.InvalidOperator);
     }
     Right    = right;
     Operator = @operator;
 }
 /// <summary>
 /// Initialize a new instance of the <see cref="MemberReferenceExpression"/> class using the specified parameters.
 /// </summary>
 /// <param name="target">The expression of the target object.</param>
 /// <param name="memberName">The name of the member.</param>
 /// <param name="linePragma">The position of the expression in the script code.</param>
 /// <exception cref="ArgumentNullException">The parameter is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentException"><pararef name="memberName"/> is empty or white space.</exception>
 public MemberReferenceExpression(Parser.Lexical.LinePragma linePragma, Expression target, string memberName)
     : base(linePragma)
 {
     if (target == null || memberName == null)
     {
         throw new ArgumentNullException();
     }
     if (string.IsNullOrWhiteSpace(memberName))
     {
         throw new ArgumentException(ExceptionResource.InvalidIdentifier);
     }
     Target     = target;
     MemberName = memberName;
 }
Beispiel #10
0
 /// <summary>
 /// Initialize a new instance of the <see cref="TernaryOperatorExpression"/> class using the specified parameters.
 /// </summary>
 /// <param name="operand1">The first expression of the operator.</param>
 /// <param name="operator1">The first operator.</param>
 /// <param name="operand2">The second expression of the operator.</param>
 /// <param name="operator2">The second operator.</param>
 /// <param name="operand3">The third expression of the operator.</param>
 /// <param name="linePragma">The position of the expression in the script code.</param>
 /// <exception cref="ArgumentNullException">The parameter is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentException"><pararef name="operator1"/> or <pararef name="operator2"/> is empty or white space.</exception>
 public TernaryOperatorExpression(Parser.Lexical.LinePragma linePragma,
                                  Expression operand1, string operator1, Expression operand2, string operator2, Expression operand3)
     : base(linePragma)
 {
     if (operand1 == null || operand2 == null || operand3 == null || operator1 == null || operator2 == null)
     {
         throw new ArgumentNullException();
     }
     if (string.IsNullOrWhiteSpace(operator1) || string.IsNullOrWhiteSpace(operator2))
     {
         throw new ArgumentException(ExceptionResource.InvalidOperator);
     }
     Operand1  = operand1;
     Operand2  = operand2;
     Operand3  = operand3;
     Operator1 = operator1;
     Operator2 = operator2;
 }
 internal ObjectExpression(Parser.Lexical.LinePragma linePragma, List <KeyValuePair <string, Expression> > members)
     : base(linePragma)
 {
     _members = members;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ObjectExpression"/> class using the specified parameters.
 /// </summary>
 /// <param name="members">The collection whose elements are the pairs of the member name and the value expression.</param>
 /// <param name="linePragma">The position of the expression in the script code.</param>
 /// <exception cref="ArgumentNullException"><paramref name="linePragma"/> is <see langword="null"/>.</exception>
 public ObjectExpression(Parser.Lexical.LinePragma linePragma, IEnumerable <KeyValuePair <string, Expression> > members)
     : base(linePragma)
 {
     _members = new List <KeyValuePair <string, Expression> >(members);
 }
 /// <summary>
 /// Initialize a new instance of the <see cref="SuperReferenceExpression"/> class using the specified parameters.
 /// </summary>
 /// <param name="linePragma">The position of the expression in the script code.</param>
 /// <exception cref="ArgumentNullException"><paramref name="linePragma"/> is <see langword="null"/>.</exception>
 public SuperReferenceExpression(Parser.Lexical.LinePragma linePragma)
     : base(linePragma)
 {
 }
Beispiel #14
0
 /// <summary>
 /// Initialize a new instance of the <see cref="PrimitiveExpression"/> class using the specified parameters.
 /// </summary>
 /// <param name="value">The value of the primitive expression.</param>
 /// <param name="linePragma">The position of the expression in the script code.</param>
 /// <exception cref="ArgumentNullException"><paramref name="linePragma"/> is <see langword="null"/>.</exception>
 public PrimitiveExpression(Parser.Lexical.LinePragma linePragma, object value)
     : base(linePragma)
 {
     Value = value;
 }
Beispiel #15
0
 /// <summary>
 /// Initialize a new instance of the <see cref="Parameter"/> class using the secified parameters.
 /// </summary>
 /// <param name="name">The name of the parameter.</param>
 /// <param name="defaultExpression">The expression of the default value for optional parameters.</param>
 /// <param name="linePragma">The position of the parameter in the script code.</param>
 /// <exception cref="ArgumentNullException"><paramref name="linePragma"/> or <pararef name="name"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentException"><pararef name="name"/> is an empty string.</exception>
 public Parameter(Parser.Lexical.LinePragma linePragma, string name, Expression defaultExpression)
     : this(linePragma, name)
 {
     IsOptional        = defaultExpression != null;
     DefaultExpression = defaultExpression;
 }