pdf.js/external
Rob Wu f8af4d6567 Fix preprocessor: nesting, error & tests
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.
2015-07-19 14:47:28 +02:00
..
bcmaps Removes external/cmaps; adds binary cmaps to the repo 2014-03-17 13:30:27 -05:00
builder Fix preprocessor: nesting, error & tests 2015-07-19 14:47:28 +02:00
cmapscompress Updates make.js for cmaps and make binary cmaps by default 2014-03-17 13:30:43 -05:00
crlfchecker Making sure we are not importing CRs and BOMs 2014-05-28 08:25:27 -05:00
dist Adds readme file for the pdfjs-dist repo. 2014-09-24 07:10:09 -05:00
importL10n Making sure we are not importing CRs and BOMs 2014-05-28 08:25:27 -05:00
jasmine Removing old TODOs and comments from jasmine.js 2014-05-08 22:45:30 +02:00
webL10n Fixes minor typo from #5826 2015-03-11 21:09:03 +01:00
.gitignore Removes external/cmaps; adds binary cmaps to the repo 2014-03-17 13:30:27 -05:00