aboutsummaryrefslogtreecommitdiff
path: root/parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'parser.cpp')
-rw-r--r--parser.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/parser.cpp b/parser.cpp
index ff21b7b..97482d4 100644
--- a/parser.cpp
+++ b/parser.cpp
@@ -149,6 +149,9 @@ Pair *ASTGenerator::absorb(Tokenizor *tk) {
FrameObj **top_ptr = parse_stack;
for (;;)
{
+ if (top_ptr == parse_stack + PARSE_STACK_SIZE)
+ throw TokenError("Parser", RUN_ERR_STACK_OVERFLOW);
+
if (top_ptr - parse_stack > 1 &&
!IS_BRAKET(*(top_ptr - 1)) &&
IS_BRAKET(*(top_ptr - 2)))