# The only thing allowed after a list, is this next marker, or a newline.
ifline=="###next-name-looks-similar":
# "###next-name-looks-similar"
# Indicates the common prefix of the last list has a very
# similar name to the next entry, but isn't part of the
# list. So do not emit a warning about them looking very
# similar.
iflength!=0:
errors.append(f"ERROR: list around {name} is shorted than indicated by ###length")
common_prefix=""
else:
errors.append(f"ERROR: expected a newline after a list, but didn't find any around {name}. Did you add an entry to the list without increasing the length?")
skip=SkipType.NONE
ifline[0]=="#":
ifline.startswith("###length "):
# "###length <count>"
# Indicates the next few entries are part of a list. Only
# the first entry is possibly referenced, and the rest are
# indirectly.
iflength!=0:
errors.append(f"ERROR: list around {name} is shorted than indicated by ###length")
length=line.split("")[1].strip()
iflength.isnumeric():
length=int(length)
else:
length=LENGTH_NAME_LOOKUP[length]
skip=SkipType.LENGTH
elifline.startswith("###external "):
# "###external <count>"
# Indicates the next few entries are used outside the
# source and will not be referenced.
iflength!=0:
errors.append(f"ERROR: list around {name} is shorted than indicated by ###length")
errors.append(f"ERROR: common prefix of block including {name} was reduced to {common_prefix}. This means the names in the list are not consistent.")
elifcommon_prefix:
ifname.startswith(common_prefix):
errors.append(f"ERROR: {name} looks a lot like block above with prefix {common_prefix}. This mostly means that the list length was too short. Use '###next-name-looks-similar' if it is not.")