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