Replace std.SegmentedList by std.ArrayList

This commit is contained in:
Robin Voetter
2020-12-01 14:17:04 +01:00
parent 7fdb6eaad3
commit 9aa2899f06
3 changed files with 47 additions and 27 deletions

View File

@@ -156,22 +156,22 @@ pub const CTokenizer = struct {
};
pub const XmlCTokenizer = struct {
it: xml.Element.ContentList.Iterator,
it: xml.Element.ChildIterator,
ctok: ?CTokenizer = null,
current: ?Token = null,
pub fn init(elem: *xml.Element) XmlCTokenizer {
return .{
.it = elem.children.iterator(0),
.it = elem.iterator(),
};
}
fn elemToToken(elem: *xml.Element) !?Token {
if (elem.children.count() != 1 or elem.children.at(0).* != .CharData) {
if (elem.children.items.len != 1 or elem.children.items[0] != .CharData) {
return error.InvalidXml;
}
const text = elem.children.at(0).CharData;
const text = elem.children.items[0].CharData;
if (mem.eql(u8, elem.tag, "type")) {
return Token{.kind = .type_name, .text = text};
} else if (mem.eql(u8, elem.tag, "enum")) {