aboutsummaryrefslogtreecommitdiffstats
path: root/Parser.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-12-04 01:52:28 +0800
committerChristian <c@ethdev.com>2014-12-04 01:52:28 +0800
commitd2cf34548322598ae067434a61a171bd190fc2c9 (patch)
tree9f89db707b8435f4774aea1115249e076fb37b74 /Parser.cpp
parent254df50feab6bb4c9f013257591b73919e4013a5 (diff)
downloaddexon-solidity-d2cf34548322598ae067434a61a171bd190fc2c9.tar.gz
dexon-solidity-d2cf34548322598ae067434a61a171bd190fc2c9.tar.zst
dexon-solidity-d2cf34548322598ae067434a61a171bd190fc2c9.zip
Improved external interface for multi-source and multi-contract compilation.
Diffstat (limited to 'Parser.cpp')
-rw-r--r--Parser.cpp11
1 files changed, 9 insertions, 2 deletions
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<SourceUnit> Parser::parse(shared_ptr<Scanner> const& _scanner)
return nodeFactory.createNode<SourceUnit>(nodes);
}
+std::shared_ptr<const string> const& Parser::getSourceName() const
+{
+ return m_scanner->getSourceName();
+}
+
int Parser::getPosition() const
{
return m_scanner->getCurrentLocation().start;
@@ -579,7 +585,8 @@ ASTPointer<ASTString> 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);
}