/// <summary> /// 根据读取到param语法内容创建参数 /// </summary> /// <param name="ctx">读取到的语法内容</param> /// <returns>创建的参数</returns> public Param CreateParam(InterpreterParser.ParamContext ctx) { if (ctx.ID().Length == 1) { return(new IdParam(ctx.ID()[0].GetText())); } else if (ctx.ID().Length == 2) { return(new IdIdParam(ctx.ID()[0].GetText(), ctx.ID()[1].GetText())); } else if (ctx.NUM() != null) { return(new NumParam(int.Parse(ctx.NUM().GetText()))); } else if (ctx.STRING() != null) { return(new StringParam(ctx.STRING().GetText())); } else if (ctx.expr() != null) { return(new QueryParam(lastQuery)); } else { throw new Exception("不支持的参数"); } }
public override void ExitParam([NotNull] InterpreterParser.ParamContext context) { ParamStack.Push(CreateParam(context)); ParamsStack.Peek().Add(ParamStack.Pop()); }
public override void EnterParam([NotNull] InterpreterParser.ParamContext context) { }