View Source Finitomata.Parser behaviour (Finitomata v0.25.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

@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

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

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

@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.

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

Validation of the input.