predicator v0.6.1 Predicator
Documentation for Predicator.
Lexer and Parser currently only compatible with 0.4.0 predicate syntax
Link to this section Summary
Functions
eval/3 takes a predicate set, a context struct and options
Currently only compatible with 0.4.0 predicate syntax leex_and_parse/1 takes a string or charlist and does all lexing and parsing then returns the predicate
Currently only compatible with 0.4.0 predicate syntax leex_string/1 takes string or charlist and returns a lexed tuple for parsing
Currently only compatible with 0.4.0 predicate syntax parse_lexed/1 takes a lexed tuple or just the token from the tuple and returns a predicate
Link to this section Functions
eval/3 takes a predicate set, a context struct and options
leex_and_parse(String.t()) :: list() | {:error, any(), non_neg_integer()}
Currently only compatible with 0.4.0 predicate syntax leex_and_parse/1 takes a string or charlist and does all lexing and parsing then returns the predicate.
iex> leex_and_parse(“13 > 12”) [[:lit, 13], [:lit, 12], [:comparator, :GT]]
iex> leex_and_parse(‘532 == 532’) [[:lit, 532], [:lit, 532], [:comparator, :EQ]]
leex_string(String.t()) :: {:ok | :error, list() | tuple(), non_neg_integer()}
Currently only compatible with 0.4.0 predicate syntax leex_string/1 takes string or charlist and returns a lexed tuple for parsing.
iex> leex_string(‘10 > 5’) {:ok, [{:lit, 1, 10}, {:comparator, 1, :GT}, {:lit, 1, 5}], 1}
iex> leex_string(“apple > 5532”) {:ok, [{:load, 1, :apple}, {:comparator, 1, :GT}, {:lit, 1, 5532}], 1}
Currently only compatible with 0.4.0 predicate syntax parse_lexed/1 takes a lexed tuple or just the token from the tuple and returns a predicate.
iex> parse_lexed({:ok, [{:load, 1, :apple}, {:comparator, 1, :GT}, {:lit, 1, 5532}], 1})
iex> parse_lexed([{:load, 1, :apple}, {:comparator, 1, :GT}, {:lit, 1, 5532}])