theos / logos

Preprocessor that simplifies Objective-C hooking.
https://theos.dev/docs/logos
Other
205 stars 34 forks source link

Line comments are incorrectly handled within block comments #70

Closed MarSoft closed 1 year ago

MarSoft commented 3 years ago

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.

MarSoft commented 3 years ago

Performed git bisect. The bug was introduced in ed22e75.

uroboro commented 1 year ago

Fixed in #96