aruslan: (Default)
[personal profile] aruslan
http://www.chami.com/colorizer/

И он опять не проходит простые тесты.
На комментарии, на литералы.
Даже безо всяких триграфов.


// Вырезка из набора простых boundary test cases парсера C++ комментариев
#include <iostream>

int main()
{
// Константы
  std::cout << "C1. This is /* not a comment */\n";
  std::cout << "C2. This is // not a comment\n";
  std::cout << "C3. This is \" /* not a comment as well*/ \"\n";
  std::cout << "C4. This is \" // not a comment as well \"\n";
  std::cout << "C5. Let's print some random numbers: " << '/*' << '*/' << '\n';
  std::cout << "C6. Let's print a random number: " << '//' << '\n';
  std::cout << "C7. This is\" '/*' not a comment '*/' \"\n";
  std::cout << "C8. This is\" '//' not a comment \"\n";

// Конец строки
  std::cout << "F5. This is "
    // line-continuation character: \
    "SOMETHING ERRONEOUS BUT" // */
    " not a comment\n";

// Триграфы + конец строки
  std::cout << "H5. This is obviously "
    // Триграфы?! - это что такое???????/
    "SOMETHING ERRONEOUS BUT"
    " not a comment\n";

// Триграфы + константы
#ifndef __GNUC__ // gcc up to 3.2.3 fails to handle trigraphs in these contexts
  std::cout << "J1. This is ??/" /* not a comment */ ??/"\n";
  std::cout << "J2. This is ??/" // not a comment at all */ ??/"\n";
  std::cout << "??/" '??/' '/*J3. Yeah, baby, this is NOT a comment*/' ??/"\n";
#endif
}



via [livejournal.com profile] __ak__

Profile

aruslan: (Default)
aruslan

January 2014

S M T W T F S
   1234
56789 1011
12131415161718
19202122232425
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 10th, 2026 21:14
Powered by Dreamwidth Studios