Repository navigation
Preprocessor
Trin Wasinger edited this page Apr 6, 2024
·
9 revisions
MTSC includes a heavily modified C/C++ preprocessor based on Boost Wave. For compatibility, it is gated behind the -p/--preprocessor CLI flag. Since #abc is already valid JavaScript for ES6 private class fields, MTSC instead looks for preprocessor directives within single-line triple-slash comments (e.g. ///#define ...).
Unless otherwise stated, the following directives behave like their C/C++ counterparts.
-
///#define- Variadics and placemarkers are supported
///#undef
///#if///#ifdef///#ifndef///#else///#elif///#endif
///#error///#warning///#line///#pragma-
///#embed- Only supports the
///#embed "path/to/file..."form - The byte contents of the relative file are inserted as comma separated hex literals
- Only supports the
Unless otherwise stated, the following pragmas behave like their C/C++ counterparts.
///#pragma once-
///#pragma region- Accepted, but does nothing
-
///#pragma endregion- Accepted, but does nothing
-
///#pragma mtsc line(arg)- Acts as an extended form of
///#line - If
argstarts with a+or-, the current line number is shifted down or up respectively by the number of lines following the sign - If
arghas no sign, this sets the current line number to the value ofarg - Because of this,
line(123)andline(+123)are not equivilant
- Acts as an extended form of
///#pragma mtsc eval(arg)