[New Parser] Fix support for `in` for Expressions (w/o breaking `for_statement`) by krshrimali · Pull Request #783 · lcompilers/lpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions src/lpython/parser/parser.yy
29 changes: 29 additions & 0 deletions tests/parser/statements1.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,32 @@
x = 1

a = {1, 2, 3}

# Assigning outputs of expressions to variables

output: bool = x == y
output: bool
output = x == y

output: bool = x > y
output: bool
output = x > y

output: bool = [x] not in [y]
output: bool
output = [x] not in [y]

def comparison_return(a, b):
return a > b

def comparison_return(a, b):
return [a] in [b]

def comparison_return(a, b):
output: bool
output = [a] not in [b]
return output

def comparison_return(a, b):
output = [a] not in [b]
return output
4 changes: 2 additions & 2 deletions tests/reference/ast_new-statements1-e081093.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"basename": "ast_new-statements1-e081093",
"cmd": "lpython --show-ast --new-parser --no-color {infile} -o {outfile}",
"infile": "tests/parser/statements1.py",
"infile_hash": "00b7157f02a5a98bdac6ca52297ba0fd1175c648df82c543d0a8d232",
"infile_hash": "8a786ff37449feb98a385df5f952bd91c8f910479ccbb4906e25c060",
"outfile": null,
"outfile_hash": null,
"stdout": "ast_new-statements1-e081093.stdout",
"stdout_hash": "a6635960221bc739fbd0dfb6204cf929f7242dddbfc54eb7254f8943",
"stdout_hash": "0af4b626e5d319f625ee090113d52f0f7d0b5bb508f728b30e3f7096",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/ast_new-statements1-e081093.stdout