mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* Add astbuilder/TreeBuilder * Add astbuilder/ValueBuilder * Add astbuilder/ExpressionBuilder * Add astbuilder/ SimpleStatementBuilder * Add astbuilder/CompoundStatementBuilder * Add ModuleDeclarationBuilder * Add ProgramBuilder * Add UserFunctionBuilder
33 lines
879 B
C++
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
|