View Source Finitomata.Parser behaviour (Finitomata v0.29.0)

The behaviour, defining the parser to produce FSM out of textual representation.

Summary

Types

The type representing the parsing error which might be passed through to raised CompileError.

Callbacks

Linter of the input, producing a well-formed representation of FSM understood by JS/markdown parsers.

Parse function, producing the FSM definition as a list of Transition instances.

Validation of the input.

Types

parse_error()

@type parse_error() ::
  {:error, String.t(), binary(), map(), {pos_integer(), pos_integer()},
   pos_integer()}

The type representing the parsing error which might be passed through to raised CompileError.

Callbacks

lint(binary)

@callback lint(binary()) :: binary()

Linter of the input, producing a well-formed representation of FSM understood by JS/markdown parsers.

parse(binary)

@callback parse(binary()) ::
  {:ok, [Finitomata.Transition.t()]}
  | {:error, Finitomata.validation_error()}
  | parse_error()

Parse function, producing the FSM definition as a list of Transition instances.

validate(list)

@callback validate([{:transition, [binary()]}]) ::
  {:ok, [Finitomata.Transition.t()]} | {:error, Finitomata.validation_error()}

Validation of the input.