#ifndef INCLUDE_CORE_PARSER_H #define INCLUDE_CORE_PARSER_H #include #include #include #include "array.h" #include "array_value.h" #include "define_statement.h" #include "lexer.h" namespace fex { class Parser { public: Parser() = default; std::vector Parse(std::vector tokens); std::vector ParseTopLevelArrays(std::vector tokens); std::map ParseTopLevelObjects(std::vector tokens); std::map ReadDefines(const std::string &filename, std::vector matching); private: int EvaluateExpression(std::vector tokens); int ResolveIdentifier(); int ResolveIdentifier(const Token &token); int GetPrecedence(const Token &token); bool IsOperator(const Token &token); bool IsParamMacro(); std::vector ToPostfix(); DefineStatement ParseDefine(); ArrayValue ParseObject(); Token Peek(); Token Next(); unsigned long index_; std::vector tokens_; std::map top_level_; }; } // namespace fex #endif // INCLUDE_CORE_PARSER_H