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

Reworked command parser #28

Merged
merged 1 commit into from
Oct 20, 2016
Merged

Reworked command parser #28

merged 1 commit into from
Oct 20, 2016

Commits on Oct 20, 2016

  1. Reworked command parser

    Summary:
    
    - Previously monolithic parsing logic split into a suite of composable
      parsers
    - Relaxed grammar more closely follows typical command shell parsing
      behavior
    - Introduces string interpolation support
    
    Details:
    
    This commit adds a new command parser which features a more relaxed
    parsing grammar and support for string interpolation. This is achieved
    by breaking out the lexing and parsing logic for major data types --
    pipelines, names, args/options, variables, and interpolated strings --
    into separate lexer/parser pairs which are combined to create the final
    command parsing pipeline.
    
    In the vast majority of cases the new parser produces identical AST
    when compared against the existing parser. Aside from the new features
    the only difference between the old and new parsers is their handling of
    quoted strings. The old parser parsed them correctly but dropped the
    strings when converting the AST to a string whereas the new parser
    preserves quoting.
    
    `Piper.Command.Parser` and `Piper.Command.ParserOptions` have been
    changed to make the old and new parsers swappable. Setting the
    `use_legacy_parser` field on `ParserOptions` to `true` will cause Piper
    to parse command input with the old parser.
    
    The command parser's test suite has been changed to cover new features
    and ensure the legacy parser continues to work. First, the test modules
    for variable binding, alias expansion, command lexing, and command
    parsing were split into two "forks". The legacy fork captures these test
    modules in their current state and runs them against the legacy
    parser. These modules are prefixed with `Legacy`. The new fork, which
    consists of the same test modules but retaining their non-legacy names,
    have been extended to exercise the new parser.
    Kevin Smith committed Oct 20, 2016
    Configuration menu
    Copy the full SHA
    23b0507 View commit details
    Browse the repository at this point in the history