More code generation
This commit is contained in:
135
core_lexing.cpp
135
core_lexing.cpp
@@ -621,73 +621,82 @@ lex_stream(Allocator *token_string_arena, Allocator *map_allocator, String istre
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Token metadata
|
// Token metadata
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
function const char *
|
function const char *
|
||||||
name(Token_Kind kind){
|
name(Token_Kind kind){
|
||||||
switch(kind){
|
switch(kind){
|
||||||
case TK_End: return "End of stream";
|
case TK_End: return "End of stream";
|
||||||
case TK_Mul: return "*";
|
/*#
|
||||||
case TK_Div: return "/";
|
import meta
|
||||||
case TK_Add: return "+";
|
for i in meta.token_kinds:
|
||||||
case TK_Sub: return "-";
|
if i[1] != "SPECIAL":
|
||||||
case TK_Mod: return "%";
|
print("case TK_" + i[0] + f": return \"{i[1]}\";")
|
||||||
case TK_BitAnd: return "&";
|
*/
|
||||||
case TK_BitOr: return "|";
|
case TK_Mul: return "*";
|
||||||
case TK_BitXor: return "^";
|
case TK_Div: return "/";
|
||||||
case TK_Neg: return "~";
|
case TK_Mod: return "%";
|
||||||
case TK_Not: return "!";
|
case TK_LeftShift: return "<<";
|
||||||
case TK_OpenParen: return "(";
|
case TK_RightShift: return ">>";
|
||||||
case TK_CloseParen: return ")";
|
case TK_Add: return "+";
|
||||||
case TK_OpenBrace: return "{";
|
case TK_Sub: return "-";
|
||||||
case TK_CloseBrace: return "}";
|
case TK_Equals: return "==";
|
||||||
case TK_OpenBracket: return "[";
|
case TK_LesserThenOrEqual: return "<=";
|
||||||
case TK_CloseBracket: return "]";
|
case TK_GreaterThenOrEqual: return ">=";
|
||||||
case TK_ColonAssign: return ":=";
|
case TK_LesserThen: return "<";
|
||||||
case TK_Comma: return ",";
|
case TK_GreaterThen: return ">";
|
||||||
case TK_Pound: return "#";
|
case TK_NotEquals: return "!=";
|
||||||
case TK_Question: return "?";
|
case TK_BitAnd: return "&";
|
||||||
case TK_ThreeDots: return "...";
|
case TK_BitOr: return "|";
|
||||||
case TK_Semicolon: return ";";
|
case TK_BitXor: return "^";
|
||||||
case TK_Dot: return ".";
|
case TK_And: return "&&";
|
||||||
case TK_LesserThen: return "<";
|
case TK_Or: return "||";
|
||||||
case TK_GreaterThen: return ">";
|
case TK_Neg: return "~";
|
||||||
case TK_Colon: return ":";
|
case TK_Not: return "!";
|
||||||
case TK_Assign: return "=";
|
case TK_Decrement: return "--";
|
||||||
case TK_DivAssign: return "/=";
|
case TK_Increment: return "++";
|
||||||
case TK_MulAssign: return "*=";
|
case TK_PostDecrement: return "--";
|
||||||
case TK_ModAssign: return "%=";
|
case TK_PostIncrement: return "++";
|
||||||
case TK_SubAssign: return "-=";
|
case TK_Assign: return "=";
|
||||||
case TK_AddAssign: return "+=";
|
case TK_ColonAssign: return ":=";
|
||||||
case TK_AndAssign: return "&=";
|
case TK_DivAssign: return "/=";
|
||||||
case TK_OrAssign: return "|=";
|
case TK_MulAssign: return "*=";
|
||||||
case TK_XorAssign: return "^=";
|
case TK_ModAssign: return "%=";
|
||||||
case TK_LeftShiftAssign: return "<<=";
|
case TK_SubAssign: return "-=";
|
||||||
case TK_RightShiftAssign: return ">>=";
|
case TK_AddAssign: return "+=";
|
||||||
case TK_DoubleColon: return "::";
|
case TK_AndAssign: return "&=";
|
||||||
case TK_At: return "@";
|
case TK_OrAssign: return "|=";
|
||||||
case TK_Decrement: return "--";
|
case TK_XorAssign: return "^=";
|
||||||
case TK_Increment: return "++";
|
case TK_LeftShiftAssign: return "<<=";
|
||||||
case TK_PostDecrement: return "--";
|
case TK_RightShiftAssign: return ">>=";
|
||||||
case TK_PostIncrement: return "++";
|
case TK_OpenParen: return "(";
|
||||||
case TK_LesserThenOrEqual: return "<=";
|
case TK_CloseParen: return ")";
|
||||||
case TK_GreaterThenOrEqual: return ">=";
|
case TK_OpenBrace: return "{";
|
||||||
case TK_Equals: return "==";
|
case TK_CloseBrace: return "}";
|
||||||
case TK_And: return "&&";
|
case TK_OpenBracket: return "[";
|
||||||
case TK_Or: return "||";
|
case TK_CloseBracket: return "]";
|
||||||
case TK_NotEquals: return "!=";
|
case TK_Comma: return ",";
|
||||||
case TK_LeftShift: return "<<";
|
case TK_Pound: return "#";
|
||||||
case TK_RightShift: return ">>";
|
case TK_Question: return "?";
|
||||||
case TK_Arrow: return "->";
|
case TK_ThreeDots: return "...";
|
||||||
case TK_NewLine: return "New_Line";
|
case TK_Semicolon: return ";";
|
||||||
case TK_ExprSizeof: return "sizeof";
|
case TK_Dot: return ".";
|
||||||
case TK_DocComment: return "Doc_Comment";
|
case TK_TwoDots: return "..";
|
||||||
case TK_Comment: return "Comment";
|
case TK_NewLine: return "[NewLine]";
|
||||||
case TK_Identifier: return "Identifier";
|
case TK_Colon: return ":";
|
||||||
case TK_StringLit: return "String_Lit";
|
case TK_DoubleColon: return "::";
|
||||||
case TK_UnicodeLit: return "Unicode_Lit";
|
case TK_At: return "@";
|
||||||
case TK_Error: return "Error";
|
case TK_Arrow: return "->";
|
||||||
case TK_Float: return "Float";
|
case TK_ExprSizeof: return "[SizeOf]";
|
||||||
case TK_Integer: return "int";
|
case TK_DocComment: return "[///]";
|
||||||
case TK_Keyword: return "Keyword";
|
case TK_Comment: return "//";
|
||||||
|
case TK_Identifier: return "[Ident]";
|
||||||
|
case TK_UnicodeLit: return "[Unicode]";
|
||||||
|
case TK_StringLit: return "[String]";
|
||||||
|
case TK_Error: return "[Error]";
|
||||||
|
case TK_Float: return "[Float]";
|
||||||
|
case TK_Integer: return "[Int]";
|
||||||
|
case TK_Keyword: return "[Keyword]";
|
||||||
|
/*END*/
|
||||||
case CLOSE_SCOPE: return "Close_Scope";
|
case CLOSE_SCOPE: return "Close_Scope";
|
||||||
case OPEN_SCOPE: return "Open_Scope";
|
case OPEN_SCOPE: return "Open_Scope";
|
||||||
case SAME_SCOPE: return "Same_Scope";
|
case SAME_SCOPE: return "Same_Scope";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import sys
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
files = ["core_compiler.cpp", "core_compiler.h", "core_globals.cpp"]
|
files = ["core_compiler.cpp", "core_compiler.h", "core_globals.cpp", "core_lexing.cpp"]
|
||||||
|
|
||||||
for file_to_modify in files:
|
for file_to_modify in files:
|
||||||
fd = open(file_to_modify, "r+")
|
fd = open(file_to_modify, "r+")
|
||||||
|
|||||||
Reference in New Issue
Block a user