diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-07-23 17:19:25 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-07-23 17:19:25 +1200 |
commit | 091d90011b285ad66fcc1a252389ed386fb72480 (patch) | |
tree | 29d514147dd3eb9452325a0f63887afd24ca82c8 /libpathod/rparse.py | |
parent | 2880fee4e3f80f8748b6a69f1a72aa3a3a5fa922 (diff) | |
download | mitmproxy-091d90011b285ad66fcc1a252389ed386fb72480.tar.gz mitmproxy-091d90011b285ad66fcc1a252389ed386fb72480.tar.bz2 mitmproxy-091d90011b285ad66fcc1a252389ed386fb72480.zip |
Unify offset specifications, and document them.
Diffstat (limited to 'libpathod/rparse.py')
-rw-r--r-- | libpathod/rparse.py | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/libpathod/rparse.py b/libpathod/rparse.py index f81bb1ed..bdce0dd7 100644 --- a/libpathod/rparse.py +++ b/libpathod/rparse.py @@ -96,12 +96,8 @@ DATATYPES = dict( ascii_uppercase = string.ascii_uppercase, digits = string.digits, hexdigits = string.hexdigits, - letters = string.letters, - lowercase = string.lowercase, octdigits = string.octdigits, - printable = string.printable, punctuation = string.punctuation, - uppercase = string.uppercase, whitespace = string.whitespace, ascii = string.printable, bytes = "".join(chr(i) for i in range(256)) @@ -288,6 +284,15 @@ NakedValue = pp.MatchFirst( ) +Offset = pp.MatchFirst( + [ + v_integer, + pp.Literal("r"), + pp.Literal("a") + ] + ) + + class ShortcutContentType: def __init__(self, value): self.value = value @@ -402,13 +407,7 @@ class PauseAt: ] ) e += pp.Literal(",").suppress() - e += pp.MatchFirst( - [ - v_integer, - pp.Literal("r"), - pp.Literal("a"), - ] - ) + e += Offset return e.setParseAction(lambda x: klass(*x)) def accept(self, settings, r): @@ -441,13 +440,7 @@ class InjectAt: @classmethod def expr(klass): e = pp.Literal("i").suppress() - e = e + pp.MatchFirst( - [ - v_integer, - pp.Literal("r"), - pp.Literal("a") - ] - ) + e += Offset e += pp.Literal(",").suppress() e += Value return e.setParseAction(lambda x: klass(*x)) |