Skip to content

Commit

Permalink
Successfully parsing lambdef statement
Browse files Browse the repository at this point in the history
  • Loading branch information
dlorch committed May 5, 2016
1 parent 732b95f commit 11a6e4e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion pycep/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,17 @@ def _lambdef(tokens):
lambdef: 'lambda' [varargslist] ':' test
"""
raise NotImplementedError
result = [symbol.lambdef]

result.append(tokens.accept(token.NAME, "lambda"))

if not tokens.check(token.OP, ":"):
result.append(_varargslist(tokens))

result.append(tokens.accept(token.OP, ":", result_token=token.COLON))
result.append(_test(tokens))

return result

def _trailer(tokens):
"""Parse a trailer.
Expand Down
2 changes: 1 addition & 1 deletion pycep/tests/snippets/pos/astrein.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ def divide(x, y):

4 ** 16

#g = lambda x: x**2
g = lambda x: x**2

5 if foo == 30 else 19

0 comments on commit 11a6e4e

Please sign in to comment.