Add required array element constraints

This commit is contained in:
2026-08-11 17:24:04 +09:00
parent 5a05da6fe4
commit 46b2b3b1b6
35 changed files with 6328 additions and 5042 deletions
+3 -1
View File
@@ -41,7 +41,7 @@ export function highlightDecodalTokens(source, tokens) {
function tokenClass(kind, text) {
if (['let', 'in', 'fn', 'match', 'import', 'default'].includes(kind)) return 'tok-keyword';
if (kind === 'ident' && ['String', 'Int', 'Float', 'Bool', 'Array'].includes(text)) return 'tok-type';
if (kind === 'ident' && ['String', 'Int', 'Float', 'Bool'].includes(text)) return 'tok-type';
if (kind === 'ident') return '';
if (['true', 'false'].includes(kind)) return 'tok-literal';
if (['int', 'float'].includes(kind)) return 'tok-number';
@@ -60,6 +60,7 @@ function tokenClass(kind, text) {
'pipe_pipe',
'plus',
'plus_plus',
'ellipsis',
'minus',
'star',
'slash',
@@ -255,6 +256,7 @@ function isOperatorStart(char) {
function readOperator(source, start) {
let index = start + 1;
if (source.startsWith('...', start)) return start + 3;
if ('&|/+'.includes(source[start]) && source[index] === source[start]) return index + 1;
if ((source[start] === '<' || source[start] === '>' || source[start] === '=' || source[start] === '!') && source[index] === '=') {
index += 1;