コード例 #1
0
ファイル: Function.cs プロジェクト: hwdef/feel-csharp
 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());
 }
コード例 #2
0
        public override object VisitReturnStatement([NotNull] ReturnStatementContext context)
        {
            var r = (Result)Visit(context.tuple());

            if (r.text == "()")
            {
                r.text = "";
            }
            return($"return {r.text} {Terminate} {Wrap}");
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
                }
            }
        }
コード例 #6
0
        public override ReturnStatementNode VisitReturnStatement([NotNull] ReturnStatementContext context)
        {
            var expr = VisitExpr(context.expr());

            return(new ReturnStatementNode(expr, GetLocation(context)));
        }