evhub / coconut

Simple, elegant, Pythonic functional programming.
http://coconut-lang.org
Apache License 2.0
4.09k stars 125 forks source link

Comments in middle of parethesed code raising errors (jupyterlab - coconut kernel). #851

Closed vanheck closed 2 months ago

vanheck commented 2 months ago

I run jupyterlab coconut kernel, and get error if I comment any code in parentheses.

Example 1:

data = [
    "hey",
    # "there", # dont want this value now
    "is comment"
]

raises:

CoconutSyntaxError: unclosed open '[' (line 1)
  data = [    "hey",  # "there",    "is comment"]
         ^
  File <string>:1
SyntaxError: unclosed open '['
  data = [    "hey",  # "there",    "is comment"]

Example 2 - comment function call parameters:

def foo(x, y=1):
    return x + y

foo(
    x=1,
    y=2, # any description - e.g. why this value is 2
)

raises:

CoconutSyntaxError: unclosed open '(' (line 3)
  foo(    x=1,    y=2,  # any description - e.g. why this value is 2)
     ^
  File <string>:3
SyntaxError: unclosed open '('
  foo(    x=1,    y=2,  # any description - e.g. why this value is 2)
evhub commented 2 months ago

Thanks for the report—should be fixed as of coconut-develop>=3.1.1-post_dev4 (pip install -U coconut-develop>=3.1.1-post_dev4).