@table(TypedName, EnumName) character_states:
{
    { "none",                None            },
    { "normal",              Normal          },
    { "happy",               Happy           },
}

@table_gen
{
    `enum character_state`;
    `{`;
        `CR_State_Invalid = 0,`
            @expand(character_states s) `CR_State_$(s.EnumName),`
            `};`;
}

@table_gen @c
{
    `static character_state CR_CharacterStateFromString(string String)`;
    `{`;
        `character_state Result = CR_State_Invalid;`;
        `if(0) {}`;
        @expand(character_states s) `else if(AreEqual(String, StrLit("$(s.TypedName)")))$(=>40) { Result = CR_State_$(s.EnumName); }`;
        `return(Result);`;
        `}`;
}