# `Tempo.Iso8601.Tokenizer`
[🔗](https://github.com/kipcole9/tempo/blob/v0.20.0/lib/iso8601/tokenizer.ex#L1)

Tokenizes an ISO 8601 (parts 1 and 2) or IXDTF string into a
list of tagged tokens that the internal parser then converts
into a `t:Tempo.t/0` struct.

`tokenize/1` returns a 2-tuple `{tokens, extended_info}` where
`extended_info` is either `nil` or a map of parsed
[IXDTF](https://www.ietf.org/archive/id/draft-ietf-sedate-datetime-extended-09.html)
suffix information.  See `Tempo.Iso8601.Tokenizer.Extended` for
the shape of the extended map.

# `datetime_or_date_or_time__0`

# `datetime_or_date_or_time__1`

# `datetime_or_date_or_time__2`

# `datetime_or_date_or_time__3`

# `datetime_or_date_or_time__4`

# `datetime_or_date_or_time__5`

# `datetime_or_date_or_time__6`

# `datetime_or_date_or_time__7`

# `datetime_or_date_or_time__8`

# `datetime_or_date_or_time__9`

# `iso8601`

```elixir
@spec iso8601(binary(), keyword()) ::
  {:ok, [term()], rest, context, line, byte_offset}
  | {:error, reason, rest, context, line, byte_offset}
when line: {pos_integer(), byte_offset},
     byte_offset: non_neg_integer(),
     rest: binary(),
     reason: String.t(),
     context: map()
```

Parses the given `binary` as iso8601.

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

To column where the error occurred can be inferred from `byte_offset - offset_to_start_of_line`.

## Options

  * `:byte_offset` - the byte offset for the whole binary, defaults to 0
  * `:line` - the line and the byte offset into that line, defaults to `{1, byte_offset}`
  * `:context` - the initial context value. It will be converted to a map

# `set__0`

# `set__1`

# `set__2`

# `set__3`

# `set__4`

# `set__5`

# `set__6`

# `set__7`

# `set__8`

# `set__9`

# `set__10`

# `set__11`

# `set__12`

# `tokenize`

Tokenize an ISO 8601 or IXDTF string.

### Arguments

* `string` is any ISO 8601 formatted string, optionally with an
  [IXDTF](https://www.ietf.org/archive/id/draft-ietf-sedate-datetime-extended-09.html)
  suffix (such as `[Europe/Paris][u-ca=hebrew]`).

### Returns

* `{:ok, {tokens, extended_info}}` where `tokens` is the list of
  ISO 8601 tokens produced by the parser and `extended_info` is
  either `nil` (when no IXDTF suffix was present) or a map with
  keys `:calendar`, `:zone_id`, `:zone_offset` and `:tags`.

* `{:error, reason}` when the string cannot be parsed or a
  critical IXDTF suffix is unrecognised.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
