From: Brendan Hansen Date: Tue, 6 Jun 2023 02:59:18 +0000 (-0500) Subject: bugfix: vscode quote handling; added: type info methods X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=bab09b30290a3cb89013b2168a20c8b02f55cbb3;p=onyx.git bugfix: vscode quote handling; added: type info methods --- diff --git a/compiler/include/astnodes.h b/compiler/include/astnodes.h index e1453471..e26ef454 100644 --- a/compiler/include/astnodes.h +++ b/compiler/include/astnodes.h @@ -2102,6 +2102,7 @@ static inline b32 node_is_addressable_literal(AstNode* node) { static inline Type* get_expression_type(AstTyped* expr) { switch (expr->kind) { case Ast_Kind_Block: case Ast_Kind_If: case Ast_Kind_While: return NULL; + case Ast_Kind_Typeof: return &basic_types[Basic_Kind_Type_Index]; default: return expr->type; } } diff --git a/compiler/src/astnodes.c b/compiler/src/astnodes.c index b832ea85..12e83ff7 100644 --- a/compiler/src/astnodes.c +++ b/compiler/src/astnodes.c @@ -1700,8 +1700,6 @@ void arguments_clear_baked_flags(Arguments* args) { // GROSS: Using void* to avoid having to cast everything. const char* node_get_type_name(void* node) { - if (node_is_type((AstNode *) node)) return "type_expr"; - if (((AstNode *) node)->kind == Ast_Kind_Argument) { return node_get_type_name(((AstArgument *) node)->value); } diff --git a/compiler/src/types.c b/compiler/src/types.c index 1121b7a3..027483bb 100644 --- a/compiler/src/types.c +++ b/compiler/src/types.c @@ -36,7 +36,7 @@ Type basic_types[] = { { Type_Kind_Basic, 0, 0, (AstType *) &basic_type_f64x2, { Basic_Kind_F64X2, Basic_Flag_SIMD, 16, 16, "f64x2" } }, { Type_Kind_Basic, 0, 0, (AstType *) &basic_type_v128, { Basic_Kind_V128, Basic_Flag_SIMD, 16, 16, "v128" } }, - { Type_Kind_Basic, 0, 0, NULL, { Basic_Kind_Type_Index, Basic_Flag_Type_Index, 4, 4, "type_expr" } }, + { Type_Kind_Basic, 0, 0, (AstType *) &basic_type_type_expr, { Basic_Kind_Type_Index, Basic_Flag_Type_Index, 4, 4, "type_expr" } }, }; // TODO: Document this!! diff --git a/misc/vscode/onyx-0.1.7.vsix b/misc/vscode/onyx-0.1.7.vsix index 23c7ddf3..173a151e 100644 Binary files a/misc/vscode/onyx-0.1.7.vsix and b/misc/vscode/onyx-0.1.7.vsix differ diff --git a/misc/vscode/syntaxes/onyx.tmLanguage b/misc/vscode/syntaxes/onyx.tmLanguage index 42107e23..221f8dcb 100644 --- a/misc/vscode/syntaxes/onyx.tmLanguage +++ b/misc/vscode/syntaxes/onyx.tmLanguage @@ -496,7 +496,7 @@ match - \\(\\|[abefnrut"0]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|[0-7]{3}) + \\(\\|[abefnrut'"0]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|[0-7]{3}) name constant.character.escape.onyx @@ -544,6 +544,37 @@ + + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.onyx + + + end + ' + endCaptures + + 0 + + name + punctuation.definition.string.end.onyx + + + name + string.quoted.double.onyx + patterns + + + include + #string_escaped_char + + +