* Automatically push when the stack is empty

This commit is contained in:
Matthew Honnibal 2014-12-18 09:16:10 +11:00
parent 61142a8eff
commit 7e0c692daf
1 changed files with 4 additions and 1 deletions

View File

@ -22,6 +22,8 @@ cdef int pop_stack(State *s) except -1:
assert s.stack_len >= 1
s.stack_len -= 1
s.stack -= 1
if s.stack_len == 0 and not at_eol(s):
push_stack(s)
cdef int push_stack(State *s) except -1:
@ -117,4 +119,5 @@ cdef State* init_state(Pool mem, TokenC* sent, const int sent_length) except NUL
s.stack_len = 0
s.i = 0
s.sent_len = sent_length
push_stack(s)
return s