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

Restructured how commands like list, help, quit are parsed to implement save #555

Merged
merged 32 commits into from
Sep 24, 2024

Commits on Sep 7, 2024

  1. Added .DS_Store to gitignore

    rben01 committed Sep 7, 2024
    Configuration menu
    Copy the full SHA
    47fd928 View commit details
    Browse the repository at this point in the history
  2. Implemented commands like list, help, save (new) with more flex…

    …ible parsing (eg tolerant of arbitrary whitespace)
    
    Commands report `ParseError`s if the syntax is invalid (eg too many or not enough args)
    This required making `Resolver::add_code_source` public and adding `Context::resolver_mut` to track source code positions of commands
    rben01 committed Sep 7, 2024
    Configuration menu
    Copy the full SHA
    34d43a3 View commit details
    Browse the repository at this point in the history
  3. Added Info command

    Added some helper functions for commands
    rben01 committed Sep 7, 2024
    Configuration menu
    Copy the full SHA
    2d45512 View commit details
    Browse the repository at this point in the history
  4. Tests for Command

    rben01 committed Sep 7, 2024
    Configuration menu
    Copy the full SHA
    5a0ff28 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    3e89134 View commit details
    Browse the repository at this point in the history
  6. Reduced some copy-pasted code

    rben01 committed Sep 7, 2024
    Configuration menu
    Copy the full SHA
    1318619 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    9ef2f8b View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    314ad41 View commit details
    Browse the repository at this point in the history

Commits on Sep 8, 2024

  1. Passed code_source_id to parse_command instead of a Resolver

    Note that there is a bug where non-command inputs run `add_course_source` twice, which leads to incorrect line numbers
    rben01 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    4615178 View commit details
    Browse the repository at this point in the history
  2. Made struct CommandParser and reimplemented command parsing in term…

    …s of it (much cleaner)
    rben01 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    32bf547 View commit details
    Browse the repository at this point in the history
  3. Fixed bug where resolver.add_code_source was run twice per non-comm…

    …and input
    
    How: split `CommandParser` into a second struct, `SourcelessCommandParser`, that contains just the input, no `code_source_id`
    `SourcelessCommandParser` has a fallible initializer that only returns `Some(Self)` if the line is indeed a command (ie starts with a command word)
    Then we simply check if this initializer succeeded; if so then make a new `code_source_id` and construct the full `CommandParser`, then parse the command
    rben01 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    01ab601 View commit details
    Browse the repository at this point in the history
  4. Enum-ified command kind, making it strongly typed (no need for `unrea…

    …chable!`)
    
    Made "list" report incorrect number of args before reporting invalid arg, in the event that both errors were present
    rben01 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    2723c14 View commit details
    Browse the repository at this point in the history
  5. Changed InvalidCommand to take a String instead of &'static str

    Replaced `ensure_zero_args!` macro with function, now that this is possible (since we can use `format!` instead of `concat!)
    rben01 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    f929215 View commit details
    Browse the repository at this point in the history
  6. Replaced trailing space characters in two tests with \x20 to preven…

    …t them from being removed when removing trailing whitespace on save
    rben01 committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    336eeca View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    4cd8c56 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    6fed904 View commit details
    Browse the repository at this point in the history

Commits on Sep 15, 2024

  1. Configuration menu
    Copy the full SHA
    1f34d27 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    50dd0fd View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6b1a863 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ac1bd61 View commit details
    Browse the repository at this point in the history

Commits on Sep 17, 2024

  1. Moved pushing to session history out of parse_and_evaluate and into…

    … `run_repl`
    
    Therefore changed `parse_and_evalute` to return a struct of `control_flow, errored` to let session history know whether the command in question errored
    Added tests to `session_history.rs`
    Code seems overall not terrible now
    rben01 committed Sep 17, 2024
    Configuration menu
    Copy the full SHA
    f89083e View commit details
    Browse the repository at this point in the history

Commits on Sep 18, 2024

  1. Replaced boolean errored with isomorphic but clearer `Result<(), ()…

    …>` and renamed some items accordingly
    rben01 committed Sep 18, 2024
    Configuration menu
    Copy the full SHA
    8f2a804 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e4e6c37 View commit details
    Browse the repository at this point in the history

Commits on Sep 21, 2024

  1. Minor cleanup

    rben01 committed Sep 21, 2024
    Configuration menu
    Copy the full SHA
    efb7250 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ea859dd View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    20d6815 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3f987a2 View commit details
    Browse the repository at this point in the history
  5. Merge branch 'session-history' into commands

    Improved save logic: allowed for 0 arguments, in which case session history will be saved to history.nbt
    Printed message on successful save
    rben01 committed Sep 21, 2024
    Configuration menu
    Copy the full SHA
    87b0812 View commit details
    Browse the repository at this point in the history
  6. Updated cli docs

    rben01 committed Sep 21, 2024
    Configuration menu
    Copy the full SHA
    b0361a9 View commit details
    Browse the repository at this point in the history

Commits on Sep 22, 2024

  1. Removed ls as alias for command list in web version for consisten…

    …cy with CLI
    
    Updated web docs
    rben01 committed Sep 22, 2024
    Configuration menu
    Copy the full SHA
    8a278bc View commit details
    Browse the repository at this point in the history
  2. Replaced CommandKind::new with impl FromStr for CommandKind (isom…

    …orphic but more self-descriptive)
    rben01 committed Sep 22, 2024
    Configuration menu
    Copy the full SHA
    5c55c45 View commit details
    Browse the repository at this point in the history

Commits on Sep 24, 2024

  1. Configuration menu
    Copy the full SHA
    ab4205e View commit details
    Browse the repository at this point in the history