public string Visit(ExpressionUnary node) { var sb = new StringBuilder(); var nodeName = node[0][0].AnchorToken.Lexeme; var minus = 0; if (nodeName == "-") { Visit((dynamic)node[0]); minus = 1; } if (numMinus % 2 == 1) { sb.Append(" i32.const 0\n"); } sb.Append(Visit((dynamic)node[1])); if (minus == 0) { sb.Append(Visit((dynamic)node[0])); } else if (numMinus % 2 == 1) { sb.Append(" i32.sub\n"); } numMinus = 0; return(sb.ToString()); }
public override void VisitExpressionUnary(ExpressionUnary node, CloningAstVisitorContext context) { context.Result = new ExpressionUnary() { Operator = node.Operator, Right = this.CloneNode(node.Right, context) }; }
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); }
public Node ExpressionUnary() { if (firstOfOperatorUnary.Contains(CurrentToken)) { var result = new ExpressionUnary(); var opUL = new OpUnaryList(); while (firstOfOperatorUnary.Contains(CurrentToken)) { opUL.Add(OpUnary()); } result.Add(opUL); var expr = ExpressionPrimary(); result.Add(expr); return(result); } return(ExpressionPrimary()); }
public void Visit(ExpressionUnary node) { }
public virtual void VisitExpressionUnary(ExpressionUnary node, TContext context) { this.Visit(node.Right, context); }
public override void VisitExpressionUnary(ExpressionUnary node, AstPrinterContext context) { context.Write(this.GetOperatorString(node.Operator)); this.Visit(node.Right, context); }
public void Visit(ExpressionUnary node) { VisitChildren(node); }
public string Visit(ExpressionUnary node) { return(VisitChildren(node)); }