1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

[Tolk] Allow cell and slice be valid identifiers

They are not keywords anymore.
> var cell = ...;
> var cell: cell = ...;
Motivation: in the future, when structures are implemented, this obviously should be valid:
> struct a { ... }
> var a = ...;
Struct fields will also be allowed to have names int/slice/cell.
This commit is contained in:
tolk-vm 2025-01-27 10:33:24 +03:00
parent 7a1602f591
commit 5b44e01455
No known key found for this signature in database
GPG key ID: 7905DD7FE0324B12
9 changed files with 47 additions and 69 deletions

View file

@ -331,7 +331,6 @@ struct ChunkIdentifierOrKeyword final : ChunkLexerBase {
if (str == "as") return tok_as;
break;
case 3:
if (str == "int") return tok_int;
if (str == "var") return tok_var;
if (str == "fun") return tok_fun;
if (str == "asm") return tok_asm;
@ -342,18 +341,13 @@ struct ChunkIdentifierOrKeyword final : ChunkLexerBase {
case 4:
if (str == "else") return tok_else;
if (str == "true") return tok_true;
if (str == "cell") return tok_cell;
if (str == "null") return tok_null;
if (str == "void") return tok_void;
if (str == "bool") return tok_bool;
if (str == "self") return tok_self;
if (str == "tolk") return tok_tolk;
if (str == "type") return tok_type;
if (str == "enum") return tok_enum;
break;
case 5:
if (str == "slice") return tok_slice;
if (str == "tuple") return tok_tuple;
if (str == "const") return tok_const;
if (str == "false") return tok_false;
if (str == "redef") return tok_redef;
@ -374,16 +368,12 @@ struct ChunkIdentifierOrKeyword final : ChunkLexerBase {
if (str == "export") return tok_export;
break;
case 7:
if (str == "builder") return tok_builder;
if (str == "builtin") return tok_builtin;
break;
case 8:
if (str == "continue") return tok_continue;
if (str == "operator") return tok_operator;
break;
case 12:
if (str == "continuation") return tok_continuation;
break;
default:
break;
}