From ab6b7a80449f8809432f15597f6b2a6fd269dbdd Mon Sep 17 00:00:00 2001 From: John Keiser Date: Tue, 18 Aug 2020 10:12:42 -0700 Subject: [PATCH] Make last_structural() helper --- src/generic/stage2/structural_parser.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/generic/stage2/structural_parser.h b/src/generic/stage2/structural_parser.h index 05048bc1..49e45aa9 100644 --- a/src/generic/stage2/structural_parser.h +++ b/src/generic/stage2/structural_parser.h @@ -79,6 +79,10 @@ struct structural_parser : structural_iterator { return SUCCESS; } + really_inline uint8_t last_structural() { + return buf[dom_parser.structural_indexes[dom_parser.n_structural_indexes - 1]]; + } + really_inline void log_value(const char *type) { logger::log_line(*this, "", type, ""); } @@ -120,12 +124,12 @@ WARN_UNUSED really_inline error_code structural_parser::parse(T &builder) noexce if (!STREAMING) { switch (*value) { case '{': - if (buf[dom_parser.structural_indexes[dom_parser.n_structural_indexes - 1]] != '}') { + if (last_structural() != '}') { return TAPE_ERROR; } break; case '[': - if (buf[dom_parser.structural_indexes[dom_parser.n_structural_indexes - 1]] != ']') { + if (last_structural() != ']') { return TAPE_ERROR; } break;