fix: Don't compare the consumed string's length for every iteration.
Closes #3.
This commit is contained in:
parent
5075c958c8
commit
1178ee3ee6
|
@ -60,12 +60,9 @@ defmodule LexLuthor.Runner do
|
||||||
line: line,
|
line: line,
|
||||||
column: column})
|
column: column})
|
||||||
|
|
||||||
# Are we at the end of the string?
|
case String.split_at(string, len) do
|
||||||
if String.length(string) == len do
|
{_, ""} -> {:ok, Enum.reverse(lexer.tokens)}
|
||||||
{ :ok, Enum.reverse lexer.tokens }
|
{_, new_string} -> do_lex(module, rules, new_string, lexer)
|
||||||
else
|
|
||||||
{ _ , new_string } = String.split_at string, len
|
|
||||||
do_lex module, rules, new_string, lexer
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue