private ParsedDegree degreesFromArg(OperatorNode<ExpressionOperator> ast, boolean first) {
        Object arg = switch (ast.getOperator()) {
            case LITERAL -> ast.getArgument(0);
            case READ_FIELD -> ast.getArgument(1);
            default -> throw newUnexpectedArgumentException(ast.getOperator(),
                    ExpressionOperator.READ_FIELD, ExpressionOperator.PROPREF);
        };
        if (arg instanceof Number n) {
            return new ParsedDegree(n.doubleValue(), first, !first);
        }
        return ParsedDegree.fromString(arg.toString(), first, !first);
    }
The YQL query language.

This class <em>must</em> be kept in lockstep with {@link VespaSerializer}.
Adding anything here will usually require a corresponding addition in
VespaSerializer.

@author Steinar Knutsen
@author Stian Kristoffersen
@author Simon Thoresen Hult
container-search/src/main/java/com/yahoo/search/yql/YqlParser.java