Added args and return type

This commit is contained in:
Rafał Grodziński
2025-07-15 10:23:32 +09:00
parent 5616036c17
commit 51115f5883
4 changed files with 30 additions and 24 deletions

View File

@@ -241,6 +241,8 @@ shared_ptr<Statement> Parser::matchStatementRawFunction() {
string name;
string constraints;
vector<pair<string, shared_ptr<ValueType>>> arguments;
shared_ptr<ValueType> returnType = ValueType::NONE;
string rawSource;
// name
@@ -260,6 +262,10 @@ shared_ptr<Statement> Parser::matchStatementRawFunction() {
markError({TokenKind::GREATER}, {});
}
// arguments
// return type
// consume new line
if (!tryMatchingTokenKinds({TokenKind::NEW_LINE}, true, true)) {
markError(TokenKind::NEW_LINE, {});
@@ -281,7 +287,7 @@ shared_ptr<Statement> Parser::matchStatementRawFunction() {
return nullptr;
}
return make_shared<StatementRawFunction>(name, constraints, rawSource);
return make_shared<StatementRawFunction>(name, constraints, arguments, returnType, rawSource);
}
shared_ptr<Statement> Parser::matchStatementBlock(vector<TokenKind> terminalTokenKinds) {