Make usingself MUCH cheaper, since it was called many times when parsing C

This commit is contained in:
2024-08-15 19:20:12 -03:00
parent f72a40f095
commit 58e8dac038
2 changed files with 10 additions and 5 deletions

View File

@ -109,7 +109,7 @@ module Tartrazine
when "usingself"
# Shunt to another copy of this lexer
return [] of Token if match.empty?
new_lexer = Lexer.from_xml(lexer.xml)
new_lexer = lexer.copy
new_lexer.tokenize(String.new(match[match_group].value), usingself: true)
when "combined"
# Combine two states into one anonymous state