def end_element(name): whitespace() string("</") commit() if name != xml_name(): fail() whitespace() close_angle()
def processing(parser=False): parser = parser or compose(build_string, partial(many, partial(not_one_of, "?"))) string("<?") commit() result = parser() whitespace() string("?>") return result
def processing(parser = False): parser = parser or compose(build_string, partial(many, partial(not_one_of, '?'))) string('<?') commit() result = parser() whitespace() string('?>') return result
def caseless_string(s): """Attempts to match input to the letters in the string, without regard for case. """ return string(zip(s.lower(), s.upper()))
def closed_element(): string("/>") return []
def doctype(): string("<!DOCTYPE") commit() many_until(any_token, close_angle)
def comment(): string("<!--") commit() result, _ = many_until(any_token, tri(partial(string, "-->"))) return "COMMENT", build_string(result)
def xmldecl_attr(name, parser): string(name) lexeme(equals) value = quoted(version_num) return value
def special(name): whitespace() string(name) return name
def closed_element(): string('/>') return []
def doctype(): string('<!DOCTYPE') commit() many_until(any_token, close_angle)
def version_num(): string('1.') return "1." + build_string(many1(decimal_digit))
def reserved_op(name): assert name in reserved_operators whitespace() string(name) not_followed_by(operator_char) return name
def reserved(name): assert name in reserved_words whitespace() string(name) not_followed_by(identifier_char) return name
def version_num(): string("1.") return "1." + build_string(many1(decimal_digit))