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__

Date: Oct. 15th, 2005 06:06 (UTC)
From: [identity profile] http://users.livejournal.com/_winnie/
ну триграфы - хрен с ними. я бы вообще сделал отдельную опцию компилятора, _разрешающую_ их. Или выдавал бы warnings на них.

Date: Oct. 15th, 2005 08:42 (UTC)
From: [identity profile] http://users.livejournal.com/_winnie/
Ага, g++ со мной солидарен -
lowlevel_print.cpp:37:23: warning: trigraph ??/ ignored, use -trigraphs to enable

Date: Oct. 16th, 2005 06:54 (UTC)
From: [identity profile] aruslan.livejournal.com
Триграфы - да, нафик.
Меня расстраивают камменты.

Date: Oct. 15th, 2005 07:18 (UTC)
From: [identity profile] --ak--.livejournal.com
Всё таки лучше чем ничего. Всяко читабельнее получаецца.

Date: Oct. 16th, 2005 06:54 (UTC)
From: [identity profile] aruslan.livejournal.com
Угу. Лучше так, чем никак, однозначна.

главное,

Date: Oct. 15th, 2005 09:50 (UTC)
From: [identity profile] ayaromenok.livejournal.com
чтобы colorizer повышал читабельность кода.
PS. такой код хорош для примера, а вот встертить в сырцах я бы не хотел.

Это

Date: Oct. 16th, 2005 06:53 (UTC)
From: [identity profile] aruslan.livejournal.com
точно :)

Date: Oct. 26th, 2005 16:41 (UTC)
From: [identity profile] corporateshark.livejournal.com
У меня колорер в FARe заваливается только на последних трёх строчках, которые он всё-таки считает за комменты.

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. 9th, 2026 19:37
Powered by Dreamwidth Studios