mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 05:22:23 +00:00
reset stack on EOL instead of error, makes no difference, but it's in pygments version
This commit is contained in:
parent
56e49328fb
commit
c898f395a1
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user