]> ocean-lang.org Git - ocean/blobdiff - csrc/parsergen.mdc
parsergen: guard against tos going negative.
[ocean] / csrc / parsergen.mdc
index da9335ed0df1794fe49c35030272e333956259a3..a913cb912c77cf5a977e835b4bd1ec8ac212929b 100644 (file)
@@ -2990,7 +2990,7 @@ checks if a given token is in any of these look-ahead sets.
                void *ret = NULL;
 
                shift(&p, TK_eof, 0, 1, NULL, states);
-               while (!accepted) {
+               while (!accepted && p.tos > 0) {
                        struct token *err_tk;
                        struct frame *tos = &p.stack[p.tos-1];
                        if (!tk)