Update tokenization rules

This commit is contained in:
PesBandi 2024-11-18 20:05:33 +01:00
parent 6b49ad15cf
commit 2f3b67b48b
2 changed files with 6 additions and 33 deletions

View File

@ -8,8 +8,8 @@ export function srtDefinition() {
block: [
[/^\d{2}:\d{2}:\d{2},\d{3} --> \d{2}:\d{2}:\d{2},\d{3}/, {
cases: {
'@eos': {token: 'tag', next: '@subtitle'},
'@default': {token: 'tag', next: '@ignore'}
'@eos': {token: 'type.identifier', next: '@subtitle'},
'@default': {token: 'type.identifier', next: '@ignore'}
}
}],
[/^$/, 'string', '@pop']
@ -19,35 +19,11 @@ export function srtDefinition() {
[/.+$/, '', '@subtitle']
],
tags: [
[/^$/, 'string', '@popall'],
[/<b>/, 'string.bold', '@bold'],
[/<i>/, 'string.emphasis', '@italic'],
[/<u>/, 'string.underline', '@underline']
],
subtitle: [
{include: '@tags'},
[/^$/, 'string', '@popall'],
[/<\/?(?:[ibu]|font(?:\s+color="[^"]+"\s*)?)>/, 'tag'],
[/./, 'string']
],
bold: [
[/<\/b>/, 'string.bold', '@pop'],
{include: '@tags'},
[/./, 'string.bold'],
],
italic: [
[/<\/i>/, 'string.emphasis', '@pop'],
{include: '@tags'},
[/./, 'string.emphasis'],
],
underline: [
[/<\/u>/, 'string.underline', '@pop'],
{include: '@tags'},
[/./, 'string.underline'],
],
]
}
};
}

View File

@ -1,6 +1,3 @@
export const customTokenThemeRules = [
{token: 'custom-negation.gitignore', foreground: 'c00ce0'},
{token: 'string.bold', fontStyle: 'bold'},
{token: 'string.emphasis', fontStyle: 'italic'},
{token: 'string.underline', fontStyle: 'underline'}
{token: 'custom-negation.gitignore', foreground: 'c00ce0'}
];