weechat-parser v0.1.0 Parser View Source

Link to this section Summary

Functions

Parses the given binary as event.

Parses the given binary as join.

Parses the given binary as leave.

Parses the given binary as me.

Parses the given binary as message.

Link to this section Functions

Link to this function

event(binary, opts \\ [])

View Source
event(binary(), keyword()) ::
  {:ok, [term()], rest, context, line, byte_offset}
  | {:error, reason, rest, context, line, byte_offset}
when line: {pos_integer(), byte_offset},
     byte_offset: pos_integer(),
     rest: binary(),
     reason: String.t(),
     context: map()

Parses the given binary as event.

Returns {:ok, [token], rest, context, position, byte_offset} or {:error, reason, rest, context, line, byte_offset} where position describes the location of the event (start position) as {line, column_on_line}.

Options

  • :line - the initial line, defaults to 1
  • :byte_offset - the initial byte offset, defaults to 0
  • :context - the initial context value. It will be converted to a map
Link to this function

join(binary, opts \\ [])

View Source
join(binary(), keyword()) ::
  {:ok, [term()], rest, context, line, byte_offset}
  | {:error, reason, rest, context, line, byte_offset}
when line: {pos_integer(), byte_offset},
     byte_offset: pos_integer(),
     rest: binary(),
     reason: String.t(),
     context: map()

Parses the given binary as join.

Returns {:ok, [token], rest, context, position, byte_offset} or {:error, reason, rest, context, line, byte_offset} where position describes the location of the join (start position) as {line, column_on_line}.

Options

  • :line - the initial line, defaults to 1
  • :byte_offset - the initial byte offset, defaults to 0
  • :context - the initial context value. It will be converted to a map
Link to this function

leave(binary, opts \\ [])

View Source
leave(binary(), keyword()) ::
  {:ok, [term()], rest, context, line, byte_offset}
  | {:error, reason, rest, context, line, byte_offset}
when line: {pos_integer(), byte_offset},
     byte_offset: pos_integer(),
     rest: binary(),
     reason: String.t(),
     context: map()

Parses the given binary as leave.

Returns {:ok, [token], rest, context, position, byte_offset} or {:error, reason, rest, context, line, byte_offset} where position describes the location of the leave (start position) as {line, column_on_line}.

Options

  • :line - the initial line, defaults to 1
  • :byte_offset - the initial byte offset, defaults to 0
  • :context - the initial context value. It will be converted to a map
Link to this function

me(binary, opts \\ [])

View Source
me(binary(), keyword()) ::
  {:ok, [term()], rest, context, line, byte_offset}
  | {:error, reason, rest, context, line, byte_offset}
when line: {pos_integer(), byte_offset},
     byte_offset: pos_integer(),
     rest: binary(),
     reason: String.t(),
     context: map()

Parses the given binary as me.

Returns {:ok, [token], rest, context, position, byte_offset} or {:error, reason, rest, context, line, byte_offset} where position describes the location of the me (start position) as {line, column_on_line}.

Options

  • :line - the initial line, defaults to 1
  • :byte_offset - the initial byte offset, defaults to 0
  • :context - the initial context value. It will be converted to a map
Link to this function

message(binary, opts \\ [])

View Source
message(binary(), keyword()) ::
  {:ok, [term()], rest, context, line, byte_offset}
  | {:error, reason, rest, context, line, byte_offset}
when line: {pos_integer(), byte_offset},
     byte_offset: pos_integer(),
     rest: binary(),
     reason: String.t(),
     context: map()

Parses the given binary as message.

Returns {:ok, [token], rest, context, position, byte_offset} or {:error, reason, rest, context, line, byte_offset} where position describes the location of the message (start position) as {line, column_on_line}.

Options

  • :line - the initial line, defaults to 1
  • :byte_offset - the initial byte offset, defaults to 0
  • :context - the initial context value. It will be converted to a map