Skip to content

Refactoring word expansion #139

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

Closed
10 tasks
magicant opened this issue Mar 16, 2022 · 2 comments · Fixed by #140
Closed
10 tasks

Refactoring word expansion #139

magicant opened this issue Mar 16, 2022 · 2 comments · Fixed by #140

Comments

@magicant
Copy link
Owner

  • Move old implementation
  • Define new types
    • Phrase: Result of initial-expanding something. An array of any number of fields.
    • Error: Failed expansion. The same as the existing implementation.
    • Result: Result of initial expansion. Either a phrase or an error.
    • Env: Adapter for performing initial-expansion. Extends the normal yash_env::Env with the is_quoted flag and the exit status of the last command substitution.
  • Reimplement expansion
  • Update callers to use new implementation
  • Remove old implementation
  • Update documentation
@magicant
Copy link
Owner Author

magicant commented Mar 17, 2022

Module structure:

  • expansion
    • attr
      • Origin, AttrChar, AttrField
    • phrase
      • Phrase, IntoIter
    • return
      • Return::{Ready, Async}, IntoFuture
    • initial
      • Env, QuoteGuard
      • Expand
      • slice
      • text
      • word
      • command_subst
      • param
    • quote_removal
    • Error, ErrorCause (unchanged)

@magicant
Copy link
Owner Author

magicant commented Mar 20, 2022

Considering something like this to optimize word/text unit expansion.

(Update: this does not work because of the limitation found in rust-lang/rust#68117. Instead, I'm thinking of adding a special function in Extend.)

@magicant magicant linked a pull request Mar 28, 2022 that will close this issue
@magicant magicant moved this to Done in yash-rs Aug 27, 2022
@magicant magicant added this to yash-rs Aug 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant