GetUnaryForm() public static method

public static GetUnaryForm ( OperatorType operatorType ) : OperatorType
operatorType OperatorType
return OperatorType
Ejemplo n.º 1
0
        public override bool Parse(ParseContext context, IAstNode parent)
        {
            Debug.Assert(context.Tokens.CurrentToken.TokenType == RTokenType.Operator);

            OperatorType  = TokenOperator.GetOperatorType(context.TextProvider.GetText(context.Tokens.CurrentToken));
            OperatorToken = RParser.ParseToken(context, this);
            Associativity = OperatorAssociativity.GetAssociativity(OperatorType);

            // If operator is preceded by an operator, it is then unary
            // Look back two tokens since operator parsing already consumed its token.
            if (IsUnary || IsUnaryOperator(context.Tokens, context.TextProvider, OperatorType, -2))
            {
                OperatorType  = Operator.GetUnaryForm(OperatorType);
                IsUnary       = true;
                Associativity = Associativity.Right;
            }
            return(base.Parse(context, parent));
        }