コード例 #1
0
ファイル: AleOperations.cs プロジェクト: Modrigue/AnimGrapher
        // creates specific operation like index, initlist, objectconst ets.
        public AleOperation(string name, AleOperationType type)
        {
            string s = name.Trim();

            int n = s.Length;

            for (int i = 0; i < n; i++)
            {
                if (Char.IsWhiteSpace(s, i))
                {
                    throw new System.ArgumentException("Invalid operation name");
                }
            }

            AleOperationType[] validTypes = { AleOperationType.Index, AleOperationType.InitList, AleOperationType.ObjectConst, AleOperationType.KeyValue, AleOperationType.PropertyValue };
            if (Array.IndexOf(validTypes, type) < 0)
            {
                throw new System.ArgumentException("Invalid operation type");
            }

            _Name             = s;
            _Hash             = _Name.GetHashCode();
            _Associativity    = 0;
            _Precedence       = 0;
            _InstanceTypeCode = TypeCode.Empty;
            _OperationType    = type;
            _Flags            = AleString.HasAlphaNumChar(name);
            Parameters        = null;
            Evaluator         = null;
        }
コード例 #2
0
ファイル: AleOperations.cs プロジェクト: Modrigue/AnimGrapher
        // creates operator
        public AleOperation(string name, int precedence, uint associativity, AleOperationType type = AleOperationType.Evaluation)
        {
            string s = name.Trim();

            if (!CheckOperatorName(s))
            {
                throw new System.ArgumentException("Invalid operator name");
            }

            if ((associativity == 0) ||
                ((associativity & OPERATOR_PREFIX) == OPERATOR_PREFIX) ||
                ((associativity & OPERATOR_POSTFIX) == OPERATOR_POSTFIX) ||
                ((associativity & OPERATOR_INFIX) == OPERATOR_INFIX))
            {
                throw new System.ArgumentException("Invalid operator associativity");
            }

            AleOperationType[] validTypes = { AleOperationType.Evaluation, AleOperationType.Assignment, AleOperationType.CompoundAssignment, AleOperationType.Increment, AleOperationType.MemberAccess, AleOperationType.ElementAccess };
            if (Array.IndexOf(validTypes, type) < 0)
            {
                throw new System.ArgumentException("Invalid operation type");
            }

            _Name             = s;
            _Hash             = _Name.GetHashCode();
            _Associativity    = associativity;
            _Precedence       = precedence;
            _InstanceTypeCode = TypeCode.Empty;
            _OperationType    = type;
            _Flags            = AleString.HasAlphaNumChar(name) | (name.IndexOf(' ') >= 0 ? OPERATOR_OPTION_HASWHITESPACE : 0);
            Parameters        = null;
            Evaluator         = null;
        }
コード例 #3
0
ファイル: AleOperations.cs プロジェクト: Modrigue/AnimGrapher
        // creates function or method
        public AleOperation(string name)
        {
            string s = name.Trim();

            if (!CheckFunctionName(s))
            {
                throw new System.ArgumentException("Invalid function name");
            }

            _Name             = s;
            _Hash             = _Name.GetHashCode();
            _Associativity    = 0;
            _Precedence       = 0;
            _InstanceTypeCode = TypeCode.Empty;
            _OperationType    = AleOperationType.Evaluation;
            _Flags            = AleString.HasAlphaNumChar(name);
            Parameters        = null;
            Evaluator         = null;
        }
コード例 #4
0
ファイル: AleOperations.cs プロジェクト: victacora/sifca
        // creates operator
        public AleOperation(string name, int precedence, uint associativity, AleOperationType type = AleOperationType.Evaluation)
        {
            string s = name.Trim();
            if (!CheckOperatorName(s)) throw new System.ArgumentException("Invalid operator name");

            if ((associativity == 0) ||
                ((associativity & OPERATOR_PREFIX) == OPERATOR_PREFIX) ||
                ((associativity & OPERATOR_POSTFIX) == OPERATOR_POSTFIX) ||
                ((associativity & OPERATOR_INFIX) == OPERATOR_INFIX)) throw new System.ArgumentException("Invalid operator associativity");

            AleOperationType[] validTypes = { AleOperationType.Evaluation, AleOperationType.Assignment, AleOperationType.CompoundAssignment, AleOperationType.Increment, AleOperationType.MemberAccess, AleOperationType.ElementAccess };
            if (Array.IndexOf(validTypes, type) < 0) throw new System.ArgumentException("Invalid operation type");

            _Name = s;
            _Hash = _Name.GetHashCode();
            _Associativity = associativity;
            _Precedence = precedence;
            _InstanceTypeCode = TypeCode.Empty;
            _OperationType = type;
            _Flags = AleString.HasAlphaNumChar(name) | (name.IndexOf(' ') >= 0 ? OPERATOR_OPTION_HASWHITESPACE : 0);
            Parameters = null;
            Evaluator = null;
        }
コード例 #5
0
ファイル: AleOperations.cs プロジェクト: victacora/sifca
        // creates specific operation like index, initlist, objectconst ets.
        public AleOperation(string name, AleOperationType type)
        {
            string s = name.Trim();

            int n = s.Length;
            for (int i = 0; i < n; i++)
                if (Char.IsWhiteSpace(s, i)) throw new System.ArgumentException("Invalid operation name");

            AleOperationType[] validTypes = { AleOperationType.Index, AleOperationType.InitList, AleOperationType.ObjectConst, AleOperationType.KeyValue, AleOperationType.PropertyValue };
            if (Array.IndexOf(validTypes, type) < 0) throw new System.ArgumentException("Invalid operation type");

            _Name = s;
            _Hash = _Name.GetHashCode();
            _Associativity = 0;
            _Precedence = 0;
            _InstanceTypeCode = TypeCode.Empty;
            _OperationType = type;
            _Flags = AleString.HasAlphaNumChar(name);
            Parameters = null;
            Evaluator = null;
        }
コード例 #6
0
ファイル: AleOperations.cs プロジェクト: victacora/sifca
        // creates function or method
        public AleOperation(string name)
        {
            string s = name.Trim();

            if (!CheckFunctionName(s)) throw new System.ArgumentException("Invalid function name");

            _Name = s;
            _Hash = _Name.GetHashCode();
            _Associativity = 0;
            _Precedence = 0;
            _InstanceTypeCode = TypeCode.Empty;
            _OperationType = AleOperationType.Evaluation;
            _Flags = AleString.HasAlphaNumChar(name);
            Parameters = null;
            Evaluator = null;
        }