View Source Rollex.Token protocol (Rollex v0.7.1)

Link to this section Summary

Functions

Create a token from the passed-in string representing a roll expression. Returns a token and the number of bytes consumed in doing so.

The left binding power (lbp), or the precedence in infix form for operator precedence. Higher lbp takes precedence over lower

Left denotation (led): take action when this token is encountered within an expression, e.g. infix and postfix operations

Null denotation (nud): the action take when this token is at the start of an expression, e.g. prefix operations

Link to this section Types

Link to this section Functions

Link to this function

create(token, roll_expr)

View Source

Specs

create(Rollex.token(), roll_expr :: String.t()) ::
  {Rollex.token(), num_bytes_consumed :: integer()}

Create a token from the passed-in string representing a roll expression. Returns a token and the number of bytes consumed in doing so.

Specs

lbp(Rollex.token()) :: integer()

The left binding power (lbp), or the precedence in infix form for operator precedence. Higher lbp takes precedence over lower

Specs

led(Rollex.token(), left :: Rollex.totals(), rest :: Rollex.tokens()) ::
  {:ok, Rollex.totals(), Rollex.tokens()} | {:error, reason :: String.t()}

Left denotation (led): take action when this token is encountered within an expression, e.g. infix and postfix operations

Specs

nud(Rollex.token(), rest :: Rollex.tokens()) ::
  {:ok, Rollex.totals(), Rollex.tokens()} | {:error, reason :: String.t()}

Null denotation (nud): the action take when this token is at the start of an expression, e.g. prefix operations