Math operators (#1601)

* Add some math operations

* WIP for adding compound expressions

* precedence parsing

* paren expressions

* better lhs handling

* add compound comparisons and shorthand lefthand parsing

* Add or comparison and shorthand paths
This commit is contained in:
Jonathan Turner
2020-04-18 13:50:58 +12:00
committed by GitHub
parent 52d2d2b888
commit 7974e09eeb
21 changed files with 721 additions and 193 deletions

View File

@@ -156,6 +156,12 @@ pub fn autoview(context: RunnableContext) -> Result<OutputStream, ShellError> {
} => {
out!("{}", n);
}
Value {
value: UntaggedValue::Primitive(Primitive::Boolean(b)),
..
} => {
out!("{}", b);
}
Value { value: UntaggedValue::Primitive(Primitive::Binary(ref b)), .. } => {
if let Some(binary) = binary {

View File

@@ -16,7 +16,7 @@ impl WholeStreamCommand for SkipWhile {
Signature::build("skip-while")
.required(
"condition",
SyntaxShape::Condition,
SyntaxShape::Math,
"the condition that must be met to continue skipping",
)
.filter()

View File

@@ -18,7 +18,7 @@ impl PerItemCommand for Where {
fn signature(&self) -> Signature {
Signature::build("where").required(
"condition",
SyntaxShape::Condition,
SyntaxShape::Math,
"the condition that must match",
)
}