polserver/pol-core/bscript/compiler/astbuilder/TreeBuilder.cpp
turleypol cccf84dfc8
Fewer compile warnings (#413)
* added escriptgrammar as external lib where it belongs. Silenced warnings.

* bscript compiler warning fixes

* special include file to get rid of gcc warnings about antlr4

* misc windows warnings

* time specifc warnings

* buildfix + apple warnings

* never trust apple

* windows debug build warnings

* some windows clang warnings

* last warning fix
2021-08-28 22:26:15 +02:00

39 lines
1.1 KiB
C++

#include "TreeBuilder.h"
#include "bscript/compiler/Antlr4Inc.h"
#include "bscript/compiler/ast/ValueConsumer.h"
#include "bscript/compiler/astbuilder/BuilderWorkspace.h"
#include "bscript/compiler/file/SourceLocation.h"
namespace Pol::Bscript::Compiler
{
TreeBuilder::TreeBuilder( const SourceFileIdentifier& source_file_identifier,
BuilderWorkspace& workspace )
: report( workspace.report ),
source_file_identifier( source_file_identifier ),
workspace( workspace )
{
}
std::unique_ptr<Expression> TreeBuilder::consume_expression_result(
std::unique_ptr<Expression> expression )
{
return std::make_unique<ValueConsumer>( expression->source_location, std::move( expression ) );
}
SourceLocation TreeBuilder::location_for( antlr4::ParserRuleContext& ctx ) const
{
return SourceLocation( &source_file_identifier, ctx );
}
SourceLocation TreeBuilder::location_for( antlr4::tree::TerminalNode& ctx ) const
{
return SourceLocation( &source_file_identifier, ctx );
}
std::string TreeBuilder::text( antlr4::tree::TerminalNode* terminal )
{
return terminal->getSymbol()->getText();
}
} // namespace Pol::Bscript::Compiler