From 6672a10c08f3e4b093a5c34874db4cbbec36b73f Mon Sep 17 00:00:00 2001 From: apio Date: Wed, 8 Jun 2022 19:17:16 +0200 Subject: [PATCH] m_index for Parser --- src/Parser.cpp | 15 +++++++++++++++ src/Parser.h | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/src/Parser.cpp b/src/Parser.cpp index 0f1a4eb..28736d6 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -31,3 +31,18 @@ Parser::ErrorOr Parser::walk_expr() { return ErrorOr(new ExprNode()); // constructor does not want to accept a shared_ptr in the argument list, thats why im not using make_shared here } + +Parser::ErrorOr Parser::walk_number() +{ + return ErrorOr(new NumberNode()); +} + +void Parser::save_current_position() +{ + saved_m_index = m_index; +} + +void Parser::restore_current_position() +{ + m_index = saved_m_index; +} diff --git a/src/Parser.h b/src/Parser.h index 25be0e3..c85a9cd 100644 --- a/src/Parser.h +++ b/src/Parser.h @@ -38,6 +38,12 @@ private: ErrorOr walk_expr(); ErrorOr walk_number(); + + int m_index; + int saved_m_index; + + void save_current_position(); + void restore_current_position(); public: ~Parser();