static void getChildren(string source, ref int index, Values.XML xml) { Parser parser = new XMLParser(); while (parser.Scan(source, index)) { xml.AddChild((Values.XML)parser.Result.Value); index = parser.Result.Position; } var matcher = new Matcher(); if (matcher.IsMatch(source.Substring(index), @"^\s*<%%")) { var openLength = matcher[0].Length; Color(index, openLength, IDEColor.EntityType.Structure); index += openLength; xml.Children = OrangeCompiler.Block(source, ref index, "%>"); } parser = new IndirectXMLParser(); while (parser.Scan(source, index)) { xml.AddChild((Values.XML)parser.Result.Value); index = parser.Result.Position; } }
public override Verb CreateVerb(string[] tokens) { Color(position, length, IDEColor.EntityType.Structure); var index = position + length; Parser parser = new IndexerParser(); if (parser.Scan(source, index)) { result.Value = parser.Result.Value; overridePosition = parser.Result.Position; return(parser.Result.Verb); } var name = getName(source, ref index); Block attributes; parser = new XMLAttributesParser(); if (parser.Scan(source, index)) { attributes = (Block)parser.Result.Value; index = parser.Result.Position; } else { attributes = null; } var innerText = getInnerText(source, ref index); var xml = new Values.XML(name, attributes, innerText); getChildren(source, ref index, xml); var matcher = new Matcher(); Runtime.Assert(matcher.IsMatch(source.Substring(index), @"^\s*%>"), LOC_XML_PARSER, "XML not properly terminated"); var terminatorLength = matcher[0].Length; Color(terminatorLength, IDEColor.EntityType.Structure); result.Value = xml; overridePosition = index + terminatorLength; return(new Push(xml)); }