Added empty statement type
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "Parser/Statement/StatementFunction.h"
|
||||
#include "Parser/Statement/StatementRawFunction.h"
|
||||
#include "Parser/Statement/StatementType.h"
|
||||
#include "Parser/Statement/StatementVariable.h"
|
||||
#include "Parser/Statement/StatementAssignment.h"
|
||||
#include "Parser/Statement/StatementReturn.h"
|
||||
@@ -80,6 +81,10 @@ shared_ptr<Statement> Parser::nextStatement() {
|
||||
if (statement != nullptr || errors.size() > errorsCount)
|
||||
return statement;
|
||||
|
||||
statement = matchStatementType();
|
||||
if (statement != nullptr || errors.size() > errorsCount)
|
||||
return statement;
|
||||
|
||||
markError({}, {});
|
||||
return nullptr;
|
||||
}
|
||||
@@ -486,6 +491,10 @@ shared_ptr<Statement> Parser::matchStatementRawFunction() {
|
||||
return make_shared<StatementRawFunction>(name, constraints, arguments, returnType, rawSource);
|
||||
}
|
||||
|
||||
shared_ptr<Statement> Parser::matchStatementType() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
shared_ptr<Statement> Parser::matchStatementBlock(vector<TokenKind> terminalTokenKinds) {
|
||||
vector<shared_ptr<Statement>> statements;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ private:
|
||||
shared_ptr<Statement> matchStatementVariable();
|
||||
shared_ptr<Statement> matchStatementFunction();
|
||||
shared_ptr<Statement> matchStatementRawFunction();
|
||||
shared_ptr<Statement> matchStatementType();
|
||||
|
||||
shared_ptr<Statement> matchStatementBlock(vector<TokenKind> terminalTokenKinds);
|
||||
shared_ptr<Statement> matchStatementAssignment();
|
||||
|
||||
@@ -14,7 +14,8 @@ enum class StatementKind {
|
||||
VARIABLE,
|
||||
ASSIGNMENT,
|
||||
REPEAT,
|
||||
META_EXTERN_FUNCTION
|
||||
META_EXTERN_FUNCTION,
|
||||
TYPE
|
||||
};
|
||||
|
||||
class Statement {
|
||||
|
||||
12
src/Parser/Statement/StatementType.cpp
Normal file
12
src/Parser/Statement/StatementType.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "StatementType.h"
|
||||
|
||||
StatementType::StatementType(string identifier, vector<shared_ptr<StatementVariable>> statementVariable):
|
||||
Statement(StatementKind::TYPE), identifier(identifier), statementVariables(statementVariable) { }
|
||||
|
||||
string StatementType::getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
vector<shared_ptr<StatementVariable>> StatementType::getStatementVariables() {
|
||||
return statementVariables;
|
||||
}
|
||||
19
src/Parser/Statement/StatementType.h
Normal file
19
src/Parser/Statement/StatementType.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef STATEMENT_TYPE_H
|
||||
#define STATEMENT_TYPE_H
|
||||
|
||||
#include "Statement.h"
|
||||
|
||||
class StatementVariable;
|
||||
|
||||
class StatementType: public Statement {
|
||||
private:
|
||||
string identifier;
|
||||
vector<shared_ptr<StatementVariable>> statementVariables;
|
||||
|
||||
public:
|
||||
StatementType(string identifier, vector<shared_ptr<StatementVariable>> statementVariables);
|
||||
string getIdentifier();
|
||||
vector<shared_ptr<StatementVariable>> getStatementVariables();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user