public bool StateIs(StringWalkerState expectedState) { if (state.Count == 0) return false; return state.Peek() == expectedState; }