def code(): return pg.AllOf( pg.Ignore("`"), pg.Join( pg.Many( pg.Not("`"))), pg.Ignore("`"))
def test_match_join(): three_times_a = pg.Join(pg.CountOf(3, "a")) data = "aaa" expected = ['three_times_a', "aaa"] match, rest = pg.match_join(data, three_times_a, 'three_times_a') assert match == expected assert rest == "" not_d = pg.Join(pg.Many(pg.Not("d"))) data = "abcd" expected = ['not_d', "abc"] match, rest = pg.match_join(data, not_d, 'not_d') assert match == expected assert rest == "d"
def link_text(): return pg.AllOf( pg.Ignore("["), pg.Join( pg.Many( pg.Not("]"))), pg.Ignore("]"))
def link_url(): return pg.AllOf( pg.Ignore("("), pg.Join( pg.Many( pg.Not(")"))), pg.Ignore(")"))
def text(): return pg.AllOf(pg.Ignore("| "), pg.Join(pg.Many(pg.Not(newline_or_eof))), pg.Ignore(newline_or_eof))
def code_line(): return pg.Escaped( pg.Join( pg.Many( pg.Not("\n"))))
def code_block(): return pg.AllOf(pg.Ignore("!="), pg.Join(pg.Many(pg.Not(newline_or_eof))), pg.Ignore(newline_or_eof))
def comment(): return pg.AllOf(pg.Optional(pg.Ignore(pg.Many(" "))), pg.Ignore("// "), pg.Join(pg.Many(pg.Not(newline_or_eof))), pg.Ignore(newline_or_eof))
def content(): return pg.AllOf(pg.Ignore(pg.OneOf(" | ", " ")), pg.Join(pg.Many(pg.Not(newline_or_eof))))
def attribute_value_code(): return pg.OneOf( pg.AllOf(pg.Ignore("{{"), pg.Join(pg.Many(pg.Not("}}"))), pg.Ignore("}}")), identifier_parts)
def quoted_string(): return pg.OneOf( pg.AllOf(pg.Ignore("'"), pg.Optional(pg.Join(pg.Many(pg.Not("'")))), pg.Ignore("'")), pg.AllOf(pg.Ignore('"'), pg.Optional(pg.Join(pg.Many(pg.Not('"')))), pg.Ignore('"')))