private static void changeCommonLeafNodeType(FilterTree tree, int newType, int newOp, int newConst, string newValue) { if (tree.Type == newType || !tree.IsLeaf) { return; } FilterTree op = (FilterTree)tree.Children[0]; op.Type = newOp; if (!(op is SQLTree)) { tree.SetChild(0, new SQLTree(op)); } // do conversions FilterTree constant = (FilterTree)tree.Children[0].GetChild(1); constant.Type = newConst; constant.Text = newValue; if (!(constant is SQLTree)) { tree.Children[0].SetChild(1, new SQLTree(constant)); } tree.Type = newType; ((FilterTree)tree.Children[0].GetChild(0)).MarkAsDirty(); }
public static void ToStringExpr(FilterTree tree) { if (tree.Type == SQLFilterLexer.STRING_EXPR || !tree.IsLeaf) { return; } FilterTree op = (FilterTree)tree.Children[0]; op.Type = StringPatternLexer.IS; if (!(op is StringTree)) { tree.SetChild(0, new StringTree(op)); } // do conversions FilterTree constant = (FilterTree)tree.Children[0].GetChild(1); constant.Type = StringPatternLexer.TEXT; constant.Text = ""; if (!(constant is StringTree)) { tree.Children[0].SetChild(1, new StringTree(constant)); } tree.Type = SQLFilterLexer.STRING_EXPR; ((FilterTree)tree.Children[0].GetChild(0)).MarkAsDirty(); }
private static void changeCommonLeafNodeType(FilterTree tree, int newType, int newOp, int newConst, string newValue) { if (tree.Type == newType || !tree.IsLeaf) return; FilterTree op = (FilterTree)tree.Children[0]; op.Type = newOp; if (!(op is SQLTree)) tree.SetChild(0, new SQLTree(op)); // do conversions FilterTree constant = (FilterTree)tree.Children[0].GetChild(1); constant.Type = newConst; constant.Text = newValue; if (!(constant is SQLTree)) tree.Children[0].SetChild(1, new SQLTree(constant)); tree.Type = newType; ((FilterTree)tree.Children[0].GetChild(0)).MarkAsDirty(); }
public static void ToStringExpr(FilterTree tree) { if (tree.Type == SQLFilterLexer.STRING_EXPR || !tree.IsLeaf) return; FilterTree op = (FilterTree)tree.Children[0]; op.Type = StringPatternLexer.IS; if (!(op is StringTree)) tree.SetChild(0, new StringTree(op)); // do conversions FilterTree constant = (FilterTree)tree.Children[0].GetChild(1); constant.Type = StringPatternLexer.TEXT; constant.Text = ""; if (!(constant is StringTree)) tree.Children[0].SetChild(1, new StringTree(constant)); tree.Type = SQLFilterLexer.STRING_EXPR; ((FilterTree)tree.Children[0].GetChild(0)).MarkAsDirty(); }