/// <summary>
        /// Initializes a new instance of the OperatorSymbolToken class.
        /// </summary>
        /// <param name="document">The parent document.</param>
        /// <param name="text">The text of the operator symbol.</param>
        /// <param name="category">The category of the operator.</param>
        /// <param name="symbolType">The specific symbol type.</param>
        internal OperatorSymbolToken(CsDocument document, string text, OperatorCategory category, OperatorType symbolType)
            : base(document, text, (int)symbolType)
        {
            Param.AssertNotNull(document, "document");
            Param.AssertValidString(text, "text");
            Param.Ignore(category);
            Param.Ignore(symbolType);

            this.category = category;
            CsLanguageService.Debug.Assert(System.Enum.IsDefined(typeof(OperatorType), this.SymbolType), "The type is invalid.");
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the OperatorSymbolToken class.
        /// </summary>
        /// <param name="document">The parent document.</param>
        /// <param name="text">The text of the operator symbol.</param>
        /// <param name="category">The category of the operator.</param>
        /// <param name="symbolType">The specific symbol type.</param>
        internal OperatorSymbolToken(CsDocument document, string text, OperatorCategory category, OperatorType symbolType)
            : base(document, text, (int)symbolType)
        {
            Param.AssertNotNull(document, "document");
            Param.AssertValidString(text, "text");
            Param.Ignore(category);
            Param.Ignore(symbolType);

            this.category = category;
            CsLanguageService.Debug.Assert(System.Enum.IsDefined(typeof(OperatorType), this.SymbolType), "The type is invalid.");
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the OperatorSymbol class.
        /// </summary>
        /// <param name="text">
        /// The text of the operator symbol.
        /// </param>
        /// <param name="category">
        /// The category of the operator.
        /// </param>
        /// <param name="symbolType">
        /// The specific symbol type.
        /// </param>
        /// <param name="location">
        /// The location of the operator symbol in the code document.
        /// </param>
        /// <param name="parent">
        /// Reference to the parent code part.
        /// </param>
        /// <param name="generated">
        /// Indicates whether the operator lies within a block of generated code.
        /// </param>
        internal OperatorSymbol(string text, OperatorCategory category, OperatorType symbolType, CodeLocation location, Reference <ICodePart> parent, bool generated)
            : base(text, CsTokenType.OperatorSymbol, CsTokenClass.OperatorSymbol, location, parent, generated)
        {
            Param.AssertValidString(text, "text");
            Param.Ignore(category);
            Param.Ignore(symbolType);
            Param.AssertNotNull(location, "location");
            Param.AssertNotNull(parent, "parent");
            Param.Ignore(generated);

            this.category   = category;
            this.symbolType = symbolType;
        }
示例#4
0
        protected OperatorHandler(OperatorCategory category, string name, string verb, string symbol, string fancySymbol, string customMethodName)
        {
            Ensure.That(nameof(name)).IsNotNull(name);
            Ensure.That(nameof(verb)).IsNotNull(verb);
            Ensure.That(nameof(symbol)).IsNotNull(symbol);

            this.category         = category;
            this.name             = name;
            this.verb             = verb;
            this.symbol           = symbol;
            this.fancySymbol      = fancySymbol;
            this.customMethodName = customMethodName;
        }
        /// <summary>
        /// Initializes a new instance of the OperatorSymbol class.
        /// </summary>
        /// <param name="text">
        /// The text of the operator symbol.
        /// </param>
        /// <param name="category">
        /// The category of the operator.
        /// </param>
        /// <param name="symbolType">
        /// The specific symbol type.
        /// </param>
        /// <param name="location">
        /// The location of the operator symbol in the code document.
        /// </param>
        /// <param name="parent">
        /// Reference to the parent code part.
        /// </param>
        /// <param name="generated">
        /// Indicates whether the operator lies within a block of generated code.
        /// </param>
        internal OperatorSymbol(string text, OperatorCategory category, OperatorType symbolType, CodeLocation location, Reference<ICodePart> parent, bool generated)
            : base(text, CsTokenType.OperatorSymbol, CsTokenClass.OperatorSymbol, location, parent, generated)
        {
            Param.AssertValidString(text, "text");
            Param.Ignore(category);
            Param.Ignore(symbolType);
            Param.AssertNotNull(location, "location");
            Param.AssertNotNull(parent, "parent");
            Param.Ignore(generated);

            this.category = category;
            this.symbolType = symbolType;
        }
示例#6
0
 /// <summary>
 /// Initializes a new instance of Autodesk.IM.Rule.OperatorEntry class with specified
 /// name, display name, factory function, signature, activity type, return type and operator category.
 /// </summary>
 /// <param name="name">The name of operator.</param>
 /// <param name="displayName">The diaply name of operator.</param>
 /// <param name="factoryFunction">The factory function to create new instnace of operator.</param>
 /// <param name="signature">The specified operator's signature.</param>
 /// <param name="activityType">The specified System.Type object representing the operator's type.</param>
 /// <param name="returnType">The specified System.Type object representing the operator's return type.</param>
 /// <param name="category">The specified category of the operator.</param>
 public OperatorEntry(
     string name,
     string displayName,
     Func <Activity> factoryFunction,
     ActivitySignature signature,
     Type activityType,
     Type returnType,
     OperatorCategory category)
     : base(name, displayName, factoryFunction, signature, activityType)
 {
     ReturnType = returnType;
     Category   = category;
 }
        private static bool GetOperatorType(Symbol symbol, out OperatorType type, out OperatorCategory category)
        {
            Param.AssertNotNull(symbol, "symbol");

            bool isOperator = true;

            switch (symbol.SymbolType)
            {
                case SymbolType.LogicalAnd:
                    type = OperatorType.LogicalAnd;
                    category = OperatorCategory.Logical;
                    break;
                case SymbolType.LogicalOr:
                    type = OperatorType.LogicalOr;
                    category = OperatorCategory.Logical;
                    break;
                case SymbolType.LogicalXor:
                    type = OperatorType.LogicalXor;
                    category = OperatorCategory.Logical;
                    break;
                case SymbolType.ConditionalAnd:
                    type = OperatorType.ConditionalAnd;
                    category = OperatorCategory.Logical;
                    break;
                case SymbolType.ConditionalOr:
                    type = OperatorType.ConditionalOr;
                    category = OperatorCategory.Logical;
                    break;
                case SymbolType.NullCoalescingSymbol:
                    type = OperatorType.NullCoalescingSymbol;
                    category = OperatorCategory.Logical;
                    break;
                case SymbolType.Equals:
                    type = OperatorType.Equals;
                    category = OperatorCategory.Assignment;
                    break;
                case SymbolType.AndEquals:
                    type = OperatorType.AndEquals;
                    category = OperatorCategory.Assignment;
                    break;
                case SymbolType.OrEquals:
                    type = OperatorType.OrEquals;
                    category = OperatorCategory.Assignment;
                    break;
                case SymbolType.PlusEquals:
                    type = OperatorType.PlusEquals;
                    category = OperatorCategory.Assignment;
                    break;
                case SymbolType.MinusEquals:
                    type = OperatorType.MinusEquals;
                    category = OperatorCategory.Assignment;
                    break;
                case SymbolType.MultiplicationEquals:
                    type = OperatorType.MultiplicationEquals;
                    category = OperatorCategory.Assignment;
                    break;
                case SymbolType.DivisionEquals:
                    type = OperatorType.DivisionEquals;
                    category = OperatorCategory.Assignment;
                    break;
                case SymbolType.ModEquals:
                    type = OperatorType.ModEquals;
                    category = OperatorCategory.Assignment;
                    break;
                case SymbolType.XorEquals:
                    type = OperatorType.XorEquals;
                    category = OperatorCategory.Assignment;
                    break;
                case SymbolType.LeftShiftEquals:
                    type = OperatorType.LeftShiftEquals;
                    category = OperatorCategory.Assignment;
                    break;
                case SymbolType.RightShiftEquals:
                    type = OperatorType.RightShiftEquals;
                    category = OperatorCategory.Assignment;
                    break;
                case SymbolType.ConditionalEquals:
                    type = OperatorType.ConditionalEquals;
                    category = OperatorCategory.Relational;
                    break;
                case SymbolType.NotEquals:
                    type = OperatorType.NotEquals;
                    category = OperatorCategory.Relational;
                    break;
                case SymbolType.LessThan:
                    type = OperatorType.LessThan;
                    category = OperatorCategory.Relational;
                    break;
                case SymbolType.GreaterThan:
                    type = OperatorType.GreaterThan;
                    category = OperatorCategory.Relational;
                    break;
                case SymbolType.LessThanOrEquals:
                    type = OperatorType.LessThanOrEquals;
                    category = OperatorCategory.Relational;
                    break;
                case SymbolType.GreaterThanOrEquals:
                    type = OperatorType.GreaterThanOrEquals;
                    category = OperatorCategory.Relational;
                    break;
                case SymbolType.Plus:
                    type = OperatorType.Plus;
                    category = OperatorCategory.Arithmetic;
                    break;
                case SymbolType.Minus:
                    type = OperatorType.Minus;
                    category = OperatorCategory.Arithmetic;
                    break;
                case SymbolType.Multiplication:
                    type = OperatorType.Multiplication;
                    category = OperatorCategory.Arithmetic;
                    break;
                case SymbolType.Division:
                    type = OperatorType.Division;
                    category = OperatorCategory.Arithmetic;
                    break;
                case SymbolType.Mod:
                    type = OperatorType.Mod;
                    category = OperatorCategory.Arithmetic;
                    break;
                case SymbolType.LeftShift:
                    type = OperatorType.LeftShift;
                    category = OperatorCategory.Shift;
                    break;
                case SymbolType.RightShift:
                    type = OperatorType.RightShift;
                    category = OperatorCategory.Shift;
                    break;
                case SymbolType.Increment:
                    type = OperatorType.Increment;
                    category = OperatorCategory.IncrementDecrement;
                    break;
                case SymbolType.Decrement:
                    type = OperatorType.Decrement;
                    category = OperatorCategory.IncrementDecrement;
                    break;
                case SymbolType.QuestionMark:
                    type = OperatorType.ConditionalQuestionMark;
                    category = OperatorCategory.Conditional;
                    break;
                case SymbolType.Colon:
                    type = OperatorType.ConditionalColon;
                    category = OperatorCategory.Conditional;
                    break;
                case SymbolType.Pointer:
                    type = OperatorType.Pointer;
                    category = OperatorCategory.Reference;
                    break;
                case SymbolType.Dot:
                    type = OperatorType.MemberAccess;
                    category = OperatorCategory.Reference;
                    break;
                case SymbolType.QualifiedAlias:
                    type = OperatorType.QualifiedAlias;
                    category = OperatorCategory.Reference;
                    break;
                case SymbolType.Not:
                    type = OperatorType.Not;
                    category = OperatorCategory.Unary;
                    break;
                case SymbolType.Tilde:
                    type = OperatorType.BitwiseComplement;
                    category = OperatorCategory.Unary;
                    break;
                case SymbolType.Lambda:
                    type = OperatorType.Lambda;
                    category = OperatorCategory.Lambda;
                    break;
                default:
                    // Assign random values.
                    type = OperatorType.AddressOf;
                    category = OperatorCategory.Arithmetic;

                    // Signal that the symbol is not an operator.
                    isOperator = false;
                    break;
            }

            return isOperator;
        }
示例#8
0
 protected UnaryOperatorHandler(OperatorCategory category, UnaryOperator @operator, string name, string verb, string symbol, string fancySymbol, string customMethodName)
     : base(category, name, verb, symbol, fancySymbol, customMethodName)
 {
     this.@operator = @operator;
 }
示例#9
0
        private static bool GetOperatorType(Symbol symbol, out OperatorType type, out OperatorCategory category)
        {
            bool flag = true;
            switch (symbol.SymbolType)
            {
                case SymbolType.Equals:
                    type = OperatorType.Equals;
                    category = OperatorCategory.Assignment;
                    return flag;

                case SymbolType.ConditionalEquals:
                    type = OperatorType.ConditionalEquals;
                    category = OperatorCategory.Relational;
                    return flag;

                case SymbolType.Plus:
                    type = OperatorType.Plus;
                    category = OperatorCategory.Arithmetic;
                    return flag;

                case SymbolType.PlusEquals:
                    type = OperatorType.PlusEquals;
                    category = OperatorCategory.Assignment;
                    return flag;

                case SymbolType.Minus:
                    type = OperatorType.Minus;
                    category = OperatorCategory.Arithmetic;
                    return flag;

                case SymbolType.MinusEquals:
                    type = OperatorType.MinusEquals;
                    category = OperatorCategory.Assignment;
                    return flag;

                case SymbolType.Multiplication:
                    type = OperatorType.Multiplication;
                    category = OperatorCategory.Arithmetic;
                    return flag;

                case SymbolType.MultiplicationEquals:
                    type = OperatorType.MultiplicationEquals;
                    category = OperatorCategory.Assignment;
                    return flag;

                case SymbolType.Division:
                    type = OperatorType.Division;
                    category = OperatorCategory.Arithmetic;
                    return flag;

                case SymbolType.DivisionEquals:
                    type = OperatorType.DivisionEquals;
                    category = OperatorCategory.Assignment;
                    return flag;

                case SymbolType.LessThan:
                    type = OperatorType.LessThan;
                    category = OperatorCategory.Relational;
                    return flag;

                case SymbolType.LessThanOrEquals:
                    type = OperatorType.LessThanOrEquals;
                    category = OperatorCategory.Relational;
                    return flag;

                case SymbolType.LeftShift:
                    type = OperatorType.LeftShift;
                    category = OperatorCategory.Shift;
                    return flag;

                case SymbolType.LeftShiftEquals:
                    type = OperatorType.LeftShiftEquals;
                    category = OperatorCategory.Assignment;
                    return flag;

                case SymbolType.GreaterThan:
                    type = OperatorType.GreaterThan;
                    category = OperatorCategory.Relational;
                    return flag;

                case SymbolType.GreaterThanOrEquals:
                    type = OperatorType.GreaterThanOrEquals;
                    category = OperatorCategory.Relational;
                    return flag;

                case SymbolType.RightShift:
                    type = OperatorType.RightShift;
                    category = OperatorCategory.Shift;
                    return flag;

                case SymbolType.RightShiftEquals:
                    type = OperatorType.RightShiftEquals;
                    category = OperatorCategory.Assignment;
                    return flag;

                case SymbolType.Increment:
                    type = OperatorType.Increment;
                    category = OperatorCategory.IncrementDecrement;
                    return flag;

                case SymbolType.Decrement:
                    type = OperatorType.Decrement;
                    category = OperatorCategory.IncrementDecrement;
                    return flag;

                case SymbolType.LogicalAnd:
                    type = OperatorType.LogicalAnd;
                    category = OperatorCategory.Logical;
                    return flag;

                case SymbolType.AndEquals:
                    type = OperatorType.AndEquals;
                    category = OperatorCategory.Assignment;
                    return flag;

                case SymbolType.ConditionalAnd:
                    type = OperatorType.ConditionalAnd;
                    category = OperatorCategory.Logical;
                    return flag;

                case SymbolType.LogicalOr:
                    type = OperatorType.LogicalOr;
                    category = OperatorCategory.Logical;
                    return flag;

                case SymbolType.OrEquals:
                    type = OperatorType.OrEquals;
                    category = OperatorCategory.Assignment;
                    return flag;

                case SymbolType.ConditionalOr:
                    type = OperatorType.ConditionalOr;
                    category = OperatorCategory.Logical;
                    return flag;

                case SymbolType.LogicalXor:
                    type = OperatorType.LogicalXor;
                    category = OperatorCategory.Logical;
                    return flag;

                case SymbolType.XorEquals:
                    type = OperatorType.XorEquals;
                    category = OperatorCategory.Assignment;
                    return flag;

                case SymbolType.Not:
                    type = OperatorType.Not;
                    category = OperatorCategory.Unary;
                    return flag;

                case SymbolType.NotEquals:
                    type = OperatorType.NotEquals;
                    category = OperatorCategory.Relational;
                    return flag;

                case SymbolType.Mod:
                    type = OperatorType.Mod;
                    category = OperatorCategory.Arithmetic;
                    return flag;

                case SymbolType.ModEquals:
                    type = OperatorType.ModEquals;
                    category = OperatorCategory.Assignment;
                    return flag;

                case SymbolType.Dot:
                    type = OperatorType.MemberAccess;
                    category = OperatorCategory.Reference;
                    return flag;

                case SymbolType.Pointer:
                    type = OperatorType.Pointer;
                    category = OperatorCategory.Reference;
                    return flag;

                case SymbolType.Colon:
                    type = OperatorType.ConditionalColon;
                    category = OperatorCategory.Conditional;
                    return flag;

                case SymbolType.QualifiedAlias:
                    type = OperatorType.QualifiedAlias;
                    category = OperatorCategory.Reference;
                    return flag;

                case SymbolType.QuestionMark:
                    type = OperatorType.ConditionalQuestionMark;
                    category = OperatorCategory.Conditional;
                    return flag;

                case SymbolType.NullCoalescingSymbol:
                    type = OperatorType.NullCoalescingSymbol;
                    category = OperatorCategory.Logical;
                    return flag;

                case SymbolType.Tilde:
                    type = OperatorType.BitwiseCompliment;
                    category = OperatorCategory.Unary;
                    return flag;

                case SymbolType.Lambda:
                    type = OperatorType.Lambda;
                    category = OperatorCategory.Lambda;
                    return flag;
            }
            type = OperatorType.AddressOf;
            category = OperatorCategory.Arithmetic;
            return false;
        }
示例#10
0
 /// <summary>
 /// Sets the proc set.
 /// </summary>
 /// <param name="oc">The oc.</param>
 public void SetProcSet(OperatorCategory oc)
 {
     this.procSet = (byte)(this.procSet | (byte)oc);
 }
示例#11
0
 internal OperatorSymbol(string text, OperatorCategory category, OperatorType symbolType, CodeLocation location, bool generated)
     : base(text, CsTokenType.OperatorSymbol, CsTokenClass.OperatorSymbol, location, generated)
 {
     this.category = category;
     this.symbolType = symbolType;
 }