Skip to content

Commit

Permalink
AAAAAAAAAAA
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonCubed132 committed Aug 25, 2023
1 parent 0128b89 commit 8415a79
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions karma/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ def make_op_regex(o):
class KarmaParser(TextParsers):
anything = reg(r".") > constant(None)

quotes = r'["“”]'
quotes = reg(r'["“”]')

word_topic = reg(r'[^"\s]+?(?=[+-]{2})')
string_topic = reg(rf"{quotes}.*?(?<!\\)(\\\\)*?{quotes}(?=[+-]{2})")
string_topic = quotes & reg(r".*?(?<!\\)(\\\\)*?") & quotes & reg(r"(?=[+-]{2})")

topic = (word_topic > (lambda t: [t, False])) | (
string_topic > (lambda t: [t[1:-1], True])
)
Expand All @@ -69,7 +70,7 @@ class KarmaParser(TextParsers):
operator = op_positive | op_neutral | op_negative

bracket_reason = reg(r"\(.+?\)") > (lambda s: s[1:-1])
quote_reason = reg(rf"{quotes}.*?(?<!\\)(\\\\)*?{quotes}(?![+-]{2})") > (
quote_reason = reg(r"\".*?(?<!\\)(\\\\)*?\"(?![+-]{2})") > (
lambda s: s[1:-1]
)
reason_words = reg(r"(?i)because") | reg(r"(?i)for")
Expand Down

0 comments on commit 8415a79

Please sign in to comment.