polserver/pol-core/bscript/compiler/astbuilder/TreeBuilder.cpp
Eric Swanson ed218a967f
Add AST builder stubs (#230)
* Add astbuilder/TreeBuilder

* Add astbuilder/ValueBuilder

* Add astbuilder/ExpressionBuilder

* Add astbuilder/ SimpleStatementBuilder

* Add astbuilder/CompoundStatementBuilder

* Add ModuleDeclarationBuilder

* Add ProgramBuilder

* Add UserFunctionBuilder
2020-08-18 12:07:51 +02:00

33 lines
879 B
C++

#include "TreeBuilder.h"
#include <antlr4-runtime.h>
#include "compiler/astbuilder/BuilderWorkspace.h"
#include "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 )
{
}
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