From 7ec6f2d8a28883a4921462a0713974e66cfb2f46 Mon Sep 17 00:00:00 2001 From: 3lswear Date: Wed, 12 Jan 2022 13:31:29 +0300 Subject: [PATCH] add MAPARRAY token detection --- src/config/Tokenizer.hpp | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/config/Tokenizer.hpp b/src/config/Tokenizer.hpp index 76acd5e..6efb75b 100644 --- a/src/config/Tokenizer.hpp +++ b/src/config/Tokenizer.hpp @@ -144,10 +144,39 @@ namespace config file.get(c); } } - else if (c == '[') - token.type = ARR_OPEN; else if (c == ']') - token.type = ARR_CLOSE; + { + std::streampos prev_pos = file.tellg(); + file.get(c); + if (c == ']') + { + token.type = MAPARRAY_CLOSE; + } + else + { + token.type = ARR_CLOSE; + file.seekg(prev_pos); + } + } + else if (c == '[') + { + std::streampos prev_pos = file.tellg(); + file.get(c); + if (c == '[') + { + token.type = MAPARRAY_OPEN; + } + else + { + token.type = ARR_OPEN; + file.seekg(prev_pos); + } + + } + /* else if (c == '[') */ + /* token.type = ARR_OPEN; */ + /* else if (c == ']') */ + /* token.type = ARR_CLOSE; */ else if (c == '=') token.type = ASSIGN; else if (c == '\n')