Renamed to blob
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "Parser/Statement/StatementFunction.h"
|
||||
#include "Parser/Statement/StatementRawFunction.h"
|
||||
#include "Parser/Statement/StatementType.h"
|
||||
#include "Parser/Statement/StatementBlob.h"
|
||||
#include "Parser/Statement/StatementVariable.h"
|
||||
#include "Parser/Statement/StatementAssignment.h"
|
||||
#include "Parser/Statement/StatementReturn.h"
|
||||
@@ -69,8 +69,8 @@ void ModuleBuilder::buildStatement(shared_ptr<Statement> statement) {
|
||||
case StatementKind::RAW_FUNCTION:
|
||||
buildRawFunction(dynamic_pointer_cast<StatementRawFunction>(statement));
|
||||
break;
|
||||
case StatementKind::TYPE:
|
||||
buildType(dynamic_pointer_cast<StatementType>(statement));
|
||||
case StatementKind::BLOB:
|
||||
buildType(dynamic_pointer_cast<StatementBlob>(statement));
|
||||
break;
|
||||
case StatementKind::VARIABLE:
|
||||
buildVarDeclaration(dynamic_pointer_cast<StatementVariable>(statement));
|
||||
@@ -164,7 +164,7 @@ void ModuleBuilder::buildRawFunction(shared_ptr<StatementRawFunction> statement)
|
||||
return;
|
||||
}
|
||||
|
||||
void ModuleBuilder::buildType(shared_ptr<StatementType> statement) {
|
||||
void ModuleBuilder::buildType(shared_ptr<StatementBlob> statement) {
|
||||
llvm::StructType *structType = llvm::StructType::create(*context, statement->getIdentifier());
|
||||
vector<llvm::Type *> elements;
|
||||
structType->setBody(elements, false);
|
||||
|
||||
@@ -29,7 +29,7 @@ enum class ExpressionBinaryOperation;
|
||||
class Statement;
|
||||
class StatementFunction;
|
||||
class StatementRawFunction;
|
||||
class StatementType;
|
||||
class StatementBlob;
|
||||
class StatementVariable;
|
||||
class StatementAssignment;
|
||||
class StatementReturn;
|
||||
@@ -71,7 +71,7 @@ private:
|
||||
void buildStatement(shared_ptr<Statement> statement);
|
||||
void buildFunction(shared_ptr<StatementFunction> statement);
|
||||
void buildRawFunction(shared_ptr<StatementRawFunction> statement);
|
||||
void buildType(shared_ptr<StatementType> statement);
|
||||
void buildType(shared_ptr<StatementBlob> statement);
|
||||
void buildVarDeclaration(shared_ptr<StatementVariable> statement);
|
||||
void buildAssignment(shared_ptr<StatementAssignment> statement);
|
||||
void buildBlock(shared_ptr<StatementBlock> statement);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "Parser/Statement/StatementVariable.h"
|
||||
#include "Parser/Statement/StatementFunction.h"
|
||||
#include "Parser/Statement/StatementRawFunction.h"
|
||||
#include "Parser/Statement/StatementType.h"
|
||||
#include "Parser/Statement/StatementBlob.h"
|
||||
#include "Parser/Statement/StatementBlock.h"
|
||||
#include "Parser/Statement/StatementAssignment.h"
|
||||
#include "Parser/Statement/StatementReturn.h"
|
||||
@@ -241,8 +241,8 @@ string Logger::toString(shared_ptr<Statement> statement) {
|
||||
return toString(dynamic_pointer_cast<StatementFunction>(statement));
|
||||
case StatementKind::RAW_FUNCTION:
|
||||
return toString(dynamic_pointer_cast<StatementRawFunction>(statement));
|
||||
case StatementKind::TYPE:
|
||||
return toString(dynamic_pointer_cast<StatementType>(statement));
|
||||
case StatementKind::BLOB:
|
||||
return toString(dynamic_pointer_cast<StatementBlob>(statement));
|
||||
case StatementKind::BLOCK:
|
||||
return toString(dynamic_pointer_cast<StatementBlock>(statement));
|
||||
case StatementKind::ASSIGNMENT:
|
||||
@@ -303,10 +303,10 @@ string Logger::toString(shared_ptr<StatementRawFunction> statement) {
|
||||
return text;
|
||||
}
|
||||
|
||||
string Logger::toString(shared_ptr<StatementType> statement) {
|
||||
string Logger::toString(shared_ptr<StatementBlob> statement) {
|
||||
string text;
|
||||
|
||||
text += format("TYPE(\"{}\"):\n", statement->getIdentifier());
|
||||
text += format("BLOB(\"{}\"):\n", statement->getIdentifier());
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class StatementMetaExternFunction;
|
||||
class StatementVariable;
|
||||
class StatementFunction;
|
||||
class StatementRawFunction;
|
||||
class StatementType;
|
||||
class StatementBlob;
|
||||
class StatementBlock;
|
||||
class StatementAssignment;
|
||||
class StatementReturn;
|
||||
@@ -45,7 +45,7 @@ private:
|
||||
static string toString(shared_ptr<StatementVariable> statement);
|
||||
static string toString(shared_ptr<StatementFunction> statement);
|
||||
static string toString(shared_ptr<StatementRawFunction> statement);
|
||||
static string toString(shared_ptr<StatementType> statement);
|
||||
static string toString(shared_ptr<StatementBlob> statement);
|
||||
static string toString(shared_ptr<StatementBlock> statement);
|
||||
static string toString(shared_ptr<StatementAssignment> statement);
|
||||
static string toString(shared_ptr<StatementReturn> statement);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "Parser/Statement/StatementFunction.h"
|
||||
#include "Parser/Statement/StatementRawFunction.h"
|
||||
#include "Parser/Statement/StatementType.h"
|
||||
#include "Parser/Statement/StatementBlob.h"
|
||||
#include "Parser/Statement/StatementVariable.h"
|
||||
#include "Parser/Statement/StatementAssignment.h"
|
||||
#include "Parser/Statement/StatementReturn.h"
|
||||
@@ -81,7 +81,7 @@ shared_ptr<Statement> Parser::nextStatement() {
|
||||
if (statement != nullptr || errors.size() > errorsCount)
|
||||
return statement;
|
||||
|
||||
statement = matchStatementType();
|
||||
statement = matchStatementBlob();
|
||||
if (statement != nullptr || errors.size() > errorsCount)
|
||||
return statement;
|
||||
|
||||
@@ -491,7 +491,7 @@ shared_ptr<Statement> Parser::matchStatementRawFunction() {
|
||||
return make_shared<StatementRawFunction>(name, constraints, arguments, returnType, rawSource);
|
||||
}
|
||||
|
||||
shared_ptr<Statement> Parser::matchStatementType() {
|
||||
shared_ptr<Statement> Parser::matchStatementBlob() {
|
||||
ParseeResultsGroup resultsGroup;
|
||||
|
||||
string identifier;
|
||||
@@ -535,7 +535,7 @@ shared_ptr<Statement> Parser::matchStatementType() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return make_shared<StatementType>(identifier, variables);
|
||||
return make_shared<StatementBlob>(identifier, variables);
|
||||
}
|
||||
|
||||
shared_ptr<Statement> Parser::matchStatementBlock(vector<TokenKind> terminalTokenKinds) {
|
||||
|
||||
@@ -31,7 +31,7 @@ private:
|
||||
shared_ptr<Statement> matchStatementVariable();
|
||||
shared_ptr<Statement> matchStatementFunction();
|
||||
shared_ptr<Statement> matchStatementRawFunction();
|
||||
shared_ptr<Statement> matchStatementType();
|
||||
shared_ptr<Statement> matchStatementBlob();
|
||||
|
||||
shared_ptr<Statement> matchStatementBlock(vector<TokenKind> terminalTokenKinds);
|
||||
shared_ptr<Statement> matchStatementAssignment();
|
||||
|
||||
@@ -15,7 +15,7 @@ enum class StatementKind {
|
||||
ASSIGNMENT,
|
||||
REPEAT,
|
||||
META_EXTERN_FUNCTION,
|
||||
TYPE
|
||||
BLOB
|
||||
};
|
||||
|
||||
class Statement {
|
||||
|
||||
14
src/Parser/Statement/StatementBlob.cpp
Normal file
14
src/Parser/Statement/StatementBlob.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "StatementBlob.h"
|
||||
|
||||
#include "Parser/ValueType.h"
|
||||
|
||||
StatementBlob::StatementBlob(string identifier, vector<pair<string, shared_ptr<ValueType>>> variables):
|
||||
Statement(StatementKind::BLOB), identifier(identifier), variables(variables) { }
|
||||
|
||||
string StatementBlob::getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
vector<pair<string, shared_ptr<ValueType>>> StatementBlob::getVariables() {
|
||||
return variables;
|
||||
}
|
||||
@@ -3,16 +3,15 @@
|
||||
|
||||
#include "Statement.h"
|
||||
|
||||
class StatementVariable;
|
||||
class ValueType;
|
||||
|
||||
class StatementType: public Statement {
|
||||
class StatementBlob: public Statement {
|
||||
private:
|
||||
string identifier;
|
||||
vector<pair<string, shared_ptr<ValueType>>> variables;
|
||||
|
||||
public:
|
||||
StatementType(string identifier, vector<pair<string, shared_ptr<ValueType>>> variables);
|
||||
StatementBlob(string identifier, vector<pair<string, shared_ptr<ValueType>>> variables);
|
||||
string getIdentifier();
|
||||
vector<pair<string, shared_ptr<ValueType>>> getVariables();
|
||||
};
|
||||
@@ -1,14 +0,0 @@
|
||||
#include "StatementType.h"
|
||||
|
||||
#include "Parser/ValueType.h"
|
||||
|
||||
StatementType::StatementType(string identifier, vector<pair<string, shared_ptr<ValueType>>> variables):
|
||||
Statement(StatementKind::TYPE), identifier(identifier), variables(variables) { }
|
||||
|
||||
string StatementType::getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
vector<pair<string, shared_ptr<ValueType>>> StatementType::getVariables() {
|
||||
return variables;
|
||||
}
|
||||
Reference in New Issue
Block a user