Exemple #1
0
	    public ArgInfo (int idx, UserType type, ArgCount count, string name, 
			    bool is_default, bool is_ordered)
	    {
		Idx = idx;
		Type = type;
		Count = count;
		Name = name;

		switch (count) {
		case ArgCount.ZeroOrMore:
		    Flags = new CodeBinaryOperatorExpression (Optional, Or, Multi);
		    break;
		case ArgCount.OneOrMore:
		    Flags = Multi;
		    break;
		case ArgCount.Optional:
		    Flags = Optional;
		    break;
		case ArgCount.Standard:
		    Flags = Standard;
		    break;
		default:
		    throw new Exception ("Unsupported ArgCount kind " + Count.ToString ());
		}

		if (is_ordered) {
		    Flags = new CodeBinaryOperatorExpression (Flags, Or, Ordered);
			
		    if (is_default)
			Flags = new CodeBinaryOperatorExpression (Flags, Or, DefOrd);
		} else if (is_default) {
		    Flags = new CodeBinaryOperatorExpression (Flags, Or, Default);
		}
	    }
Exemple #2
0
 /// <summary>
 ///  Constructs a single intrinsic definition.
 /// </summary>
 /// <param name="count">Indicates how many arguments the function takes</param>
 /// <param name="types">Bitmask representing the valid argument types</param>
 /// <param name="requiredType">Type to which the argument must be cast</param>
 /// <param name="returnType">Symbol representing the return type</param>
 public IntrDefinition(ArgCount count, int types, SymType requiredType, SymType returnType)
 {
     Count = count;
     Types = types;
     RequiredType = requiredType;
     ReturnType = returnType;
 }
Exemple #3
0
            public ArgInfo(int idx, UserType type, ArgCount count, string name,
                           bool is_default, bool is_ordered)
            {
                Idx   = idx;
                Type  = type;
                Count = count;
                Name  = name;

                switch (count)
                {
                case ArgCount.ZeroOrMore:
                    Flags = new CodeBinaryOperatorExpression(Optional, Or, Multi);
                    break;

                case ArgCount.OneOrMore:
                    Flags = Multi;
                    break;

                case ArgCount.Optional:
                    Flags = Optional;
                    break;

                case ArgCount.Standard:
                    Flags = Standard;
                    break;

                default:
                    throw new Exception("Unsupported ArgCount kind " + Count.ToString());
                }

                if (is_ordered)
                {
                    Flags = new CodeBinaryOperatorExpression(Flags, Or, Ordered);

                    if (is_default)
                    {
                        Flags = new CodeBinaryOperatorExpression(Flags, Or, DefOrd);
                    }
                }
                else if (is_default)
                {
                    Flags = new CodeBinaryOperatorExpression(Flags, Or, Default);
                }
            }
Exemple #4
0
        public void AddTargetArgument(ArgCount count, string name, bool is_default,
                                      bool is_ordered)
        {
            if (count == ArgCount.Standard)
            {
                target_arg_reqd = true;
            }
            else if (count == ArgCount.Optional)
            {
                target_arg_reqd = false;
            }
            else
            {
                throw new Exception("A .target argument cannot be multiple-valued");
            }

            if (is_ordered)
            {
                throw new Exception("A .target argument cannot be ordered");
            }

            target_arg_name = name;
        }
Exemple #5
0
 public void AddArgument(UserType type, ArgCount count, string name, bool is_default,
                         bool is_ordered)
 {
     arguments.Add(new ArgInfo(arguments.Count, type, count, name,
                               is_default, is_ordered));
 }
Exemple #6
0
	public void AddTargetArgument (ArgCount count, string name, bool is_default, 
				       bool is_ordered)
	{
	    if (count == ArgCount.Standard)
		target_arg_reqd = true;
	    else if (count == ArgCount.Optional)
		target_arg_reqd = false;
	    else
		throw new Exception ("A .target argument cannot be multiple-valued");

	    if (is_ordered)
		throw new Exception ("A .target argument cannot be ordered");

	    target_arg_name = name;
	}
Exemple #7
0
	public void AddArgument (UserType type, ArgCount count, string name, bool is_default,
				 bool is_ordered)
	{
	    arguments.Add (new ArgInfo (arguments.Count, type, count, name, 
					is_default, is_ordered));
	}