ex_hl7 v0.3.0 HL7.Lexer

Lexer used by the HL7 parser to retrieve tokens from a buffer.

Summary

Functions

Checks that the characters in the string are only alphanumeric ASCII characters

Create a new Lexer instance

Checks that the characters in the string are printable ASCII and ISO-8859-1 (Latin 1) characters

Reads a token from a buffer containing an HL7 message

Put back a token into the lexer so that it is the first one to be returned in the next call to Lexer.read/2

Checks that the string is a valid segment ID

Types

option :: {:input_format, :text | :wire}
state ::
  :read_segment_id |
  :read_delimiters |
  :read_separator |
  :read_characters
t :: %HL7.Lexer{escape_char: byte, next_tokens: [token], separators: binary, state: state, terminator: byte}
token ::
  {:separator, HL7.Type.item_type | :segment} |
  {:literal, binary} |
  {:value, binary}

Functions

alphanumeric?(str)

Specs

alphanumeric?(binary) :: boolean

Checks that the characters in the string are only alphanumeric ASCII characters.

new(options \\ [])

Specs

new([option]) :: t

Create a new Lexer instance

printable?(arg)

Specs

printable?(binary) :: boolean

Checks that the characters in the string are printable ASCII and ISO-8859-1 (Latin 1) characters.

read(lexer, buffer)

Specs

read(t, binary) ::
  {:token, {t, token, binary}} |
  {:incomplete, {t, binary}} |
  {:error, any}

Reads a token from a buffer containing an HL7 message

read_characters(lexer, buffer)
read_delimiters(lexer, buffer)
read_segment_id(lexer, buffer)
read_separator(lexer, buffer)
unread(lexer, token)

Specs

unread(t, token) :: t

Put back a token into the lexer so that it is the first one to be returned in the next call to Lexer.read/2

valid_segment_id?(str)

Specs

valid_segment_id?(binary) :: boolean

Checks that the string is a valid segment ID.