public override void VisitAfter(ExtractFuncExpr expr) { if (IsPlaceHolderExpr(expr.Argument)) { expr.Argument = Place((PlaceHolderExpr)expr.Argument); } }
public override void ExitExtract_function(MiniSqlParserParser.Extract_functionContext context) { var comments = this.GetComments(context); var datetimeComments = this.GetComments(context.datetimeField()); comments.InsertRange(2, datetimeComments); Expr arg = null; bool isComma = false; if (context.expr() != null) { arg = (Expr)_stack.Pop(); isComma = context.K_FROM() == null; } DateTimeField dt = DateTimeField.Day; var datetimeContext = context.datetimeField(); if (datetimeContext.K_DAY() != null) { dt = DateTimeField.Day; } else if (datetimeContext.K_YEAR() != null) { dt = DateTimeField.Year; } else if (datetimeContext.K_MONTH() != null) { dt = DateTimeField.Month; } else if (datetimeContext.K_HOUR() != null) { dt = DateTimeField.Hour; } else if (datetimeContext.K_MINUTE() != null) { dt = DateTimeField.Minute; } else if (datetimeContext.K_SECOND() != null) { dt = DateTimeField.Second; } else { throw new CannotBuildASTException("Undefined DateTimeField is used in EXTRACT function"); } var name = context.K_EXTRACT().GetText(); var node = new ExtractFuncExpr(name, dt, isComma, arg, comments); _stack.Push(node); }
public override void VisitAfter(ExtractFuncExpr expr) { Expr arg = (Expr)_stack.Pop(); if (object.ReferenceEquals(expr.Argument, arg)) { _stack.Push(expr); return; } var node = new ExtractFuncExpr(expr.Name , expr.DateTimeField , expr.SeparatorIsComma, arg); _stack.Push(node); }
virtual public void VisitOnSeparator(ExtractFuncExpr expr, int offset) { }
virtual public void VisitAfter(ExtractFuncExpr expr) { }
virtual public void VisitBefore(ExtractFuncExpr expr) { }
public void VisitOnSeparator(ExtractFuncExpr expr, int offset) { _visitor.VisitOnSeparator(expr, offset); }
public void VisitAfter(ExtractFuncExpr expr) { _visitor.VisitAfter(expr); }
public void VisitBefore(ExtractFuncExpr expr) { _visitor.VisitBefore(expr); }