public ArrayAccessFilterSubExpression(ArrayAccessExpressionToken token) { if (token == null) { throw new ArgumentNullException(nameof(token)); } IsAllArrayElemets = token.IsAllArrayElements; SliceStart = token.SliceStart; SliceEnd = token.SliceEnd; SliceStep = token.SliceStep; ExactElementsAccess = token.ExactElementsAccess; ExecutedOn = FilterParser.Parse(new List <FilterSubExpression> { new PrimitiveFilterSubExpression(token.ExecutedOn) }); TokenStartIndex = token.StartIndex; }
private static List <FilterExpressionToken> ReplaceArrayExpressionTokens(IReadOnlyList <FilterExpressionToken> tokens) { List <FilterExpressionToken> ret = tokens.ToList(); for (int i = 1; i < ret.Count; i++) { if (ret[i] is PrimitiveExpressionToken pet) { if (pet.Token.IsArrayElementToken()) { ret[i] = new ArrayAccessExpressionToken(ret[i - 1], pet.Token.CastToArrayElementsToken()); ret[i - 1] = null; } else if (pet.Token.IsAllArrayElementsToken()) { ret[i] = new ArrayAccessExpressionToken(ret[i - 1], pet.Token.CastToAllArrayElementsToken()); ret[i - 1] = null; } } } return(ret.Where(x => x != null).ToList()); }