mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-05 17:36:59 +08:00
Adding first operator
This commit is contained in:
@@ -54,6 +54,12 @@ func (p *expressionParserImpl) createExpressionTree(postFixPath []*Operation) (*
|
||||
switch numArgs {
|
||||
case 1:
|
||||
if len(stack) < 1 {
|
||||
// Allow certain unary ops to accept zero args by interpreting missing RHS as nil
|
||||
// TODO - make this more general on OperationType
|
||||
if Operation.OperationType == firstOpType {
|
||||
// no RHS provided; proceed without popping
|
||||
break
|
||||
}
|
||||
return nil, fmt.Errorf("'%v' expects 1 arg but received none", strings.TrimSpace(Operation.StringValue))
|
||||
}
|
||||
remaining, rhs := stack[:len(stack)-1], stack[len(stack)-1]
|
||||
|
||||
Reference in New Issue
Block a user