Fix syntax highlighting for multiple karaoke templater expression blocks

This commit is contained in:
Thomas Goyne 2012-12-07 17:52:54 -08:00
parent 28705000bb
commit cccd95941d
3 changed files with 11 additions and 2 deletions

View File

@ -167,7 +167,7 @@ struct dialogue_tokens : lex::lexer<Lexer> {
using namespace agi::ass::DialogueTokenType;
if (karaoke_templater)
init(string("!.*!", KARAOKE_TEMPLATE) | string("\\$[A-Za-z_]+", KARAOKE_VARIABLE));
init(string("![^!]*!", KARAOKE_TEMPLATE) | string("\\$[A-Za-z_]+", KARAOKE_VARIABLE));
else
init(lex::char_('\1'));
}

View File

@ -26,9 +26,10 @@ SRC = \
libaegisub_keyframe.cpp \
libaegisub_line_iterator.cpp \
libaegisub_line_wrap.cpp \
libaegisub_option.cpp \
libaegisub_mru.cpp \
libaegisub_option.cpp \
libaegisub_signals.cpp \
libaegisub_syntax_highlight.cpp \
libaegisub_thesaurus.cpp \
libaegisub_util.cpp \
libaegisub_vfr.cpp \

View File

@ -251,3 +251,11 @@ TEST(lagi_syntax, templater_expression) {
expect_style(ss::NORMAL, 1u);
);
}
TEST(lagi_syntax, multiple_templater_expressions) {
tok_str("!1!2!3!", true,
expect_style(ss::KARAOKE_TEMPLATE, 3u);
expect_style(ss::NORMAL, 1u);
expect_style(ss::KARAOKE_TEMPLATE, 3u);
);
}