Skip to content

Commit

Permalink
modified the reply to user rule to expect only a single line delimite…
Browse files Browse the repository at this point in the history
…r and made the skipTo look for delimiters at the begining of the line
  • Loading branch information
benne238 committed Jun 30, 2021
1 parent 5fbc373 commit a3fafba
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 @@ -235,15 +235,16 @@ def error_handler(original_string, match_start_index, tokens):
).leaveWhitespace().setParseAction(parse_section_by_type("reply_from_user"))

reply_to_user_rule = (
pp.LineStart() +
pp.Literal(reply_to_user_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("reply_to_user"))
Expand Down

0 comments on commit a3fafba

Please sign in to comment.