HaxePositionCompleteResult ExtractPos(XmlTextReader reader) { var result = new HaxePositionCompleteResult(); string value = ReadValue(reader); Match match = rePosition.Match(value); result.Path = match.Groups["path"].Value; int.TryParse(match.Groups["line"].Value, out result.LineStart); string rangeType = match.Groups["range"].Value; if (rangeType == "lines") { result.RangeType = HaxePositionCompleteRangeType.LINES; } else { result.RangeType = HaxePositionCompleteRangeType.CHARACTERS; } int start = 0; int end = 0; int.TryParse(match.Groups["start"].Value, out start); int.TryParse(match.Groups["end"].Value, out end); if (result.RangeType == HaxePositionCompleteRangeType.LINES) { result.LineStart = start; result.LineEnd = end; } else { result.CharacterStart = start; result.CharacterEnd = end; } return(result); }
HaxeCompleteStatus ProcessList(XmlTextReader reader) { result = new HaxeCompleteResult(); result.Members = new MemberList(); MemberModel member = null; while (reader.Read()) { if (reader.NodeType == XmlNodeType.EndElement) { switch (reader.Name) { case "list": result.Members.Sort(); return(HaxeCompleteStatus.MEMBERS); case "i": member = null; break; } continue; } else if (reader.NodeType != XmlNodeType.Element) { continue; } switch (reader.Name) { case "i": member = ExtractMember(reader); break; case "d": if (member == null) { continue; } member.Comments = ReadValue(reader); break; case "t": if (member == null) { continue; } ExtractType(reader, member); if (!IsOverload(result.Members, member)) { result.Members.Add(member); } break; case "pos": positionResult = ExtractPos(reader); return(HaxeCompleteStatus.POSITION); } } result.Members.Sort(); return(HaxeCompleteStatus.MEMBERS); }