hocon v0.1.8 Hocon.Tokens View Source
This module is responsible for pushing tokens to the list of tokens. It handles the cases of whitespaces and new lines.
Whitespaces are important in cases of unquoted strings und new lines are important for merging objects and arrays.
- whitespace are almost ignored
- only allowed in context of unquoted strings and simple values see
- new lines are used to see
See also the tokens_test.exs for more information.
Link to this section Summary
Link to this section Functions
Create a new Tokens struct.
Example
iex(1)> Hocon.Tokens.new()
%Hocon.Tokens{acc: [], ws: false}
Push a token to the Tokens struct.
Example
tokens = Tokens.new()
seq = tokens
|> Tokens.push(1)
|> Tokens.push(:ws)
|> Tokens.push({:unquoted_string, "2"})
|> Tokens.push(:ws)
|> Tokens.push(3)
|> Tokens.push(:ws)
|> Tokens.push({:unquoted_string, "4"})
assert [{:unquoted_string, "4"}, :ws, 3, :ws, {:unquoted_string, "2"}, :ws, 1] == seq.acc