f8af4d6567
Features / bug fixes in the preprocessor: - Add word boundary after regex for preprocessor token matching. Previously, when you mistakenly used "#ifdef" instead of "#if", the line would be parsed as a preprocessor directive (because "#ifdef" starts with "#if"), but without condition (because "def" does not start with a space). Consequently, the condition would always be false and anything between "#ifdef" and "#endif" would not be included. - Add validation and error reporting everywhere, to aid debugging. - Support nested comments (by accounting for the whole stack of conditions, instead of only the current one). - Add #elif preprocessor command. Could be used as follows: //#if !FEATURE_ENABLED //#error FEATURE_ENABLED must be set //#endif - Add #error preprocessor command. - Add end-of-line word boundary after "-->" in the comment trimmer. Otherwise the pattern would also match "-->" in the middle of a line, and incorrectly convert something like "while(i-->0)" to "while(i0)". Code health: - Add unit tests for the preprocessor (run external/builder/test.js). - Fix broken link to MDN (resolved to DXR). - Refactor to use STATE_* names instead of magic numbers (the original meaning of the numbers is preserved, with one exception). - State 3 has been split in two states, to distinguish between being in an #if and #else. This is needed to ensure that #else cannot be started without an #if. |
||
---|---|---|
.. | ||
confusing-comment-expected.js | ||
confusing-comment.js | ||
elif-expected.js | ||
elif.js | ||
else-expected.js | ||
else.js | ||
error-expected.js | ||
error-false-expected.js | ||
error-false.js | ||
error.js | ||
expand-expected.html | ||
expand.html | ||
if-empty-expected.js | ||
if-empty.js | ||
if-false-elif-false-else-expected.js | ||
if-false-elif-false-else.js | ||
if-false-elif-true-else-expected.js | ||
if-false-elif-true-else.js | ||
if-false-else-expected.js | ||
if-false-else.js | ||
if-nested-expected.js | ||
if-nested.js | ||
if-true-else-expected.js | ||
if-true-else.js | ||
if-unclosed-expected.js | ||
if-unclosed.js | ||
include-expected.html | ||
include-non-existent-expected.html | ||
include-non-existent.html | ||
include.html | ||
js-comment-expected.js | ||
js-comment.js | ||
undefined-define-expected.js | ||
undefined-define.js | ||
unsupported-ifdef-expected.js | ||
unsupported-ifdef.js |