Added basic vector<len, Ty>
This commit is contained in:
@@ -73,5 +73,7 @@ int main(int argc, char** argv)
|
|||||||
Util::Log("Function AST", functionsAST.Result());
|
Util::Log("Function AST", functionsAST.Result());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
functionsAST.Result().~vector();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ namespace PashaBibko::LXC::Parser
|
|||||||
return Util::FunctionFail<ParserError>(); // <- TODO: Make an actual error
|
return Util::FunctionFail<ParserError>(); // <- TODO: Make an actual error
|
||||||
|
|
||||||
// Checks for a default value for the variable //
|
// Checks for a default value for the variable //
|
||||||
const Lexer::Token* varAssign = ctx.Peek();
|
const Lexer::Token* varAssign = ctx.Advance();
|
||||||
if (varAssign == nullptr)
|
if (varAssign == nullptr)
|
||||||
return Internal::CreateNode<AST::VarDeclaration>(varNameStr);
|
return Internal::CreateNode<AST::VarDeclaration>(varNameStr);
|
||||||
|
|
||||||
@@ -254,13 +254,6 @@ namespace PashaBibko::LXC::Parser
|
|||||||
if (paramsStart == nullptr )
|
if (paramsStart == nullptr )
|
||||||
return Util::FunctionFail<ParserError>(); // <- TODO: Make an actual error
|
return Util::FunctionFail<ParserError>(); // <- TODO: Make an actual error
|
||||||
|
|
||||||
// Parses the parameters of the function //
|
|
||||||
if (paramsStart->type == Lexer::Token::Identifier && paramsStart->Str() == "void")
|
|
||||||
{ /* No parameters/arguments for the function */}
|
|
||||||
|
|
||||||
// Loops over the parameters/arguments of the function declaration //
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while (ctx.At()->type != Lexer::Token::CloseParen)
|
while (ctx.At()->type != Lexer::Token::CloseParen)
|
||||||
{
|
{
|
||||||
// Checks for parameter pattern: identifier, identifier //
|
// Checks for parameter pattern: identifier, identifier //
|
||||||
@@ -282,7 +275,9 @@ namespace PashaBibko::LXC::Parser
|
|||||||
|
|
||||||
return Util::FunctionFail<ParserError>(); // <- TODO: Make an actual error
|
return Util::FunctionFail<ParserError>(); // <- TODO: Make an actual error
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Adcances over close paren and open brace //
|
||||||
|
ctx.Advance(2);
|
||||||
|
|
||||||
// Parses the function body //
|
// Parses the function body //
|
||||||
const Lexer::Token* current = ctx.At();
|
const Lexer::Token* current = ctx.At();
|
||||||
@@ -301,9 +296,7 @@ namespace PashaBibko::LXC::Parser
|
|||||||
return Util::FunctionFail<ParserError>(node.Error()); // Fowards the error
|
return Util::FunctionFail<ParserError>(node.Error()); // Fowards the error
|
||||||
|
|
||||||
currentFunction.contents.emplace_back(std::move(node.Result()));
|
currentFunction.contents.emplace_back(std::move(node.Result()));
|
||||||
|
current = ctx.At();
|
||||||
// Advances to the next token //
|
|
||||||
current = ctx.Advance();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Util::FunctionFail<ParserError>(); // <- TODO: Make an actual error
|
return Util::FunctionFail<ParserError>(); // <- TODO: Make an actual error
|
||||||
|
|||||||
Reference in New Issue
Block a user