Multiline comments in Zed language
In #4308 review, @mccanne noted:
We should add multiline comments (
/* ... */) at some point. I think there was a problem a long time ago with the PEG rules. Just need to go back and fix it.
Indeed, we have these working in ZSON, so it would be nice to have for consistency.
Ah, I was looking for pre-existing issues regarding this ... so it's not expected for this to work:
❯ cat op.zed
/* This is a one-liner with multiline syntax */
op no_op(): (
yield this
)
no_op()
❯ echo '{a:1}' | zq -I op.zed -
zq: error parsing Zed in op.zed at line 2, column 11:
op no_op(): (
=== ^ ===
Multi-line comment works only within ZSON data?
I see the documentation is actually consistent here ... maybe if there could be a "Comments" header to help with the doc search? Here's what I see now:
I presume with a proper heading, it'd show up in the results more prominently:
And maybe there could be a note, calling out the difference between Zed Language and ZSON in the meantime?
Thanks @chrismo! The feedback is appreciated and it's good to know the search tool isn't serving us great here. I've just opened PR #5175 to see if the wider team is on board with adding the section header to see if it'll help.
As for the /* */ multi-line comments, I'll poll the team to see if there's hope of addressing it in the parser ASAP rather than divulging yet another gotcha in the docs that users may not take the time to read. 😄 But if we're going to be stuck living with it for a long time yet, yeah, I'd be open to highlighting that more prominently in the docs too.
Verified in super commit 69d0499.
$ super -c "
/*
* This is a verification of multi-line comment support.
*/
yield 'Hello, world!'"
"Hello, world!"
The timing works out nicely since /* */ comments happen to be part of the SQL standard as well.
Thanks @mccanne!