theos/logos

Line comments are incorrectly handled within block comments

Closed this issue · 2 comments

In current master version (a733c99) there is a bug. Here is the minimal .xm file reproducing it:

%ctor {
  // ...
}

/* Multiline comment including a // line comment */

// These lines are incorrectly ignored:

void func() {
  int a = 3;
  /* Another multiline comment; its closing sequence will be noticed */
  // The line below will cause an error
}

When fed to logos.pl, this file will cause the following error:

test.xm:13: error: fell off the face of the planet when we found a '}'

If you include a // sequence within a multiline comment (e.g. as a part of https:// URL prefix), everything until the end of line is not checked for */ sequence.

Alas I don't speak Perl and hence cannot find the actual place where the error was introduced.
I can tell though that the error did not happen in commit 886885b.

Performed git bisect. The bug was introduced in ed22e75.

Fixed in #96