3 Commits

Author SHA1 Message Date
6f64b76c44 lint 2024-08-13 22:07:23 -03:00
5218af6855 lint 2024-08-13 22:06:19 -03:00
c898f395a1 reset stack on EOL instead of error, makes no difference, but it's in pygments version 2024-08-13 22:06:07 -03:00
3 changed files with 8 additions and 4 deletions

View File

@@ -42,7 +42,6 @@ known_bad = {
"#{__DIR__}/tests/mcfunction/selectors.txt",
"#{__DIR__}/tests/php/anonymous_class.txt",
"#{__DIR__}/tests/html/javascript_unclosed.txt",
}
# Tests that fail because of a limitation in PCRE2

View File

@@ -30,7 +30,7 @@ module Tartrazine
@standalone : Bool = false,
@surrounding_pre : Bool = true,
@wrap_long_lines : Bool = false,
@weight_of_bold : Int32 = 600,)
@weight_of_bold : Int32 = 600)
end
def format(text : String, lexer : Lexer) : String

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