diff --git a/src/Parser/Parsing/Impl/DefinesStreamProxy.cpp b/src/Parser/Parsing/Impl/DefinesStreamProxy.cpp index da1cf7e9..4e6f7dea 100644 --- a/src/Parser/Parsing/Impl/DefinesStreamProxy.cpp +++ b/src/Parser/Parsing/Impl/DefinesStreamProxy.cpp @@ -277,9 +277,9 @@ bool DefinesStreamProxy::MatchUndefDirective(const ParserLine& line, const unsig return true; } -std::unique_ptr DefinesStreamProxy::ParseExpression(std::string expressionString) const +std::unique_ptr DefinesStreamProxy::ParseExpression(std::shared_ptr fileName, int lineNumber, std::string expressionString) const { - ParserLine pseudoLine(nullptr, 1, std::move(expressionString)); + ParserLine pseudoLine(std::move(fileName), lineNumber, std::move(expressionString)); ExpandDefinedExpressions(pseudoLine); ExpandDefines(pseudoLine); @@ -314,7 +314,7 @@ bool DefinesStreamProxy::MatchIfDirective(const ParserLine& line, const unsigned if (expressionString.empty()) throw ParsingException(CreatePos(line, currentPos), "Cannot if without an expression."); - const auto expression = ParseExpression(expressionString); + const auto expression = ParseExpression(line.m_filename, line.m_line_number, expressionString); if (!expression) throw ParsingException(CreatePos(line, currentPos), "Failed to parse if expression"); @@ -356,7 +356,7 @@ bool DefinesStreamProxy::MatchElIfDirective(const ParserLine& line, const unsign if (expressionString.empty()) throw ParsingException(CreatePos(line, currentPos), "Cannot elif without an expression."); - const auto expression = ParseExpression(expressionString); + const auto expression = ParseExpression(line.m_filename, line.m_line_number, expressionString); if (!expression) throw ParsingException(CreatePos(line, currentPos), "Failed to parse elif expression"); diff --git a/src/Parser/Parsing/Impl/DefinesStreamProxy.h b/src/Parser/Parsing/Impl/DefinesStreamProxy.h index f4b29735..77188981 100644 --- a/src/Parser/Parsing/Impl/DefinesStreamProxy.h +++ b/src/Parser/Parsing/Impl/DefinesStreamProxy.h @@ -91,7 +91,7 @@ public: void ExpandDefines(ParserLine& line) const; - _NODISCARD std::unique_ptr ParseExpression(std::string expressionString) const; + _NODISCARD std::unique_ptr ParseExpression(std::shared_ptr fileName, int lineNumber, std::string expressionString) const; ParserLine NextLine() override; bool IncludeFile(const std::string& filename) override; diff --git a/src/RawTemplater/Templating/SetDefineStreamProxy.cpp b/src/RawTemplater/Templating/SetDefineStreamProxy.cpp index 28531fd1..5c459e0f 100644 --- a/src/RawTemplater/Templating/SetDefineStreamProxy.cpp +++ b/src/RawTemplater/Templating/SetDefineStreamProxy.cpp @@ -41,7 +41,7 @@ bool SetDefineStreamProxy::MatchSetDirective(const ParserLine& line, const unsig if (expressionString.empty()) throw ParsingException(CreatePos(line, currentPosition), "Cannot set without an expression."); - const auto expression = m_defines_proxy->ParseExpression(expressionString); + const auto expression = m_defines_proxy->ParseExpression(line.m_filename, line.m_line_number, expressionString); if (!expression) throw ParsingException(CreatePos(line, currentPosition), "Failed to parse set expression"); diff --git a/src/RawTemplater/Templating/TemplatingStreamProxy.cpp b/src/RawTemplater/Templating/TemplatingStreamProxy.cpp index 549869a6..5cddd574 100644 --- a/src/RawTemplater/Templating/TemplatingStreamProxy.cpp +++ b/src/RawTemplater/Templating/TemplatingStreamProxy.cpp @@ -110,7 +110,7 @@ bool TemplatingStreamProxy::MatchFilenameDirective(const ParserLine& line, const if (expressionString.empty()) throw ParsingException(CreatePos(line, currentPosition), "Cannot pragma filename without an expression."); - const auto expression = m_defines_proxy->ParseExpression(expressionString); + const auto expression = m_defines_proxy->ParseExpression(line.m_filename, line.m_line_number, expressionString); if (!expression) throw ParsingException(CreatePos(line, currentPosition), "Failed to parse pragma filename expression");