Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Block comments ala Ray



On 2021-02-14 17:07:23 -0800, Bart Schaefer wrote:
> On Sun, Feb 14, 2021 at 4:36 PM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> >
> > How about the "'' " prefix (two single quotes followed by a space)
> 
> Not very visually distinctive, especially for two single quotes then
> space then newline.

Note that this is only a prefix. You can decide what you want to
write after it.

> Also as I mentioned, it's significantly more work if the introducer is
> more than two characters, because of the need to back up and re-lex if
> it turns out not to be a comment.

Can't this be shared with the usual parsing and decide after reading
the first word? Here, this would normally correspond to an "empty"
command.

> It's easy to peek one character ahead of "!" and unget the peek if
> it isn't "#". To use more than two characters means turning the
> whole thing into a real lexical token rather than just something
> thrown away during lexing (as happens with comments at present).

But here, the 3rd character is just a word delimiter, so that I would
think that this is simpler.

> Hm, what about paren then ampersand?  Doesn't conflict with ksh
> pattern-list syntax, is currently a syntax error, etc.  The problem
> being that the reverse (ampersand paren) could appear in valid code,
> so the end marker would have to be asymmetric to remove that
> objection.

Could you give an example of valid code with "&)" at the beginning
of a line?

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Messages sorted by: Reverse Date, Date, Thread, Author