From d2cf34548322598ae067434a61a171bd190fc2c9 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 3 Dec 2014 18:52:28 +0100 Subject: Improved external interface for multi-source and multi-contract compilation. --- Parser.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Parser.cpp') diff --git a/Parser.cpp b/Parser.cpp index c385dd8d..ddab489b 100644 --- a/Parser.cpp +++ b/Parser.cpp @@ -39,7 +39,8 @@ namespace solidity class Parser::ASTNodeFactory { public: - ASTNodeFactory(Parser const& _parser): m_parser(_parser), m_location(_parser.getPosition(), -1) {} + ASTNodeFactory(Parser const& _parser): + m_parser(_parser), m_location(_parser.getPosition(), -1, _parser.getSourceName()) {} void markEndPosition() { m_location.end = m_parser.getEndPosition(); } void setLocationEmpty() { m_location.end = m_location.start; } @@ -81,6 +82,11 @@ ASTPointer Parser::parse(shared_ptr const& _scanner) return nodeFactory.createNode(nodes); } +std::shared_ptr const& Parser::getSourceName() const +{ + return m_scanner->getSourceName(); +} + int Parser::getPosition() const { return m_scanner->getCurrentLocation().start; @@ -579,7 +585,8 @@ ASTPointer Parser::getLiteralAndAdvance() ParserError Parser::createParserError(string const& _description) const { - return ParserError() << errinfo_sourcePosition(getPosition()) << errinfo_comment(_description); + return ParserError() << errinfo_sourceLocation(Location(getPosition(), getPosition(), getSourceName())) + << errinfo_comment(_description); } -- cgit