mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 05:22:23 +00:00
Minor cleanup
This commit is contained in:
parent
9041b763ea
commit
1f01146b1f
@ -4,7 +4,6 @@ require "./constants/lexers"
|
|||||||
module Tartrazine
|
module Tartrazine
|
||||||
class LexerFiles
|
class LexerFiles
|
||||||
extend BakedFileSystem
|
extend BakedFileSystem
|
||||||
|
|
||||||
bake_folder "../lexers", __DIR__
|
bake_folder "../lexers", __DIR__
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ module Tartrazine
|
|||||||
new_lexer = Lexer.new
|
new_lexer = Lexer.new
|
||||||
new_lexer.config = config
|
new_lexer.config = config
|
||||||
new_lexer.states = states
|
new_lexer.states = states
|
||||||
new_lexer.state_stack = state_stack[0..-1]
|
new_lexer.state_stack = ["root"]
|
||||||
new_lexer
|
new_lexer
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -87,9 +86,10 @@ module Tartrazine
|
|||||||
states[@state_stack.last].rules.each do |rule|
|
states[@state_stack.last].rules.each do |rule|
|
||||||
matched, new_pos, new_tokens = rule.match(text_bytes, pos, self)
|
matched, new_pos, new_tokens = rule.match(text_bytes, pos, self)
|
||||||
if matched
|
if matched
|
||||||
# Move position forward, save the tokens,
|
# Move position forward, save the tokens
|
||||||
pos = new_pos
|
pos = new_pos
|
||||||
tokens += new_tokens
|
tokens += new_tokens
|
||||||
|
# Start matching rules at new position
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user