diff options
author | Marion <marion.zepf@gmail.com> | 2013-09-16 11:37:00 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-09-16 11:37:00 (GMT) |
commit | a9d49ab15760c75f54c4735162a189ce390c60a2 (patch) | |
tree | 5b465332235de143a192c47f5459e8639dfec67b /util/ast_extensions.py | |
parent | 2f3ccc0fcbb5318e50f1e429b93d2ae36a55aad5 (diff) |
fix export of 'f(x)' block
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 + |