Skip to content
Extraits de code Groupes Projets
Valider 92b8b285 rédigé par Thomas Goyne's avatar Thomas Goyne
Parcourir les fichiers

Don't build the dialogue lexer on every use

Building the lexer takes much longer than actually lexing, and since the
lexer is stateless there's no reason not to just make it static.
parent 706a72d5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -206,7 +206,9 @@ namespace parser {
namespace ass {
std::vector<DialogueToken> TokenizeDialogueBody(std::string const& str, bool karaoke_templater) {
dialogue_tokens<lex::lexertl::actor_lexer<>> tokenizer(karaoke_templater);
static const dialogue_tokens<lex::lexertl::actor_lexer<>> kt(true);
static const dialogue_tokens<lex::lexertl::actor_lexer<>> not_kt(false);
auto const& tokenizer = karaoke_templater ? kt : not_kt;
char const *first = str.c_str();
char const *last = first + str.size();
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter