Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

Support comments right after , or ; #57

Open
ryo33 opened this issue Jan 6, 2023 · 0 comments
Open

Support comments right after , or ; #57

ryo33 opened this issue Jan 6, 2023 · 0 comments

Comments

@ryo33
Copy link
Member

ryo33 commented Jan 6, 2023

Syntax

?, // hahaha

?; // yeah

Why?

Sometimes it’s slightly or super annoying to write a comment for an expression.

For example;

// Here is a comment for whole let expression
$ /* Here is a comment for the hole */ ?;

to be:

// Here is a comment for the whole let expression
$ ?; // Here is a comment for the hole

And

*<
    1,
    2,
    // Here is a comment for 3
    3,
>

to be:

*<
    1,
    2,
    3, // Here is a comment for 3
>

How to avoid ambiguity?

Answer: We introduce new tokens, CommaComment and StmtEndComment.

CommaComment: ",[\s--\r\n]*//";
StmtEndComment: ";[\s--\r\n]*//";
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant