Add required array element constraints
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user