INNER CODE UNIT · Python
parse_lex_dict
evpo/EncryptPad · configure.py:52
def parse_lex_dict(as_list):
if len(as_list) % 3 != 0:
raise InternalError("Lex dictionary has invalid format (input not divisible by 3): %s" % as_list)
result = {}
for key, sep, value in [as_list[3*i:3*i+3] for i in range(0, len(as_list)//3)]:
if sep != '->':
raise InternalError("Lex dictionary has invalid format")
result[key] = value
return result
def lex_me_harder(infofile, allowed_groups, allowed_maps, name_val_pairs):
"""
Generic lexer function for info.txt and src/build-data files
"""
out = LexResult()
# Format as a nameable Python variable