public override object VisitReturnStatement(ReturnStatementContext context) { if (context.tupleExpression() != null) { var r = (Result)(Visit(context.tupleExpression())); return((new System.Text.StringBuilder().Append("return ").Append(r.text).Append(Terminate).Append(Wrap)).to_str()); } return((new System.Text.StringBuilder().Append("return").Append(Terminate).Append(Wrap)).to_str()); }
public override object VisitReturnStatement([NotNull] ReturnStatementContext context) { var r = (Result)Visit(context.tuple()); if (r.text == "()") { r.text = ""; } return($"return {r.text} {Terminate} {Wrap}"); }
public ReturnStatement ParseReturnStatement(ReturnStatementContext node) { ReturnStatement statement = new ReturnStatement(); foreach (var child in node.children) { if (child is PredicateExpressionContext predicate) { statement.Value = new TokenInfo(predicate); } } return(statement); }
public override void EnterReturnStatement([NotNull] ReturnStatementContext context) { ReturnStatement returnStatement = new ReturnStatement(Parent, context); if (context.expression() != null) { ExpressionListener listener = new ExpressionListener(returnStatement); context.expression().EnterRule(listener); returnStatement.Value = listener.GetResult(); } Result.Add(returnStatement); }
private void ParseReturnStatement(ReturnStatementContext node) { foreach (var child in node.children) { if (child is PredicateExpressionContext predicate) { this.ParsePredicateExpression(predicate); } else if (child is TerminalNodeImpl terminalNode) { string text = terminalNode.GetText(); this.Write(text, terminalNode.Symbol.Type == MySqlParser.RETURN ? this.indent: 0); } } }
public override ReturnStatementNode VisitReturnStatement([NotNull] ReturnStatementContext context) { var expr = VisitExpr(context.expr()); return(new ReturnStatementNode(expr, GetLocation(context))); }