Add support for magic open

This commit is contained in:
Jonathan Turner
2019-06-02 07:20:48 +12:00
parent f5c7bed77a
commit a62de9356c
4 changed files with 33 additions and 11 deletions

View File

@ -1,5 +1,6 @@
use crate::parser::ast;
use crate::prelude::*;
use crate::object::Primitive;
use derive_new::new;
#[derive(new)]
@ -20,10 +21,7 @@ crate fn evaluate_expr(expr: &ast::Expression, scope: &Scope) -> Result<Value, S
match expr {
Expression::Leaf(l) => Ok(evaluate_leaf(l)),
Expression::Parenthesized(p) => evaluate_expr(&p.expr, scope),
Expression::Flag(f) => Err(ShellError::string(format!(
"can't evaluate the flag {}",
f.print()
))),
Expression::Flag(f) => Ok(Value::Primitive(Primitive::String(f.print()))),
Expression::Block(b) => evaluate_block(&b, scope),
Expression::Path(p) => evaluate_path(&p, scope),
Expression::Binary(b) => evaluate_binary(b, scope),