Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-line Comments #4518

Closed
nirname opened this issue Jun 22, 2023 · 4 comments
Closed

Multi-line Comments #4518

nirname opened this issue Jun 22, 2023 · 4 comments
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request

Comments

@nirname
Copy link
Contributor

nirname commented Jun 22, 2023

Proposal

We need to support multi-line comments, currently they are not supported.

I suggest a syntax like this %{ }%, which has to be discussed.

Escape character for titles and captions with special characters has yet to be discussed too. Perhaps double percent %% can be replaced with % in resulting diagram.

Example

A complete example is:

myGraph
%% one line comment
Bob -> Hello -> Alice %% trailing comment
%{
multi-line
comment
}%
Pete -> Hello %{ comment in the middle }% -> Alice
Steve -> Hello %{
multi-line
comment
in the middle
}% -> Alice

It should be possible to have it inserted in the middle of the string:

a -> b %{ comment }% -> c

It can start on any line and end on any line too:

a-> b %{
long
comment
}% -> c

the result should be:

a -> b  -> c

Note, there are 2 spaces between b and following arrow, they are representing the idea that after comment is deleted everything else stays intact.

One line comment should be treated as trailing comment, so everything that start with %% till the end of the line is a comment.

The %%, %{ and %} symbols are treated as parts of the comments too.

Comments should be removed before graph parsing.

Taking that in consideration, no graphs should have these symbols in their's grammars. If someone needs to include a line containing any of those inside a caption, label or a title he must precede it with escape character. The most common techniques about that is

  • duplicating the character, so escape symbol could also be %; %% will be converted to %
  • using another escape character, so \ is one of the most ubiquitous, it can escape itself: \% will be converted to % and \\ will be convert to \

Screenshots

No response

@nirname nirname added Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request labels Jun 22, 2023
@nirname
Copy link
Contributor Author

nirname commented Jun 22, 2023

I have not found a separate bug for it, but trailing comments are not working right now

@Yokozuna59
Copy link
Member

there is an issue for it #1281, it has been implemented then reverted, an not open again

@Yokozuna59
Copy link
Member

I'm voting to that syntax, I've already implemented here but the parser is not done

hidden terminal MULTI_LINE_COMMENT: /%%\*[\s\S]*?\*%%\s*/;

@nirname
Copy link
Contributor Author

nirname commented Jun 22, 2023

I think i have to close this issue, because it is a duplicate of this one

@nirname nirname closed this as completed Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants