Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comments starting with /+ and ending with ++/ are not handled #52

@nordlow

Description

@nordlow

Describe the bug
Comments starting with /+ and ending with ++/ (opposite to +/ ) are not matched by grammar rule comment: (_) =>.

Additional context
Found this when looking at the definition struct ByLineBuffer(Char) in D module std.net.curl being

/+
struct ByLineBuffer(Char)
{
    bool linePresent;
    bool EOF;
    Char[] buffer;
    ubyte[] decodeRemainder;

    bool append(const(ubyte)[] data)
    {
        byLineBuffer ~= data;
    }

    @property bool linePresent()
    {
        return byLinePresent;
    }

    Char[] get()
    {
        if (!linePresent)
        {
            // Decode ubyte[] into Char[] until a Terminator is found.
            // If not Terminator is found and EOF is false then raise an
            // exception.
        }
        return byLineBuffer;
    }

}
++/

. I could try to fix this myself but the current

    comment: (_) =>
      token(
        choice(
          seq("//", /(\\+(.|\r?\n)|[^\\\n])*/),
          seq("/*", /[^*]*\*+([^/*][^*]*\*+)*/, "/"),
          // nesting comments, we "only" support 5 levels of nesting
          seq(
            "/+",
            repeat(
              choice(
                /[^+]/,
                /\+[^\/]/,
                seq(
                  "/+",
                  repeat(
                    choice(
                      /[^+]/,
                      /\+[^\/]/,
                      seq(
                        "/+",
                        repeat(
                          choice(
                            /[^+]/,
                            /\+[^\/]/,
                            seq(
                              "/+",
                              repeat(
                                choice(
                                  /[^+]/,
                                  /\+[^\/]/,
                                  seq(
                                    "/+",
                                    repeat(choice(/[^+]/, /\+[^\/]/)),
                                    "+/",
                                  ),
                                ),
                              ),
                              "+/",
                            ),
                          ),
                        ),
                        "+/",
                      ),
                    ),
                  ),
                  "+/",
                ),
              ),
            ),
            "+/",
          ),
        ),
      ),

is not easy to parse.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions