mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-09-18 03:08:13 +00:00
Compare commits
1 Commits
6f64b76c44
...
v0.3.0
Author | SHA1 | Date | |
---|---|---|---|
8d7faf2098 |
@@ -1,5 +1,5 @@
|
|||||||
name: tartrazine
|
name: tartrazine
|
||||||
version: 0.2.0
|
version: 0.3.0
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
- Roberto Alsina <roberto.alsina@gmail.com>
|
- Roberto Alsina <roberto.alsina@gmail.com>
|
||||||
|
@@ -42,6 +42,7 @@ known_bad = {
|
|||||||
"#{__DIR__}/tests/mcfunction/selectors.txt",
|
"#{__DIR__}/tests/mcfunction/selectors.txt",
|
||||||
"#{__DIR__}/tests/php/anonymous_class.txt",
|
"#{__DIR__}/tests/php/anonymous_class.txt",
|
||||||
"#{__DIR__}/tests/html/javascript_unclosed.txt",
|
"#{__DIR__}/tests/html/javascript_unclosed.txt",
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Tests that fail because of a limitation in PCRE2
|
# Tests that fail because of a limitation in PCRE2
|
||||||
|
@@ -30,7 +30,7 @@ module Tartrazine
|
|||||||
@standalone : Bool = false,
|
@standalone : Bool = false,
|
||||||
@surrounding_pre : Bool = true,
|
@surrounding_pre : Bool = true,
|
||||||
@wrap_long_lines : Bool = false,
|
@wrap_long_lines : Bool = false,
|
||||||
@weight_of_bold : Int32 = 600)
|
@weight_of_bold : Int32 = 600,)
|
||||||
end
|
end
|
||||||
|
|
||||||
def format(text : String, lexer : Lexer) : String
|
def format(text : String, lexer : Lexer) : String
|
||||||
|
@@ -94,13 +94,8 @@ module Tartrazine
|
|||||||
end
|
end
|
||||||
# If no rule matches, emit an error token
|
# If no rule matches, emit an error token
|
||||||
unless matched
|
unless matched
|
||||||
if text[pos] == "\n"
|
# Log.trace { "Error at #{pos}" }
|
||||||
# at EOL, reset state to "root"
|
tokens << {type: "Error", value: "#{text[pos]}"}
|
||||||
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
|
||||||
|
@@ -19,7 +19,7 @@ module Tartrazine
|
|||||||
match = pattern.match(text, pos)
|
match = pattern.match(text, pos)
|
||||||
# We don't match if the match doesn't move the cursor
|
# We don't match if the match doesn't move the cursor
|
||||||
# because that causes infinite loops
|
# because that causes infinite loops
|
||||||
return false, pos, [] of Token if match.nil? || match.size == 0
|
return false, pos, [] of Token if match.nil? || match.end == 0
|
||||||
# Log.trace { "#{match}, #{pattern.inspect}, #{text}, #{pos}" }
|
# Log.trace { "#{match}, #{pattern.inspect}, #{text}, #{pos}" }
|
||||||
tokens = [] of Token
|
tokens = [] of Token
|
||||||
# Emit the tokens
|
# Emit the tokens
|
||||||
|
@@ -11,7 +11,7 @@ require "xml"
|
|||||||
|
|
||||||
module Tartrazine
|
module Tartrazine
|
||||||
extend self
|
extend self
|
||||||
VERSION = "0.2.0"
|
VERSION = {{ `shards version #{__DIR__}`.chomp.stringify }}
|
||||||
|
|
||||||
Log = ::Log.for("tartrazine")
|
Log = ::Log.for("tartrazine")
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user