Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions source/tcppLibrary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ namespace tcpp
public:
Preprocessor() TCPP_NOEXCEPT = delete;
Preprocessor(const Preprocessor&) TCPP_NOEXCEPT = delete;
Preprocessor(Lexer& lexer, const TPreprocessorConfigInfo& config) TCPP_NOEXCEPT;
Preprocessor(Lexer& lexer, const TPreprocessorConfigInfo& config, TSymTable userDefines = {}) TCPP_NOEXCEPT;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's better to move userDefines into TPreprocessorConfigInfo type to minimize number of arguments

~Preprocessor() TCPP_NOEXCEPT = default;

bool AddCustomDirectiveHandler(const std::string& directive, const TDirectiveHandler& handler) TCPP_NOEXCEPT;
Expand Down Expand Up @@ -1078,13 +1078,18 @@ namespace tcpp
};


Preprocessor::Preprocessor(Lexer& lexer, const TPreprocessorConfigInfo& config) TCPP_NOEXCEPT:
Preprocessor::Preprocessor(Lexer& lexer, const TPreprocessorConfigInfo& config, TSymTable userDefines) TCPP_NOEXCEPT:
mpLexer(&lexer), mOnErrorCallback(config.mOnErrorCallback), mOnIncludeCallback(config.mOnIncludeCallback), mSkipCommentsTokens(config.mSkipComments)
{
for (auto&& currSystemDefine : BuiltInDefines)
{
mSymTable.push_back({ currSystemDefine });
}

for (auto&& currUserDefine : userDefines)
{
mSymTable.push_back(currUserDefine);
}
}

bool Preprocessor::AddCustomDirectiveHandler(const std::string& directive, const TDirectiveHandler& handler) TCPP_NOEXCEPT
Expand Down Expand Up @@ -1984,4 +1989,4 @@ namespace tcpp
}

#endif
}
}