public void OnIdentifier(string name) { Prolog(); var expression = new JmesPathIdentifier(name); expressions_.Push(expression); }
private void OnIdentifier(Token token) { Prolog(); var @string = (string)token.Value; var expression = new JmesPathIdentifier(@string); expressions_.Push(expression); }
private void Assert(string[] expressions, string input, string expected) { JmesPathExpression expression = null; foreach (var identifier in expressions) { JmesPathExpression ident = new JmesPathIdentifier(identifier); expression = expression != null ? new JmesPathSubExpression(expression, ident) : ident ; } Assert(expression, input, expected); }
public void JmesPathProjection_Wildcard_List() { JmesPathExpression identifier = new JmesPathIdentifier("foo"); JmesPathProjection wildcard = new JmesPathListWildcardProjection(); JmesPathExpression expression = new JmesPathSubExpression(wildcard, identifier); Assert(expression, "[{\"foo\": 1}, {\"foo\": 2}, {\"foo\": 3}]", "[1,2,3]"); Assert(expression, "[{\"foo\": 1}, {\"foo\": 2}, {\"bar\": 3}]", "[1,2]"); identifier = new JmesPathIndex(0); wildcard = new JmesPathListWildcardProjection(); expression = new JmesPathIndexExpression(wildcard, identifier); Assert(expression, "[\"foo\", \"bar\"]", "[]"); }
private void Assert(string identifier, string input, string expected) { var expression = new JmesPathIdentifier(identifier); Assert(expression, input, expected); }