reset stack on EOL instead of error, makes no difference, but it's in pygments version

This commit is contained in:
Roberto Alsina 2024-08-13 22:06:07 -03:00
parent 56e49328fb
commit c898f395a1

View File

@ -94,8 +94,13 @@ module Tartrazine
end
# If no rule matches, emit an error token
unless matched
# Log.trace { "Error at #{pos}" }
tokens << {type: "Error", value: "#{text[pos]}"}
if text[pos] == "\n"
# at EOL, reset state to "root"
tokens << {type: "TextWhitespace", value: "\n"}
@state_stack = ["root"]
else
tokens << {type: "Error", value: text[pos..pos]}
end
pos += 1
end
end