mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
Adds enough to build the AST nodes for the module function declarations in a .em file. Adds: - Function: base class for module function declarations and user functions - FunctionParameterDeclaration: declaration for a function parameter, as well as its default value if any - FunctionParameterList: just a holder for function parameter declarations - ModuleFunctionDeclaration: for function declarations in .em files - FunctionResolver: hooks up function calls to module functions or user functions - ModuleProcessor: a visitor for processing const declarations and module function declarations (const declarations are yet to come from the main branch)
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#ifndef POLSERVER_SOURCEFILEPROCESSOR_H
|
|
#define POLSERVER_SOURCEFILEPROCESSOR_H
|
|
|
|
#include <EscriptGrammar/EscriptParserBaseVisitor.h>
|
|
|
|
#include <boost/optional.hpp>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include "compiler/astbuilder/ProgramBuilder.h"
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
{
|
|
class Profile;
|
|
class SourceFile;
|
|
|
|
class SourceFileProcessor : public EscriptGrammar::EscriptParserBaseVisitor
|
|
{
|
|
public:
|
|
SourceFileProcessor( const SourceFileIdentifier&, BuilderWorkspace&, bool is_src );
|
|
|
|
public:
|
|
void use_module( const std::string& name, SourceLocation& including_location,
|
|
long long* micros_counted = nullptr );
|
|
void process_source( SourceFile& );
|
|
|
|
antlrcpp::Any visitStatement( EscriptGrammar::EscriptParser::StatementContext* ) override;
|
|
|
|
SourceLocation location_for( antlr4::ParserRuleContext& ) const;
|
|
|
|
protected:
|
|
Profile& profile;
|
|
Report& report;
|
|
const SourceFileIdentifier& source_file_identifier;
|
|
BuilderWorkspace& workspace;
|
|
|
|
ProgramBuilder tree_builder;
|
|
|
|
private:
|
|
const bool is_src;
|
|
};
|
|
|
|
} // namespace Pol::Bscript::Compiler
|
|
|
|
#endif // POLSERVER_SOURCEFILEPROCESSOR_H
|