Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Error: Illegal #include (Preprocessor.js:225) #10

Description

@markusha
  1. Create a file test.js with the following content:
// #ifndef TEST
// #define var TEST=true
console.log('test');
// #endif
  1. Create a file main.js with the following content:
// #include "test.js"
console.log('testing include');
// #include "test.js"
  1. Preprocess main.js.

Result:
The file test.js is included twice in the output file.
The following error is shown:

C:\programs\nodejs\node_modules\preprocessor\Preprocessor.js:225
                        throw(new Error("Illegal #"+match[2]+": "+this.source.
                              ^
Error: Illegal #include: // #include "test.js
...
    at Preprocessor.process (C:\programs\nodejs\node_modules\preprocessor\Preprocessor.js:225:31)
    at Object.<anonymous> (C:\programs\nodejs\node_modules\preprocessor\bin\preprocess:65:16)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

Expected result:
The file test.js is included only once in the output file.
No errors are shown.

P. S. I see that there's an undocumented directive #include_once for such cases. But still this is an error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions