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
|
end
|
||||||
# If no rule matches, emit an error token
|
# If no rule matches, emit an error token
|
||||||
unless matched
|
unless matched
|
||||||
# Log.trace { "Error at #{pos}" }
|
if text[pos] == "\n"
|
||||||
tokens << {type: "Error", value: "#{text[pos]}"}
|
# 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
|
pos += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user