def compute_next(before, block, idx, after):
	"""
	Get the token just after the gap before block[idx] (inspecting inside lists)
	"""
	if idx == len(block):
		return after
	else:
		next = block[idx]
		if type(next) == list:
			if not next:
				return compute_next(before, block, idx+1, after)
			return next[0]
		return next