Skip to main content

Module c_cpp

Module c_cpp 

Source
Expand description

C and C++ minifier.

Distinguishing features:

  • Preprocessor directives (#include, #define, …) are line-sensitive — the C preprocessor reads input line-by-line and directives must end at a newline (or be continued via \<nl>). We tokenize each #-line as a single Preproc token and the emitter places it on its own line.
  • String prefixes: L"…", u8"…", u"…", U"…" (wide / UTF literals).
  • C++ raw strings R"delim(…)delim" (and prefixed forms like LR"delim(…)delim", u8R"…", etc.) — only when is_cpp is true.
  • Block comments do not nest.

Strategy: aggressive (Strategy A) between preprocessor lines. Around #-lines we still emit a leading and trailing newline.

is_cpp toggles the C++-only features (raw strings). For C tags (c, h) it’s false; for C++ tags (cpp, c++, cc, cxx, hpp, hxx) it’s true.

Functions§

minify