384
385
public insert(token: string, fontStyle: FontStyle, foreground: ColorId, background: ColorId): void {
387
>
// Merge into the main rule
388
>
this._mainRule.acceptOverwrite(fontStyle, foreground, background);
389
>
return;
390
>
}
391
>
392
>
const dotIndex = token.indexOf('.');
393
>
let head: string;
394
>
let tail: string;
395
>
if (dotIndex === -1) {
396
>
head = token;
397
>
tail = '';
398
>
} else {
399
head = token.substring(0, dotIndex);
400
tail = token.substring(dotIndex + 1);
401
}
403
>
let child = this._children.get(head);
404
>
if (typeof child === 'undefined') {
405
>
child = new ThemeTrieElement(this._mainRule.clone());
406
>
this._children.set(head, child);
407
>
}
408
>
409
>
child.insert(tail, fontStyle, foreground, background);
410
>
}
411
}
412