0a2894f07a
When a text token was running, it wouldn't stop on a $-sign if it wasn't followed with a "[". This is good. But when a token was finished and the next char was a $-sign, it would consider it an MFMOpen, even when not followed by a "[". This is now fixed.
28 lines
474 B
Elixir
28 lines
474 B
Elixir
defmodule MfmParser.Reader do
|
|
def peek(input) do
|
|
next_char = input |> String.first()
|
|
|
|
case next_char do
|
|
nil -> :eof
|
|
_ -> next_char
|
|
end
|
|
end
|
|
|
|
def peek(input, steps) do
|
|
nth_char = input |> String.at(steps - 1)
|
|
|
|
case nth_char do
|
|
nil -> :eof
|
|
_ -> nth_char
|
|
end
|
|
end
|
|
|
|
def next(input) do
|
|
{next_char, rest} = String.split_at(input, 1)
|
|
|
|
case next_char do
|
|
"" -> :eof
|
|
_ -> {next_char, rest}
|
|
end
|
|
end
|
|
end
|