unsigned integer constraint (uint)

This commit is contained in:
2026-07-18 00:12:59 +02:00
parent b09787029d
commit ef91f13e7b
15 changed files with 4618 additions and 2849 deletions
+1 -1
View File
@@ -228,7 +228,7 @@ module.exports = grammar({
_type_constant: $ => seq(optional('-'), choice($.integer, $.character)),
builtin_type: _ => choice(
'void', 'anyopaque', 'bool', 'int', 'float', 'range',
'void', 'anyopaque', 'bool', 'int', 'uint', 'float', 'range',
'i8', 'i16', 'i32', 'i64', 'u8', 'u16', 'u32', 'u64',
'isize', 'usize', 'f32', 'f64',
'c_char', 'c_schar', 'c_uchar', 'c_short', 'c_ushort',
+4
View File
@@ -1476,6 +1476,10 @@
"type": "STRING",
"value": "int"
},
{
"type": "STRING",
"value": "uint"
},
{
"type": "STRING",
"value": "float"
+4
View File
@@ -2815,6 +2815,10 @@
"type": "u8",
"named": false
},
{
"type": "uint",
"named": false
},
{
"type": "undefined",
"named": true
File diff suppressed because it is too large Load Diff
@@ -493,3 +493,19 @@ visit func(kind Kind, value Value) void {
(sink))
(expression
(identifier))))))))))))
==================
Unsigned constraint
==================
value uint :: 255
---
(source_file
(global_constant_declaration
(identifier)
(type
(builtin_type))
(expression
(integer))))
@@ -1,6 +1,9 @@
hide helper func() void {}
# <- keyword
value uint :: 1
# ^^^^ type.builtin
main func() void {
_ = sizeof!(i32)
# ^^^^^^ function.builtin