Esperanto.Walker (esperanto v0.1.0)
Walker is used to go through input couting line and columns. Every parser is responsible to walk and leave the walker in the state he can continue
Link to this section Summary
Functions
Consume the current walk input
Start the walker by split it in input and rest
Walk through next input
Prevents walker from go fetch more content with the rest matches the barrier until the barrier is destroyed
Link to this section Types
Link to this section Functions
Link to this function
consume_input(walker, length \\ 0)
Specs
Consume the current walk input
Examples
iex> Esperanto.Walker.consume_input(Esperanto.Walker.start("abc"))
%Esperanto.Walker{input: "", rest: "bc", column: 1}
Link to this function
consume_input_matching_regex(walker, regex)
Link to this function
destroy_barrier(walker)
Specs
Link to this function
increment_line_and_column(input, line, column)
Link to this function
is_barried(walker)
Specs
Link to this function
start(input)
Specs
Start the walker by split it in input and rest
Examples
iex> Esperanto.Walker.start("abc")
%Esperanto.Walker{input: "a", rest: "bc"}
iex> Esperanto.Walker.start("")
%Esperanto.Walker{input: "", rest: ""}
iex> Esperanto.Walker.start("a")
%Esperanto.Walker{input: "a", rest: ""}
Link to this function
strip_from_regex(input, regex)
Link to this function
walk(walker)
Specs
Walk through next input
Examples
iex>
Esperanto.Walker.start("abc") |> Esperanto.Walker.walk()
%Esperanto.Walker{input: "ab", rest: "c", column: 2}
iex> Esperanto.Walker.start("a\nc") |> Esperanto.Walker.walk()
%Esperanto.Walker{input: "a\n", rest: "c", column: 1, line: 2}
Link to this function
walk_until(walker, regex)
Link to this function
with_barrier(walker, barrier)
Specs
Prevents walker from go fetch more content with the rest matches the barrier until the barrier is destroyed