Skip to content

Commit

Permalink
modified the edit rule to expect only a single line delimiter and mad…
Browse files Browse the repository at this point in the history
…e the skipTo look for delimiters at the begining of the line
  • Loading branch information
benne238 committed Jun 30, 2021
1 parent 66b65d7 commit 5fbc373
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/webqueue2api/parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,16 @@ def error_handler(original_string, match_start_index, tokens):
).leaveWhitespace().setParseAction(parse_section_by_type("reply_to_user"))

edit_rule = (
pp.LineStart() +
pp.Literal(edit_start_delimiter).suppress() +
pp.Word(pp.alphanums).setResultsName("by") +
pp.Literal(" at: ").suppress() +
pp.SkipTo(action_end_delimiter + pp.LineEnd()).setResultsName("datetime") +
pp.Word(pp.nums + "/-: ").setResultsName("datetime") +
(pp.Literal(action_end_delimiter) + pp.LineEnd()).suppress() +
pp.Group(
pp.SkipTo(
pp.Literal(reply_from_user_start_delimiter)
| pp.Literal(action_start_delimiter)
| (pp.LineStart() + pp.Literal(action_start_delimiter))
) | pp.SkipTo(pp.StringEnd(), include=True)
).setResultsName("content")
).leaveWhitespace().setParseAction(parse_section_by_type("edit"))
Expand Down

0 comments on commit 5fbc373

Please sign in to comment.