dreaeql v0.2.0 DreaeQL
A library for parsing a simple query language into an abstract syntax tree.
Link to this section Summary
Functions
Parses a string into a DreaeQL AST. Returns a tuple containing the AST and any unused tokens, if any.
Link to this section Types
Link to this type
ast()
Specs
ast() :: term()
Link to this section Functions
Link to this function
parse(string)
Specs
Parses a string into a DreaeQL AST. Returns a tuple containing the AST and any unused tokens, if any.
Examples
iex> DreaeQL.parse("foo = 123 and bar = \"456\"")
{%DreaeQL.Operators.And{
left_side: %DreaeQL.Operators.Equals{
left_side: %DreaeQL.Terms.Identifier{ident: "foo", term: :ident},
operator: :binary,
right_side: %DreaeQL.Terms.LiteralInt{term: :int, value: 123}
},
operator: :binary,
right_side: %DreaeQL.Operators.Equals{
left_side: %DreaeQL.Terms.Identifier{ident: "bar", term: :ident},
operator: :binary,
right_side: %DreaeQL.Terms.LiteralString{term: :string, value: "456"}
}
}, []}