Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial API for Scanner. #12

Merged
merged 5 commits into from May 26, 2021
Merged

Initial API for Scanner. #12

merged 5 commits into from May 26, 2021

Commits on May 26, 2021

  1. Initial API for Scanner.

    Provides an interface for _lexing_ PartiQL.  Traditionally we would
    factor this as the low-level interface for the parser, but with the PEG
    based implementation, we just surface the relevant parts of the parser
    as a rule to parse with.
    
    This commit helps explore how to effectively integrate with the somewhat
    low-level APIs for parsing that Pest provides.
    
    * Adds `scanner` module.
    * Adds `Scanner` trait to the prelude.
    * Makes `PartiQLParser` public to crate.
    * Refactors `LineAndColumn` as a tuple for `Position::At`.
      - Adds this to the `prelude`.
    * Changes entry point for PEG to `Query` and added `Scanner` as the
      entry point rules for implementing the `Scanner` API.
    * Adds `PairsExt`/`PairExt` trait/impl to add utility methods for working
      with Pest `Pairs`/`Pair`.
    * Adds `LineAndColumn::position_from` and cleans up some doc/doc tests.
    
    Resolves partiql#13.
    almann committed May 26, 2021
    Configuration menu
    Copy the full SHA
    059d893 View commit details
    Browse the repository at this point in the history
  2. Apply suggestions from @zslayton.

    Co-authored-by: Zack Slayton <zack.slayton@gmail.com>
    almann and zslayton committed May 26, 2021
    Configuration menu
    Copy the full SHA
    1fe92bd View commit details
    Browse the repository at this point in the history
  3. Feedback as per @zslayton

    * Renames `start_loc`/`end_loc` to just `start`/`end`.
    * Renames `start_location`\`end_location` similarly.
    * Adds doc comments about how `position_from` works.
    almann committed May 26, 2021
    Configuration menu
    Copy the full SHA
    8716ff2 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f6ef87e View commit details
    Browse the repository at this point in the history
  5. Changes construction of LineAndColumn to return ParserResult.

    The rationale is that even though there are some aspects of this that
    we could assert as internal logic problems, we rely on external APIs
    to construct this location and we should not panic as a result of those.
    
    Refactors relevant APIs/tests to use this new return result.
    
    Adds `TryFrom` and `TryInto` into the prelude.
    
    This also cleans up field access for the `LineAndColumn` struct.
    almann committed May 26, 2021
    Configuration menu
    Copy the full SHA
    ba4398c View commit details
    Browse the repository at this point in the history