diff --git a/src/headers/parsing/ParseComponents.hpp b/src/headers/parsing/ParseComponents.hpp index 08ba9b0..76950f7 100644 --- a/src/headers/parsing/ParseComponents.hpp +++ b/src/headers/parsing/ParseComponents.hpp @@ -107,7 +107,7 @@ namespace StandardComponents { explicit String(const char* string): content(string) {} }; } - struct Call: ParseTree { inline explicit Call(ParseTree&& tree) noexcept: ParseTree(move(tree)) {} }; + struct Call: ParseTree {}; struct Class: NamedIdentifier { using NamedIdentifier::NamedIdentifier; diff --git a/src/headers/parsing/Parser.hpp b/src/headers/parsing/Parser.hpp index bc3db9a..957d955 100644 --- a/src/headers/parsing/Parser.hpp +++ b/src/headers/parsing/Parser.hpp @@ -15,14 +15,15 @@ namespace Parser { const tok& token, const string& text, const bool& quoteTokenText = false ) { error(token, text, token.line, quoteTokenText); } - ParseTree parseVector(const vector& lexed) { - ParseTree parseTree; + IS(ParseTree) + T parseVector(const vector& lexed) { + T parseTree; using namespace StandardComponents; using enum tok::type; unsigned int i = 0; - const auto nextAre = [&i, &lexed] T>(const initializer_list& nextValues) -> bool { + const auto nextAre = [&i, &lexed] Y>(const initializer_list& nextValues) -> bool { unsigned int j = 1; - for (const T& nextValue: nextValues) { + for (const Y& nextValue: nextValues) { if (!cmp_greater(lexed.size() - i, nextValues.size()) || lexed[i + j].toktype != nextValue) { return false; } @@ -46,7 +47,7 @@ namespace Parser { } else { bool isFinalDefine = nextAre({TAG, DEFINE}); if (isFinalDefine || next.toktype == DEFINE) { - const optional previousDefinition = parseTree.findReferenceByName(current.toktext); + const optional previousDefinition = parseTree.template findReferenceByName(current.toktext); if (previousDefinition.has_value()) { if (previousDefinition.value().get().final || isFinalDefine) { parsingError(current, previousDefinition->get().final ? " cannot be redefined as it is final" : " cannot be made final after it has been declared", true); @@ -80,7 +81,7 @@ namespace Parser { } } switch (current.toktype) { - case LPAR: parseTree << Call(parseVector(subTokens)); break; + case LPAR: parseTree << parseVector(subTokens); break; case LBRACE: // TODO Add structures for class/function bodies case LBRACKET: default: parseTree << parseVector(subTokens); break;