mirror of
https://github.com/nushell/nushell
synced 2024-12-28 05:53:09 +00:00
minor change
This commit is contained in:
parent
a91efc3cbd
commit
d8bf48e692
2 changed files with 14 additions and 11 deletions
|
@ -7,10 +7,10 @@ fn main() -> std::io::Result<()> {
|
|||
let sig = Signature::build("foo").named("--jazz", SyntaxShape::Int, "jazz!!", Some('j'));
|
||||
working_set.add_decl((b"foo").to_vec(), sig);
|
||||
|
||||
//let file = std::fs::read(&path)?;
|
||||
//let (output, err) = working_set.parse_file(&path, &file);
|
||||
let (output, err) = working_set.parse_source(path.as_bytes());
|
||||
println!("{:#?}", output);
|
||||
let file = std::fs::read(&path)?;
|
||||
let (output, err) = working_set.parse_file(&path, &file);
|
||||
//let (output, err) = working_set.parse_source(path.as_bytes());
|
||||
println!("{}", output.len());
|
||||
println!("error: {:?}", err);
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -98,7 +98,7 @@ impl Call {
|
|||
pub enum Expr {
|
||||
Int(i64),
|
||||
Var(VarId),
|
||||
Call(Call),
|
||||
Call(Box<Call>),
|
||||
Operator(Operator),
|
||||
BinaryOp(Box<Expression>, Box<Expression>, Box<Expression>), //lhs, op, rhs
|
||||
Subexpression(Box<Block>),
|
||||
|
@ -418,7 +418,7 @@ impl ParserWorkingSet {
|
|||
// FIXME: type unknown
|
||||
(
|
||||
Expression {
|
||||
expr: Expr::Call(call),
|
||||
expr: Expr::Call(Box::new(call)),
|
||||
ty: Type::Unknown,
|
||||
span: span(spans),
|
||||
},
|
||||
|
@ -997,13 +997,16 @@ mod tests {
|
|||
|
||||
assert!(err.is_none());
|
||||
assert!(block.len() == 1);
|
||||
assert!(matches!(
|
||||
block[0],
|
||||
|
||||
match &block[0] {
|
||||
Statement::Expression(Expression {
|
||||
expr: Expr::Call(Call { decl_id: 0, .. }),
|
||||
expr: Expr::Call(call),
|
||||
..
|
||||
})
|
||||
));
|
||||
}) => {
|
||||
assert_eq!(call.decl_id, 0);
|
||||
}
|
||||
_ => panic!("not a call"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue