def separator(parser=comma): """Expects a comma separation. >>> parse(separator, ', ') ',' >>> parse(separator, ' ,') ',' """ return lexeme(parser)
def attribute(): name = xml_name() commit() lexeme(equals) return "ATTR", name, quoted()
def xmldecl_attr(name, parser): string(name) lexeme(equals) value = quoted(version_num) return value
def element(): open_angle() name = xml_name() commit() attributes = lexeme(partial(sep, attribute, whitespace1)) return "NODE", name, attributes, choice(closed_element, partial(open_element, name))
def xml(): prolog() n = lexeme(element) eof() return n