public override AstNode VisitUnary_expression([NotNull] GLSL_ES300Parser.Unary_expressionContext context)
        {
            var postfix = context.postfix_expression();

            if (postfix != null)
            {
                return(this.VisitPostfix_expression(postfix));
            }

            var result = new ExpressionUnary();

            if (context.Increment() != null)
            {
                result.Operator = Operator.Increment;
            }

            if (context.Decrement() != null)
            {
                result.Operator = Operator.Decrement;
            }

            var unaryOp = context.unary_operator();

            if (unaryOp.Plus() != null)
            {
                result.Operator = Operator.Plus;
            }

            if (unaryOp.Minus() != null)
            {
                result.Operator = Operator.Minus;
            }

            if (unaryOp.Bang() != null)
            {
                result.Operator = Operator.Bang;
            }

            if (unaryOp.Tilde() != null)
            {
                result.Operator = Operator.Tilde;
            }

            result.Right = (Expression)this.Visit(context.unary_expression());

            return(result);
        }
Пример #2
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="GLSL_ES300Parser.unary_expression"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitUnary_expression([NotNull] GLSL_ES300Parser.Unary_expressionContext context)
 {
     return(VisitChildren(context));
 }