diff --git a/aegisub/libaegisub/common/parser.cpp b/aegisub/libaegisub/common/parser.cpp index 62114749c..6bb47df0c 100644 --- a/aegisub/libaegisub/common/parser.cpp +++ b/aegisub/libaegisub/common/parser.cpp @@ -167,7 +167,7 @@ struct dialogue_tokens : lex::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')); } diff --git a/aegisub/tests/Makefile b/aegisub/tests/Makefile index a51279853..b2b6359f0 100644 --- a/aegisub/tests/Makefile +++ b/aegisub/tests/Makefile @@ -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 \ diff --git a/aegisub/tests/libaegisub_syntax_highlight.cpp b/aegisub/tests/libaegisub_syntax_highlight.cpp index 3a645e495..e9884ac98 100644 --- a/aegisub/tests/libaegisub_syntax_highlight.cpp +++ b/aegisub/tests/libaegisub_syntax_highlight.cpp @@ -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); + ); +}