public void Parse(LexemCollection collection) { while (true) { var idx = collection.IndexLexem; ExpressionParser tonode = new ExpressionParser(collection); tonode.Parse(); if (tonode.Results.Count != 1) { collection.Error("не верное число параметров", collection.Get(idx)); } ColumnClause r = new ColumnClause(); r.ColumnExpression = tonode.Single(); Columns.Add(r); var lex = collection.CurrentLexem(); if (lex == null) { return; } if (lex.LexemText.ToLower() == "as") { collection.GotoNext(); if (lex == null) { return; } r.Alias = CommonParserFunc.ReadAlias(collection); lex = collection.GotoNext(); } else if (nextStrings.Contains(lex.LexemText.ToLower())) { return; } else { if (lex.LexemType == LexType.Command || lex.LexemType == LexType.Text) { r.Alias = CommonParserFunc.ReadAlias(collection); lex = collection.GotoNext(); } } if (lex == null) { return; } if (nextStrings.Contains(lex.LexemText.ToLower())) { return; } if (lex.LexemType == LexType.Zpt) { collection.GotoNext(); continue; } return; } }
public override IExplore Expolore(DelegateExpessionExplorer del) { if (TableClause != null) { TableClause = (TableClause)TableClause.Expolore(del); } List <ColumnClause> Returning2 = new List <ColumnClause>(); ReturningColumns.ForEach(a => { ColumnClause ss = (ColumnClause)a.Expolore(del); if (ss != null) { Returning2.Add(ss); } }); ReturningColumns.Replace(Returning2); return(base.Expolore(del)); }
public static string GetVisibleColumnName(ColumnClause cs) { string nm = cs.Alias; if (String.IsNullOrEmpty(nm)) { if (cs.ColumnExpression is ReplacedFieldExpr) { nm = ((ReplacedFieldExpr)cs.ColumnExpression).Field.FieldName; } else if (cs.ColumnExpression is FieldExpr) { nm = ((FieldExpr)cs.ColumnExpression).FieldName; } else { nm = cs.ColumnExpression.ToStr(); } } return(nm); }