Flatbuf.Schema.Lexer (flatbuf v0.1.0)

Copy Markdown View Source

Lexer for FlatBuffers schema (.fbs) source.

Produces a flat list of tokens preserving line numbers for error reporting. Doc comments (/// ...) are emitted as :doc tokens so the parser can attach them to the following declaration; ordinary comments are discarded.

Summary

Types

token()

@type token() ::
  {:kw, atom(), pos_integer()}
  | {:ident, String.t(), pos_integer()}
  | {:int, integer(), pos_integer()}
  | {:float, float(), pos_integer()}
  | {:string, String.t(), pos_integer()}
  | {:doc, String.t(), pos_integer()}
  | {:punct, atom(), pos_integer()}
  | {:eof, nil, pos_integer()}

Functions

tokenize(source)

@spec tokenize(binary()) :: {:ok, [token()]} | {:error, term()}