-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a custom shortcode parser #2194
Conversation
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
# Space inside unquoted name: save as positional argument | ||
args.append(cname) | ||
cname = cvalue = qc = '' | ||
elif char == ' ' and flag == 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use binary notation above, why not here (and in the following cases) as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ll drop the binary notation then; it felt more readable to me in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use binary notation everywhere? That makes it more readable for everyone!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit too much cruft for me. If you really want that, you can make everything binary.
LGTM |
if flag & 0b100 and flag & 1: | ||
# Backslash in value: escape next character, no matter what | ||
cvalue += char | ||
flag -= 0b100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you use +
and -
for bit operations instead of &
, |
and ~
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I was too lazy to come up with the bitwise operations needed, and because ± is good enough for this case. Fixed on master.
This replaces the cheat involving the HTML parser with a custom character-based parser, written in pure Python.
Advantages:
Disadvantages: