mfm-parser/lib/reader.ex
Ilja 45519a3c2a Make parser work for single token input
We can handle all needed tokens.
We still need to test for multiple tokens and for nesting.
2022-07-24 07:55:55 +02:00

20 lines
326 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 next(input) do
{next_char, rest} = String.split_at(input, 1)
case next_char do
"" -> :eof
_ -> {next_char, rest}
end
end
end