mentat/query-parser
Nick Alexander d1ac752de6 Parse without copying; parse keyword maps using macros.
This is a big commit, but it breaks into two conceptual pieces.  The
first is to "parse without copying".  We replace a stream of an owned
collection of edn::ValueAndSpan and instead have a stream of a
borrowed collection of &edn::ValueAndSpan references.  (Generally,
this is represented as an iterator over a slice, but it can be over
other things too.)  Cloning such iterators is constant time, which
improves on cloning an owned collection of edn::ValueAndSpan, which is
linear time in the length of the collection and additional time
depending on the complexity of the EDN values.

The second conceptual piece is to parse keyword maps using a special
parser and a macro to build the parser implementations.  Before, we
created a new edn::ValueAndSpan::Map to represent a keyword map in
vector form; since we're working with &edn::ValueAndSpan references
now, we can't create an &edn::ValueAndSpan reference with an
appropriate lifetime.  Therefore we generalize the concept of
iteration slightly and turn keyword maps in map form into linear
iterators by flattening the value maps.  This is a potentially
obscuring transformation, so we have to take care to protect against
some failure cases.  (See the comments and the tests in the code.)

After these changes, parsing using `combine` is linear time (and
reasonably fast).
2017-05-18 10:17:13 -07:00
..
src Parse without copying; parse keyword maps using macros. 2017-05-18 10:17:13 -07:00
tests UUIDs and instants. Fixes #44, #45, #426, #427. (#438) r=nalexander 2017-04-28 20:11:55 -07:00
Cargo.toml Parse without copying; parse keyword maps using macros. 2017-05-18 10:17:13 -07:00
README.md Implement parsing of simple :find expressions. (#196) r=nalexander 2017-01-25 14:06:19 -08:00

See https://github.com/mozilla/mentat/wiki/Querying for a description of what's going on in this crate, as well as query and query-executor.