Parse error with multiple lines code

Hi
This works:
d1 $ n "1 2" # sound "bd"
This doesn't:
d1 $ n "1 2"
# sound "bd"
Atom does not treat # sound "bd" as part of the line code.

Any idea

Regards

What is being sent to ghci ? Are you sending the block of code or just the line (e.g. if you evaluate on # sound "bd", does it give you a syntax error in ghci because you're passing in # sound "bd") ?

Also - what is the interface you are using ? Atom / Vim / Emacs / something else ?

1 Like

Hi
I use Atom and I've a parse error when evaluating on # sound "bd" alone as expected.

Selecting all the block of code works also

Thanks

below are the default mappings for Atom.
You should be using cmd-enter or ctrl-enter to send a multi-line block to ghci.
From what you're saying, it looks like you're sending a single line.
Can you confirm what keypress combination you are using?

{
  "atom-workspace atom-text-editor[data-grammar~='tidalcycles']": {
    "shift-enter": "tidalcycles:eval",
    "alt-shift-enter": "tidalcycles:eval-copy",
    "cmd-enter": "tidalcycles:eval-multi-line",
    "ctrl-enter": "tidalcycles:eval-multi-line",
    "alt-cmd-enter": "tidalcycles:eval-multi-line-copy",
    "alt-ctrl-enter": "tidalcycles:eval-multi-line-copy",
    "ctrl-.": "tidalcycles:hush",
    "cmd-.": "tidalcycles:hush",
    "shift-cmd-h": "tidalcycles:hush",
    "shift-ctrl-h": "tidalcycles:hush"
  }
}

I need to warp the line as I press the enter key (as the soft warp or the soft warp at preferred line length do) to keep the Tidal syntax color theme.

I don't think I understand.
What are the results when you use "shift-enter" vs "ctrl-enter" ?

Same result, the line or block are evaluate without issue. I just need to be able to code on multi lines to keep the code readable and organized.


With soft warp everything is OK (line 72 plus a dot for the new line) but this is not the case on line 77 where I pressed Enter to continue the line 76 (# hash is not pink)

Yep - so my assumption is that you are somehow not running the multi-line interpreter.
What key combination are you pressing when you are attempting to evaluate ?

Shift+Enter

Right - per my comment above, there are two ways to evaluate the code -

shift + Enter evaluates only the current line
ctrl + Enter / cmd + enter evaluates the current block

try using the ctrl + Enter or the cmd + enter

Both combinations are working with block code

So there is no way to keep the Tidal syntax color theme when splitting code over multiple lines?

Oh, are you specifically referring to the color scheme and not to evaluating the multiple lines of code ?

If so, then the color scheme should be fine, and i'll defer to the Atom people in this forum.

Thanks John_Murphy

To me, it looks like the problem comes from the indentation.
If you indent your line 77 as you did at 73, everything should be fine, both color highlighting as well as multiline evaluation.
I had the same kind of problems before, as mentioned here (if you want more exact explanations):

not an expert, my 2cents

Hi
No,
Capture d’écran 2020-07-21 à 10.02.43
As John said, it is a normal behavior...
Regards

Ah ok sorry my bad, I understand now ...