NiklasRosenstein / python-builddsl

A superset of the Python programming language with support for closures and multi-line lambdas
https://niklasrosenstein.github.io/craftr-dsl/
MIT License
2 stars 2 forks source link

Bad parse of paren-less calls followed by single-line comments #15

Open NiklasRosenstein opened 2 years ago

NiklasRosenstein commented 2 years ago

Reproduction

$ cat <<EOF | python -m craftr.dsl -EC
print "Hello World"

# hello

print "And again"
EOF

__closure__['print']('Hello World', __closure__['print'], 'And again')

Adding a newline after the comment separates the two calls as expected

__closure__['print']('Hello World')
__closure__['print']('And again')
NiklasRosenstein commented 1 year ago

This also happens with the del keyword, but it works as expected when there's no inline-comment.

This fails:

del data[0]  # Foo

Because it tries to parse it as

del(data[0]   # Foo