aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod/language/base.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2015-05-03 08:51:57 +1200
committerAldo Cortesi <aldo@nullcube.com>2015-05-03 08:51:57 +1200
commita46e17459d6afa9b9da1e29dd2831c760c8868da (patch)
tree93989353577f83509fabe34e31805c048e06e9e6 /libpathod/language/base.py
parent5d5f2bdd1f2354b9a1b204964fa05488772695f8 (diff)
downloadmitmproxy-a46e17459d6afa9b9da1e29dd2831c760c8868da.tar.gz
mitmproxy-a46e17459d6afa9b9da1e29dd2831c760c8868da.tar.bz2
mitmproxy-a46e17459d6afa9b9da1e29dd2831c760c8868da.zip
Language: minor refactoring and whitespace
Diffstat (limited to 'libpathod/language/base.py')
-rw-r--r--libpathod/language/base.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/libpathod/language/base.py b/libpathod/language/base.py
index f91add75..5b9e99f6 100644
--- a/libpathod/language/base.py
+++ b/libpathod/language/base.py
@@ -64,6 +64,9 @@ class Token(object):
"""
Resolves this token to ready it for transmission. This means that
the calculated offsets of actions are fixed.
+
+ settings: a language.Settings instance
+ msg: The containing message
"""
return self
@@ -76,7 +79,7 @@ class _ValueLiteral(Token):
self.val = val.decode("string_escape")
def get_generator(self, settings):
- return generators.LiteralGenerator(self.val)
+ return self.val
def freeze(self, settings):
return self
@@ -215,13 +218,14 @@ Offset = pp.MatchFirst(
class _Component(Token):
"""
A value component of the primary specification of an message.
+ Components produce byte values desribe the bytes of the message.
"""
@abc.abstractmethod
def values(self, settings): # pragma: no cover
"""
- A sequence of value objects.
+ A sequence of values, which can either be strings or generators.
"""
- return None
+ pass
def string(self, settings=None):
"""
@@ -361,7 +365,7 @@ class Integer(_Component):
return e.setParseAction(lambda x: klass(*x))
def values(self, settings):
- return [generators.LiteralGenerator(self.value)]
+ return self.value
def spec(self):
return "%s"%(self.value)