Added comments

This commit is contained in:
2024-12-06 22:05:41 +01:00
parent d2cbdc2910
commit b3f75ae3d8
15 changed files with 128 additions and 12 deletions

View File

@ -33,6 +33,7 @@ namespace fsh {
using TokenType = Lexer::TokenType;
AstNode(NodeType type, std::string name) : type(type), name(name) {}
// Pokusa da napravi od narednih tokena zadati Node ako ne uspe vrati null
template <class T>
static std::shared_ptr<T> Optional(std::list<Token>::iterator& it, std::shared_ptr<T>& node_ptr);
@ -42,6 +43,7 @@ namespace fsh {
return Optional<T>(it, node_ptr);
}
// Pravi od narednih tokena zadati Node ako ne uspe izbaci AstBuildError
template <class T>
static std::shared_ptr<T> Mandatory(std::list<Token>::iterator& it) {
return T::build(it);
@ -70,4 +72,4 @@ namespace fsh {
AstBuildError(std::string err) : std::runtime_error(err) {}
};
} // namespace fsh
}