Beispiel #1
0
def separator(parser=comma):
    """Expects a comma separation.

    >>> parse(separator, ', ')
    ','
    >>> parse(separator, ' ,')
    ','
    """

    return lexeme(parser)
Beispiel #2
0
def attribute():
    name = xml_name()
    commit()
    lexeme(equals)
    return "ATTR", name, quoted()
Beispiel #3
0
def xmldecl_attr(name, parser):
    string(name)
    lexeme(equals)
    value = quoted(version_num)
    return value
Beispiel #4
0
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))
Beispiel #5
0
def xml():
    prolog()
    n = lexeme(element)
    eof()
    return n
Beispiel #6
0
def attribute():
    name = xml_name()
    commit()
    lexeme(equals)
    return "ATTR", name, quoted()
Beispiel #7
0
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))
Beispiel #8
0
def xmldecl_attr(name, parser):
    string(name)
    lexeme(equals)
    value = quoted(version_num)
    return value
Beispiel #9
0
def xml():
    prolog()
    n = lexeme(element)
    eof()
    return n