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

Refactoring here-doc content filling mechanism #131

Closed
6 tasks
Tracked by #4
magicant opened this issue Feb 2, 2022 · 0 comments · Fixed by #132
Closed
6 tasks
Tracked by #4

Refactoring here-doc content filling mechanism #131

magicant opened this issue Feb 2, 2022 · 0 comments · Fixed by #132

Comments

@magicant
Copy link
Owner

magicant commented Feb 2, 2022

The current mechanism requires conversion of the entire AST data only to insert here-doc contents into the AST. Can we avoid this behavior by using RefCell and only modifying the relevant part of the AST?


The new type definitions will be:

pub struct HereDoc {
    pub delimiter: Word,
    pub remove_tabs: bool,
    pub content: RefCell<Text>,
}
pub enum RedirBody {
    Normal {
        operator: RedirOp,
        operand: Word,
    },
    HereDoc(Rc<HereDoc>),
}

Todo:

  • Wrap HereDoc::content in RefCell
  • Wrap RedirBody::HereDoc's value in Rc
  • Change Parser::unread_here_docs to a list of Rc<HereDoc>
  • Remove Parser::read_here_docs
  • Remove Fill
  • Remove unnecessary type parameters from all AST types
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