public override void FillIn(XmlElement elem) { base.FillIn(elem); Full = elem.GetAttribute("full") == "1"; for (var i = 0; i < elem.ChildNodes.Count; i++) { var child = elem.ChildNodes[i]; if (child.Name == "Statements") { Statements = new List <IXMLLuaSearchStatement>(); for (var j = 0; j < child.ChildNodes.Count; j++) { var innerchild = child.ChildNodes[j]; var st = LuaSearchXMLTypes.GetStatement(innerchild.Name); if (st == null) { throw new Exception($"Invalid Lua AST element '{innerchild.Name}'"); } st.FillIn(innerchild as XmlElement); Statements.Add(st); } } } }
public override void FillIn(XmlElement elem) { base.FillIn(elem); var op = elem.GetAttribute("operation"); if (op != null) { Operation = (NetLua.Ast.BinaryOp)Enum.Parse(typeof(NetLua.Ast.BinaryOp), op, true); } for (var i = 0; i < elem.ChildNodes.Count; i++) { var child = elem.ChildNodes[i]; if (child.Name == "Left" && child.ChildNodes.Count > 0) { var left = child.ChildNodes[0]; Left = LuaSearchXMLTypes.GetExpression(left.Name); Left.FillIn(left as XmlElement); } else if (child.Name == "Right" && child.ChildNodes.Count > 0) { var right = child.ChildNodes[0]; Right = LuaSearchXMLTypes.GetExpression(right.Name); Right.FillIn(right as XmlElement); } } }
public override void FillIn(XmlElement elem) { base.FillIn(elem); for (var i = 0; i < elem.ChildNodes.Count; i++) { var child = elem.ChildNodes[i]; if (child.Name == "Names") { Names = new List <string>(); for (var j = 0; j < child.ChildNodes.Count; j++) { var innerchild = child.ChildNodes[i]; if (innerchild is XmlElement && ((XmlElement)innerchild).Name == "Name" && ((XmlElement)innerchild).HasAttribute("value")) { Names.Add(((XmlElement)innerchild).GetAttribute("value")); } } } else if (child.Name == "Expressions") { Expressions = new List <IXMLLuaSearchExpression>(); for (var j = 0; j < child.ChildNodes.Count; j++) { var innerchild = child.ChildNodes[i]; var expr = LuaSearchXMLTypes.GetExpression(innerchild.Name); expr.FillIn(innerchild as XmlElement); } } } }
public override void FillIn(XmlElement elem) { base.FillIn(elem); for (var i = 0; i < elem.ChildNodes.Count; i++) { var child = elem.ChildNodes[i]; if (child.Name == "Variables") { Variables = new List <IXMLLuaSearchAssignable>(); for (var j = 0; j < child.ChildNodes.Count; j++) { var innerchild = child.ChildNodes[j]; var ass = LuaSearchXMLTypes.GetAssignable(innerchild.Name); ass.FillIn(innerchild as XmlElement); Variables.Add(ass); } } else if (child.Name == "Expressions") { Expressions = new List <IXMLLuaSearchExpression>(); for (var j = 0; j < child.ChildNodes.Count; j++) { var innerchild = child.ChildNodes[j]; var expr = LuaSearchXMLTypes.GetExpression(innerchild.Name); expr.FillIn(innerchild as XmlElement); Expressions.Add(expr); } } } }
public override void FillIn(XmlElement elem) { base.FillIn(elem); for (var i = 0; i < elem.ChildNodes.Count; i++) { var child = elem.ChildNodes[i]; if (child.Name == "Condition" && child.ChildNodes.Count > 0) { var cond = child.ChildNodes[0]; Condition = LuaSearchXMLTypes.GetExpression(cond.Name, cond as XmlElement); } else if (child.Name == "Block") { Block = new XMLLuaSearchBlock(); Block.FillIn(child as XmlElement); } else if (child.Name == "ElseBlock") { Else = new XMLLuaSearchBlock(); Else.FillIn(child as XmlElement); } else if (child.Name == "ElseIfs") { ElseIfs = new List <XMLLuaSearchIfStatement>(); for (var j = 0; j < child.ChildNodes.Count; j++) { var innerchild = child.ChildNodes[j]; var ifstat = new XMLLuaSearchIfStatement(); ifstat.FillIn(innerchild as XmlElement); } } } }
public override void FillIn(XmlElement elem) { base.FillIn(elem); for (var i = 0; i < elem.ChildNodes.Count; i++) { var child = elem.ChildNodes[i]; if (child.Name == "Function" && child.ChildNodes.Count > 0) { var func = child.ChildNodes[i]; Function = LuaSearchXMLTypes.GetExpression(func.Name); Function.FillIn(func as XmlElement); } else if (child.Name == "Arguments") { Arguments = new List <IXMLLuaSearchExpression>(); for (var j = 0; j < child.ChildNodes.Count; j++) { var innerchild = child.ChildNodes[j]; var expr = LuaSearchXMLTypes.GetExpression(innerchild.Name); expr.FillIn(innerchild as XmlElement); Arguments.Add(expr); } } } }
public override void FillIn(XmlElement elem) { base.FillIn(elem); Name = elem.GetAttribute("name"); for (var i = 0; i < elem.ChildNodes.Count; i++) { var child = elem.ChildNodes[i]; if (child.Name == "Prefix" && child.ChildNodes.Count > 0) { var expr = child.ChildNodes[0]; Prefix = LuaSearchXMLTypes.GetExpression(expr.Name, expr as XmlElement); } } }
public void FillIn(XmlElement elem) { for (var i = 0; i < elem.ChildNodes.Count; i++) { var child = elem.ChildNodes[i]; if (child.Name == "Key" && child.ChildNodes.Count > 0) { var key = child.ChildNodes[0]; Key = LuaSearchXMLTypes.GetExpression(key.Name, key as XmlElement); } else if (child.Name == "Value" && child.ChildNodes.Count > 0) { var value = child.ChildNodes[0]; Value = LuaSearchXMLTypes.GetExpression(value.Name, value as XmlElement); } } }
public override void FillIn(XmlElement elem) { base.FillIn(elem); for (var i = 0; i < elem.ChildNodes.Count; i++) { var child = elem.ChildNodes[i]; if (child.Name == "Condition" && child.ChildNodes.Count > 0) { var expr = child.ChildNodes[0]; Condition = LuaSearchXMLTypes.GetExpression(expr.Name, expr as XmlElement); } else if (child.Name == "Block") { Block = new XMLLuaSearchBlock(); Block.FillIn(child as XmlElement); } } }
public override void FillIn(XmlElement elem) { base.FillIn(elem); for (var i = 0; i < elem.ChildNodes.Count; i++) { var child = elem.ChildNodes[i]; if (child.Name == "Table" && child.ChildNodes.Count > 0) { var tab = child.ChildNodes[0]; Table = LuaSearchXMLTypes.GetExpression(tab.Name, tab as XmlElement); } else if (child.Name == "Index" && child.ChildNodes.Count > 0) { var idx = child.ChildNodes[0]; Index = LuaSearchXMLTypes.GetExpression(idx.Name, idx as XmlElement); } } }
public override void FillIn(XmlElement elem) { base.FillIn(elem); for (var i = 0; i < elem.ChildNodes.Count; i++) { var child = elem.ChildNodes[i]; if (child.Name == "Expressions") { Expressions = new List <IXMLLuaSearchExpression>(); for (var j = 0; j < child.ChildNodes.Count; j++) { var innerchild = child.ChildNodes[i]; var expr = LuaSearchXMLTypes.GetExpression(innerchild.Name); expr.FillIn(innerchild as XmlElement); } } } }
public override void FillIn(XmlElement elem) { base.FillIn(elem); var op = elem.GetAttribute("operation"); if (op != null) { Operation = (NetLua.Ast.UnaryOp)Enum.Parse(typeof(NetLua.Ast.UnaryOp), op, true); } for (var i = 0; i < elem.ChildNodes.Count; i++) { var child = elem.ChildNodes[i]; if (child.Name == "Expression" && child.ChildNodes.Count > 0) { var expr = child.ChildNodes[0]; Expression = LuaSearchXMLTypes.GetExpression(expr.Name, expr as XmlElement); } } }
public override void FillIn(XmlElement elem) { base.FillIn(elem); for (var i = 0; i < elem.ChildNodes.Count; i++) { var child = elem.ChildNodes[i]; if (child.Name == "Var" && child.ChildNodes.Count > 0) { var @var = child.ChildNodes[0]; Var = LuaSearchXMLTypes.GetExpression(@var.Name, @var as XmlElement); } else if (child.Name == "Limit" && child.ChildNodes.Count > 0) { var @var = child.ChildNodes[0]; Limit = LuaSearchXMLTypes.GetExpression(@var.Name, @var as XmlElement); } else if (child.Name == "Step" && child.ChildNodes.Count > 0) { var @var = child.ChildNodes[0]; Step = LuaSearchXMLTypes.GetExpression(@var.Name, @var as XmlElement); } else if (child.Name == "Variable" && child.ChildNodes.Count > 0) { var @var = child.ChildNodes[0]; if (!(@var is XmlText)) { continue; } Variable = ((XmlText)@var).Value; } else if (child.Name == "Block") { Block = new XMLLuaSearchBlock(); Block.FillIn(child as XmlElement); } } }