#pragma once #include #include #include "Lexer.h" #include "Expression.h" #include "Statement.h" #include "TypeWrapper.h" #include "helperFunctions/ShortHands.h" class Parser { private: const std::vector tokens; int current = 0; public: explicit Parser(std::vector tokens) : tokens(std::move(tokens)){}; std::vector parse(); private: sptr(Expr) expression(); sptr(Expr) equality(); sptr(Expr) comparison(); sptr(Expr) term(); sptr(Expr) factor(); sptr(Expr) unary(); sptr(Expr) primary(); bool match(const std::vector& types); bool check(TokenType type); bool isAtEnd(); Token advance(); Token peek(); Token previous(); Token consume(TokenType type, const std::string& message); sptr(Stmt) statement(); void sync(); std::shared_ptr printStatement(); std::shared_ptr expressionStatement(); std::shared_ptr declaration(); std::shared_ptr varDeclaration(); std::shared_ptr assignment(); std::vector> block(); };