@@ -34,7 +34,8 @@ class MyLogger : public StdOutLogger {
3434
3535static MyLogger vmlogger;
3636
37- ScriptCompiler::ScriptCompiler (const std::vector<std::filesystem::path>& includePaths) {
37+ void ScriptCompiler::init ()
38+ {
3839 vmlogger.setEnabled (loglevel::trace, false );
3940 vm = std::make_unique<sqf::runtime::runtime>(vmlogger, sqf::runtime::runtime::runtime_conf{});
4041
@@ -54,20 +55,25 @@ ScriptCompiler::ScriptCompiler(const std::vector<std::filesystem::path>& include
5455 // CommandList::init(*vm);
5556 // //sqf::commandmap::get().init();
5657 // });
58+
59+ addPragma ({ " ASC_ignoreFile" , [this ](const sqf::runtime::parser::pragma& m,
60+ ::sqf::runtime::runtime& runtime,
61+ const ::sqf::runtime::diagnostics::diag_info dinf,
62+ const ::sqf::runtime::fileio::pathinfo location,
63+ const std::string& data) -> std::string
64+ {
65+ ignoreCurrentFile = true ;
66+ return {}; // string return type is wrong, isn't used for anything
67+ } });
68+ }
69+
70+ ScriptCompiler::ScriptCompiler (const std::vector<std::filesystem::path>& includePaths) {
71+ init ();
5772 initIncludePaths (includePaths);
5873}
5974
6075ScriptCompiler::ScriptCompiler () {
61- vmlogger.setEnabled (loglevel::trace, false );
62- vm = std::make_unique<sqf::runtime::runtime>(vmlogger, sqf::runtime::runtime::runtime_conf{});
63-
64- vm->fileio (std::make_unique<sqf::fileio::impl_default>(vmlogger));
65- vm->parser_config (std::make_unique<sqf::parser::config::parser>(vmlogger));
66- vm->parser_preprocessor (std::make_unique<sqf::parser::preprocessor::impl_default>(vmlogger));
67- vm->parser_sqf (std::make_unique<sqf::parser::sqf::parser>(vmlogger));
68-
69- CommandList::init (*vm);
70-
76+ init ();
7177}
7278
7379CompiledCodeData ScriptCompiler::compileScript (std::filesystem::path physicalPath, std::filesystem::path virtualPath) {
@@ -100,6 +106,14 @@ CompiledCodeData ScriptCompiler::compileScript(std::filesystem::path physicalPat
100106 // __debugbreak();
101107 return CompiledCodeData ();
102108 }
109+
110+ if (ignoreCurrentFile)
111+ {
112+ std::cout << " File " << physicalPath.generic_string () << " skipped due to ASC_ignoreFile pragma\n " ;
113+ ignoreCurrentFile = false ;
114+ return CompiledCodeData ();
115+ }
116+
103117 bool errorflag = false ;
104118
105119
0 commit comments