replaced ... to pp.skipTo

This commit is contained in:
vicky 2022-03-16 16:23:25 +01:00
parent 29609e1a9b
commit 3c5bfc6a5c
1 changed files with 9 additions and 9 deletions

View File

@ -196,13 +196,13 @@ optional = (
# Enhanced text elements # Enhanced text elements
et_em = (pp.Literal('*') + ... + '*')('em').add_parse_action(of_type(EtEmToken)) et_em = (pp.Literal('*') + pp.SkipTo('*'))('em').add_parse_action(of_type(EtEmToken))
et_strong = (pp.Literal('**') + ... + '**')('strong').add_parse_action(of_type(EtStrongToken)) et_strong = (pp.Literal('**') + pp.SkipTo('**'))('strong').add_parse_action(of_type(EtStrongToken))
et_underline = (pp.Literal('__') + ... + '__')('underline').add_parse_action(of_type(EtUnderlineToken)) et_underline = (pp.Literal('__') + pp.SkipTo('__'))('underline').add_parse_action(of_type(EtUnderlineToken))
et_strikethrough = (pp.Literal('~~') + ... + '~~')('strikethrough').add_parse_action(of_type(EtStrikethroughToken)) et_strikethrough = (pp.Literal('~~') + pp.SkipTo('~~'))('strikethrough').add_parse_action(of_type(EtStrikethroughToken))
custom_span = ('(#' + pp.Word(pp.nums)('span_id') + ')').set_name('span_tag') custom_span = ('(#' + pp.Word(pp.nums)('span_id') + ')').set_name('span_tag')
et_custom_span = ( et_custom_span = (
custom_span + ... + pp.match_previous_literal(custom_span) custom_span + pp.SkipTo(pp.match_previous_literal(custom_span))
)('custom_span').add_parse_action(of_type(EtCustomSpanToken)) )('custom_span').add_parse_action(of_type(EtCustomSpanToken))
# enhanced_text <== (text | et_strong | et_em | et_underline | # enhanced_text <== (text | et_strong | et_em | et_underline |
# et_strikethrough | et_custom_span) + pp.Opt(enhanced_text) # et_strikethrough | et_custom_span) + pp.Opt(enhanced_text)
@ -217,16 +217,16 @@ il_link = pp.Literal('[') + ... + pp.Literal('](') + quotes + url_characters + p
# Oneline elements # Oneline elements
one_header = ( one_header = (
header_element + ... + pp.match_previous_literal(header_element) header_element + pp.SkipTo(pp.match_previous_literal(header_element))
).add_parse_action(of_type(HeaderToken)) ).add_parse_action(of_type(HeaderToken))
one_display = ( one_display = (
display_element + ... + pp.match_previous_literal(display_element) display_element + pp.SkipTo(pp.match_previous_literal(display_element))
).add_parse_action(of_type(DisplayToken)) ).add_parse_action(of_type(DisplayToken))
one_olist = pp.line_start + ( one_olist = pp.line_start + (
pp.Literal('#') + pps('.') + ...('olist_text') + pp.line_end pp.Literal('#') + pps('.') + pp.SkipTo(pp.line_end)('olist_text')
).add_parse_action(of_type(EtOlistToken)) ).add_parse_action(of_type(EtOlistToken))
one_ulist = pp.line_start + ( one_ulist = pp.line_start + (
pp.Literal('-') + ...('ulist_text') + pp.line_end pp.Literal('-') + pp.SkipTo(pp.line_end)('ulist_text')
).add_parse_action(of_type(EtUlistToken)) ).add_parse_action(of_type(EtUlistToken))
# Final elements # Final elements