Files
corelang/core_generated.cpp
Krzosa Karol 5495f96b3b Clang format
2023-03-28 21:16:10 +02:00

83 lines
3.7 KiB
C++

/*#import meta
print("""CORE_Static Ast_Operator_Info *
get_operator_info(Token_Kind op){
switch(op){""")
index = 0
for i in meta.token_simple_expr:
if i[1] != "SPECIAL":
print(f""" case TK_{i[0]}: return pctx->op_info_table + {index};""")
index += 1
print(" default: {}\n }")
print(" return 0;\n}")
print("""CORE_Static Ast_Operator_Info *
get_operator_info(Intern_String op){
if(0){}""")
index = 0
for i in meta.token_simple_expr:
if i[1] != "SPECIAL":
print(f""" else if(pctx->op_info_table[{index}].op.str == op.str) return pctx->op_info_table + {index};""")
index += 1
print(" return 0;\n}")
*/
CORE_Static Ast_Operator_Info *
get_operator_info(Token_Kind op) {
switch (op) {
case TK_Mul: return pctx->op_info_table + 0;
case TK_Div: return pctx->op_info_table + 1;
case TK_Mod: return pctx->op_info_table + 2;
case TK_LeftShift: return pctx->op_info_table + 3;
case TK_RightShift: return pctx->op_info_table + 4;
case TK_Add: return pctx->op_info_table + 5;
case TK_Sub: return pctx->op_info_table + 6;
case TK_Equals: return pctx->op_info_table + 7;
case TK_LesserThenOrEqual: return pctx->op_info_table + 8;
case TK_GreaterThenOrEqual: return pctx->op_info_table + 9;
case TK_LesserThen: return pctx->op_info_table + 10;
case TK_GreaterThen: return pctx->op_info_table + 11;
case TK_NotEquals: return pctx->op_info_table + 12;
case TK_BitAnd: return pctx->op_info_table + 13;
case TK_BitOr: return pctx->op_info_table + 14;
case TK_BitXor: return pctx->op_info_table + 15;
case TK_And: return pctx->op_info_table + 16;
case TK_Or: return pctx->op_info_table + 17;
case TK_Neg: return pctx->op_info_table + 18;
case TK_Not: return pctx->op_info_table + 19;
default: {
}
}
return 0;
}
CORE_Static Ast_Operator_Info *
get_operator_info(Intern_String op) {
if (0) {
}
else if (pctx->op_info_table[0].op.str == op.str) return pctx->op_info_table + 0;
else if (pctx->op_info_table[1].op.str == op.str) return pctx->op_info_table + 1;
else if (pctx->op_info_table[2].op.str == op.str) return pctx->op_info_table + 2;
else if (pctx->op_info_table[3].op.str == op.str) return pctx->op_info_table + 3;
else if (pctx->op_info_table[4].op.str == op.str) return pctx->op_info_table + 4;
else if (pctx->op_info_table[5].op.str == op.str) return pctx->op_info_table + 5;
else if (pctx->op_info_table[6].op.str == op.str) return pctx->op_info_table + 6;
else if (pctx->op_info_table[7].op.str == op.str) return pctx->op_info_table + 7;
else if (pctx->op_info_table[8].op.str == op.str) return pctx->op_info_table + 8;
else if (pctx->op_info_table[9].op.str == op.str) return pctx->op_info_table + 9;
else if (pctx->op_info_table[10].op.str == op.str) return pctx->op_info_table + 10;
else if (pctx->op_info_table[11].op.str == op.str) return pctx->op_info_table + 11;
else if (pctx->op_info_table[12].op.str == op.str) return pctx->op_info_table + 12;
else if (pctx->op_info_table[13].op.str == op.str) return pctx->op_info_table + 13;
else if (pctx->op_info_table[14].op.str == op.str) return pctx->op_info_table + 14;
else if (pctx->op_info_table[15].op.str == op.str) return pctx->op_info_table + 15;
else if (pctx->op_info_table[16].op.str == op.str) return pctx->op_info_table + 16;
else if (pctx->op_info_table[17].op.str == op.str) return pctx->op_info_table + 17;
else if (pctx->op_info_table[18].op.str == op.str) return pctx->op_info_table + 18;
else if (pctx->op_info_table[19].op.str == op.str) return pctx->op_info_table + 19;
return 0;
}
/*END*/