private void SetSelectionIfSelected(SourceSpan span, XMLLuaSearchElement elem) { if (elem.Select) { if (SelectedSpan != null) { throw new Exception("Cannot select more than one AST element!"); } SelectedSpan = span; SelectedElement = elem; } }
public override void FillInChild(XmlNode node) { if (!(node is XmlElement)) { return; } var elem = (XmlElement)node; if (elem.Name == "Where") { LuaInsertTarget = new XMLLuaSearchBlock(); LuaInsertTarget.FillIn(elem); } }
public void ResetSelection() { SelectedSpan = null; SelectedElement = null; }
public bool Match(XMLLuaSearchElement req, object real) { Logger.Debug($"Match element {req} -> object {real}"); if (req is XMLLuaSearchFunctionCall && real is FunctionCall) { return(Match((XMLLuaSearchFunctionCall)req, (FunctionCall)real)); } if (req is XMLLuaSearchAssignment && real is Assignment) { return(Match((XMLLuaSearchAssignment)req, (Assignment)real)); } if (req is XMLLuaSearchReturnStatement && real is ReturnStat) { return(Match((XMLLuaSearchReturnStatement)req, (ReturnStat)real)); } if (req is XMLLuaSearchBreakStatement && real is BreakStat) { return(Match((XMLLuaSearchBreakStatement)req, (BreakStat)real)); } if (req is XMLLuaSearchLocalAssignment && real is LocalAssignment) { return(Match((XMLLuaSearchLocalAssignment)req, (LocalAssignment)real)); } if (req is XMLLuaSearchBlock && real is Block) { return(Match((XMLLuaSearchBlock)req, (Block)real)); } if (req is XMLLuaSearchWhileStatement && real is WhileStat) { return(Match((XMLLuaSearchWhileStatement)req, (WhileStat)real)); } if (req is XMLLuaSearchRepeatStatement && real is RepeatStat) { return(Match((XMLLuaSearchRepeatStatement)req, (RepeatStat)real)); } if (req is XMLLuaSearchNumericFor && real is NumericFor) { return(Match((XMLLuaSearchNumericFor)req, (NumericFor)real)); } if (req is XMLLuaSearchGenericFor && real is GenericFor) { return(Match((XMLLuaSearchGenericFor)req, (GenericFor)real)); } if (req is XMLLuaSearchIfStatement && real is IfStat) { return(Match((XMLLuaSearchIfStatement)req, (IfStat)real)); } if (req is XMLLuaSearchVariable && real is Variable) { return(Match((XMLLuaSearchVariable)req, (Variable)real)); } if (req is XMLLuaSearchStringLiteral && real is StringLiteral) { return(Match((XMLLuaSearchStringLiteral)req, (StringLiteral)real)); } if (req is XMLLuaSearchNumberLiteral && real is NumberLiteral) { return(Match((XMLLuaSearchNumberLiteral)req, (NumberLiteral)real)); } if (req is XMLLuaSearchNilLiteral && real is NilLiteral) { return(Match((XMLLuaSearchNilLiteral)req, (NilLiteral)real)); } if (req is XMLLuaSearchBoolLiteral && real is BoolLiteral) { return(Match((XMLLuaSearchBoolLiteral)req, (BoolLiteral)real)); } if (req is XMLLuaSearchVarargsLiteral && real is VarargsLiteral) { return(Match((XMLLuaSearchVarargsLiteral)req, (VarargsLiteral)real)); } if (req is XMLLuaSearchTableAccess && real is TableAccess) { return(Match((XMLLuaSearchTableAccess)req, (TableAccess)real)); } if (req is XMLLuaSearchFunctionDefinition && real is FunctionDefinition) { return(Match((XMLLuaSearchFunctionDefinition)req, (FunctionDefinition)real)); } if (req is XMLLuaSearchBinaryExpression && real is BinaryExpression) { return(Match((XMLLuaSearchBinaryExpression)req, (BinaryExpression)real)); } if (req is XMLLuaSearchUnaryExpression && real is UnaryExpression) { return(Match((XMLLuaSearchUnaryExpression)req, (UnaryExpression)real)); } if (req is XMLLuaSearchTableConstructor && real is TableConstructor) { return(Match((XMLLuaSearchTableConstructor)req, (TableConstructor)real)); } return(false); }