Add environment variable support for modules (#331)

* Add 'expor env' dummy command

* (WIP) Abstract away module exportables as Overlay

* Switch to Overlays for use/hide

Works for decls only right now.

* Fix passing import patterns of hide to eval

* Simplify use/hide of decls

* Add ImportPattern as Expr; Add use env eval

Still no parsing of "export env" so I can't test it yet.

* Refactor export parsing; Add InternalError

* Add env var export and activation; Misc changes

Now it is possible to `use` env var that was exported from a module.

This commit also adds some new errors and other small changes.

* Add env var hiding

* Fix eval not recognizing hidden decls

Without this change, calling `hide foo`, the evaluator does not know
whether a custom command named "foo" was hidden during parsing,
therefore, it is not possible to reliably throw an error about the "foo"
name not found.

* Add use/hide/export env var tests; Cleanup; Notes

* Ignore hide env related tests for now

* Fix main branch merge mess

* Fixed multi-word export def

* Fix hiding tests on Windows

* Remove env var hiding for now
This commit is contained in:
Jakub Žádník
2021-11-16 01:16:06 +02:00
committed by GitHub
parent ab22619f4a
commit 5459d30a24
22 changed files with 1050 additions and 261 deletions

View File

@ -225,6 +225,9 @@ pub fn eval_expression(
value.follow_cell_path(&cell_path.tail)
}
Expr::ImportPattern(_) => Ok(Value::Nothing {
span: Span::unknown(),
}),
Expr::RowCondition(_, expr) => eval_expression(engine_state, stack, expr),
Expr::Call(call) => {
// FIXME: protect this collect with ctrl-c