Beispiel #1
0
def end_element(name):
    whitespace()
    string("</")
    commit()
    if name != xml_name():
        fail()
    whitespace()
    close_angle()
Beispiel #2
0
def end_element(name):
    whitespace()
    string("</")
    commit()
    if name != xml_name():
        fail()
    whitespace()
    close_angle()
Beispiel #3
0
def processing(parser=False):
    parser = parser or compose(build_string, partial(many, partial(not_one_of, "?")))

    string("<?")
    commit()
    result = parser()
    whitespace()

    string("?>")
    return result
Beispiel #4
0
def processing(parser = False):
    parser = parser or compose(build_string, partial(many, partial(not_one_of, '?')))

    string('<?')
    commit()
    result = parser()
    whitespace()
    
    string('?>')
    return result
Beispiel #5
0
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()))
Beispiel #6
0
def closed_element():
    string("/>")
    return []
Beispiel #7
0
def doctype():
    string("<!DOCTYPE")
    commit()
    many_until(any_token, close_angle)
Beispiel #8
0
def comment():
    string("<!--")
    commit()
    result, _ = many_until(any_token, tri(partial(string, "-->")))
    return "COMMENT", build_string(result)
Beispiel #9
0
def xmldecl_attr(name, parser):
    string(name)
    lexeme(equals)
    value = quoted(version_num)
    return value
Beispiel #10
0
def special(name):
  whitespace()
  string(name)
  return name
Beispiel #11
0
def closed_element():
    string('/>')
    return []
Beispiel #12
0
def doctype():
    string('<!DOCTYPE')
    commit()
    many_until(any_token, close_angle)
Beispiel #13
0
def comment():
    string("<!--")
    commit()
    result, _ = many_until(any_token, tri(partial(string, "-->")))
    return "COMMENT", build_string(result)
Beispiel #14
0
def version_num():
    string('1.')
    return "1." + build_string(many1(decimal_digit))
Beispiel #15
0
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()))
Beispiel #16
0
def reserved_op(name):
  assert name in reserved_operators
  whitespace()
  string(name)
  not_followed_by(operator_char)
  return name
Beispiel #17
0
def xmldecl_attr(name, parser):
    string(name)
    lexeme(equals)
    value = quoted(version_num)
    return value
Beispiel #18
0
def reserved(name):
  assert name in reserved_words
  whitespace()
  string(name)
  not_followed_by(identifier_char)
  return name
Beispiel #19
0
def version_num():
    string("1.")
    return "1." + build_string(many1(decimal_digit))