diff options
Diffstat (limited to 'util/ast_extensions.py')
-rw-r--r-- | util/ast_extensions.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/util/ast_extensions.py b/util/ast_extensions.py index ac29421..3335afb 100644 --- a/util/ast_extensions.py +++ b/util/ast_extensions.py @@ -39,3 +39,14 @@ class Comment(ast.stmt): self.col_offset = col_offset +class LambdaWithStrBody(ast.Lambda): + """ Lambda AST whose body is a simple string (not ast.Str). + Extends the Python abstract grammar by the following: + expr = LambdaWithStrBody(string body_str, expr* args) | ... """ + + def __init__(self, body_str="", args=[], lineno=1, col_offset=0): + self.body_str = body_str + self.args = args + self.lineno = lineno + self.col_offset = col_offset + |