IDEA-247214 JsonPath: parser tests
authorYuriy Artamonov <yuriy.artamonov@jetbrains.com>
Tue, 29 Dec 2020 11:08:18 +0000 (14:08 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Tue, 29 Dec 2020 13:38:45 +0000 (13:38 +0000)
GitOrigin-RevId: a907f4185430aff952513deed538b3c2203a97ba

42 files changed:
json/tests/intellij.json.tests.iml
json/tests/test/com/intellij/jsonpath/JsonPathGoessnerParserTest.kt [new file with mode: 0644]
json/tests/test/com/intellij/jsonpath/JsonPathJaywayParserTest.kt [new file with mode: 0644]
json/tests/test/com/intellij/jsonpath/JsonPathLexerTest.kt [new file with mode: 0644]
json/tests/test/com/intellij/jsonpath/JsonPathTestUtils.kt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/AllStructure.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/DottedSegments.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/DottedSegmentsWithoutContext.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/FilterExpression.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/FilterWithAttribute.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/Index.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/LastExpression.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/LastIndex.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/QuotedEscaping.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/QuotedSegments.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/QuotedSegmentsWithoutContext.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/RecursiveDescent.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/RecursiveDescentWithPath.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/SpliceFrom.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/SpliceTo.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/TwoIndexes.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/WildcardEnding.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/goessner/WildcardIndexes.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/AndOperator.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/DashInsideIdentifier.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/DotBeforeQuotedSegment.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/FilterWithComparison.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/FunctionLiteralArg.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/FunctionOnTopLevel.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/FunctionWithArgumentExpression.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/FunctionWithMultipleArgs.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/MixedSegmentTypes.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/MultipleQuotedPaths.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/NestedFunctionCall.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/OrOperator.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/ProgrammaticFilterPlaceholder.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/QuotedSegmentInTheMiddle.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/QuotedSegmentWithFilter.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/RegexCaseInsensitive.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/RegexMatch.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/RegexWithSlashes.txt [new file with mode: 0644]
json/tests/testData/jsonpath/parser/jayway/StringLiteralsConcat.txt [new file with mode: 0644]

index a9498287ddf649e9ef073c31042e04cdb266f48e..fb414ac45bf5a644ce95173b179400acf6396120 100644 (file)
@@ -12,5 +12,6 @@
     <orderEntry type="module" module-name="intellij.json" scope="TEST" />
     <orderEntry type="module" module-name="intellij.spellchecker" scope="TEST" />
     <orderEntry type="module" module-name="intellij.platform.testExtensions" scope="TEST" />
+    <orderEntry type="library" scope="TEST" name="kotlin-stdlib-jdk8" level="project" />
   </component>
 </module>
\ No newline at end of file
diff --git a/json/tests/test/com/intellij/jsonpath/JsonPathGoessnerParserTest.kt b/json/tests/test/com/intellij/jsonpath/JsonPathGoessnerParserTest.kt
new file mode 100644 (file)
index 0000000..e36994c
--- /dev/null
@@ -0,0 +1,77 @@
+// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+package com.intellij.jsonpath
+
+// Core specification: https://goessner.net/articles/JsonPath/
+class JsonPathGoessnerParserTest : JsonPathParsingTestCase("goessner") {
+  fun testDottedSegments() {
+    doCodeTest("\$.store.book[0].title")
+  }
+
+  fun testQuotedSegments() {
+    doCodeTest("\$['store']['book'][0]['title']")
+  }
+
+  fun testQuotedEscaping() {
+    doCodeTest("\$['store \\' name']")
+  }
+
+  fun testDottedSegmentsWithoutContext() {
+    doCodeTest("x.store.book[0].title")
+  }
+
+  fun testQuotedSegmentsWithoutContext() {
+    doCodeTest("x['store']['book'][0]['title']")
+  }
+
+  fun testWildcardIndexes() {
+    doCodeTest("\$.store.book[*].author")
+  }
+
+  fun testRecursiveDescent() {
+    doCodeTest("\$..author")
+  }
+
+  fun testWildcardEnding() {
+    doCodeTest("\$.store.*")
+  }
+
+  fun testRecursiveDescentWithPath() {
+    doCodeTest("\$.store..price")
+  }
+
+  fun testIndex() {
+    doCodeTest("\$..book[2]")
+  }
+
+  fun testLastExpression() {
+    doCodeTest("\$..book[(@.length - 1)]")
+  }
+
+  fun testLastIndex() {
+    doCodeTest("\$..book[-1:]")
+  }
+
+  fun testTwoIndexes() {
+    doCodeTest("\$..book[0,1]")
+  }
+
+  fun testSpliceTo() {
+    doCodeTest("\$..book[:2]")
+  }
+
+  fun testSpliceFrom() {
+    doCodeTest("\$..book[2:]")
+  }
+
+  fun testFilterWithAttribute() {
+    doCodeTest("\$..book[?(@.isbn)]")
+  }
+
+  fun testFilterExpression() {
+    doCodeTest("\$..book[?(@.price<10)]")
+  }
+
+  fun testAllStructure() {
+    doCodeTest("\$..*")
+  }
+}
\ No newline at end of file
diff --git a/json/tests/test/com/intellij/jsonpath/JsonPathJaywayParserTest.kt b/json/tests/test/com/intellij/jsonpath/JsonPathJaywayParserTest.kt
new file mode 100644 (file)
index 0000000..e31c7d4
--- /dev/null
@@ -0,0 +1,89 @@
+// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+package com.intellij.jsonpath
+
+// Behavior compatible with com.jayway.jsonpath
+class JsonPathJaywayParserTest : JsonPathParsingTestCase("jayway") {
+  fun testProgrammaticFilterPlaceholder() {
+    doCodeTest("\$.programmatic_filter[?]") // ? will be replaced by programmatic filter at runtime
+  }
+
+  fun testFunctionWithArgumentExpression() {
+    doCodeTest("\$.sum(\$..timestamp)")
+  }
+
+  fun testFunctionWithMultipleArgs() {
+    doCodeTest("\$.max(\$..timestamp.avg(), 100)")
+  }
+
+  fun testFunctionOnTopLevel() {
+    doCodeTest("concat(\"/\", \$.key)")
+  }
+
+  fun testFilterWithComparison() {
+    doCodeTest("\$.batches.results[?(@.values.length() >= \$.batches.minBatchSize)].values.avg()")
+  }
+
+  fun testNestedFunctionCall() {
+    doCodeTest("\$.avg(\$.numbers.min(), \$.numbers.max())")
+  }
+
+  fun testFunctionLiteralArg() {
+    doCodeTest("\$.sum(50)")
+  }
+
+  fun testStringLiteralsConcat() {
+    doCodeTest("\$.text.concat(\"-\", \"some\")")
+  }
+
+  fun testRegexMatch() {
+    doCodeTest("\$.text[?(@ =~ /9.*9/)]")
+  }
+
+  fun testRegexCaseInsensitive() {
+    doCodeTest("\$.data_text[?(@ =~ /test/i)]")
+  }
+
+  fun testRegexWithSlashes() {
+    doCodeTest("\$.regex[?(@ =~ /^\\w+\$/U)]")
+  }
+
+  fun testMultipleQuotedPaths() {
+    doCodeTest("\$['a', 'x']")
+  }
+
+  fun testMixedSegmentTypes() {
+    doCodeTest("\$['a', 'c'].v")
+  }
+
+  fun testDotBeforeQuotedSegment() {
+    doCodeTest("\$.['store'].['book'][0]")
+  }
+
+  fun testQuotedSegmentWithFilter() {
+    doCodeTest("\$['a', 'c'][?(@.flag)].v")
+  }
+
+  fun testQuotedSegmentInTheMiddle() {
+    doCodeTest("\$.x[*]['a', 'c'].v")
+  }
+
+  fun testDashInsideIdentifier() {
+    doCodeTest("\$.int-max-property")
+  }
+
+  fun testAndOperator() {
+    doCodeTest("\$.text[?(@.name == 'name' && $.length() > 2)]")
+  }
+
+  fun testOrOperator() {
+    doCodeTest("\$.text[?(@.name == 'name' || $.length() < 2)]")
+  }
+
+  fun testArrayLiterals() {
+    // todo $.store.bicycle[?(@.gears == [23, 50])]
+  }
+
+  fun testObjectLiterals() {
+    // todo $.store.bicycle[?(@.extra == {"x":0})]
+  }
+}
\ No newline at end of file
diff --git a/json/tests/test/com/intellij/jsonpath/JsonPathLexerTest.kt b/json/tests/test/com/intellij/jsonpath/JsonPathLexerTest.kt
new file mode 100644 (file)
index 0000000..308ef47
--- /dev/null
@@ -0,0 +1,391 @@
+// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+package com.intellij.jsonpath
+
+import com.intellij.jsonpath.lexer.JsonPathLexer
+import com.intellij.lexer.Lexer
+import com.intellij.testFramework.LexerTestCase
+
+class JsonPathLexerTest : LexerTestCase() {
+  private val ROOT: String = "\$"
+
+  override fun createLexer(): Lexer = JsonPathLexer()
+  override fun getDirPath(): String = "unused"
+
+  fun testRoot() {
+    doTest("\$", "ROOT_CONTEXT ('\$')")
+    doTest("@", "EVAL_CONTEXT ('@')")
+    doTest("name", "IDENTIFIER ('name')")
+
+    doTest("\$[0]", """
+      ROOT_CONTEXT ('$ROOT')
+      LBRACKET ('[')
+      INTEGER_NUMBER ('0')
+      RBRACKET (']')
+    """.trimIndent())
+
+    doTest("@[-100]", """
+      EVAL_CONTEXT ('@')
+      LBRACKET ('[')
+      INTEGER_NUMBER ('-100')
+      RBRACKET (']')
+    """.trimIndent())
+  }
+
+  fun testDottedPaths() {
+    doTest("\$.path", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('path')
+    """.trimIndent())
+
+    doTest("\$..path", """
+      ROOT_CONTEXT ('$ROOT')
+      RECURSIVE_DESCENT ('..')
+      IDENTIFIER ('path')
+    """.trimIndent())
+
+    doTest("@.path", """
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('path')
+    """.trimIndent())
+
+    doTest("@..path", """
+      EVAL_CONTEXT ('@')
+      RECURSIVE_DESCENT ('..')
+      IDENTIFIER ('path')
+    """.trimIndent())
+
+    doTest("\$.path", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('path')
+    """.trimIndent())
+
+    doTest("\$.long.path.with.root", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('long')
+      DOT ('.')
+      IDENTIFIER ('path')
+      DOT ('.')
+      IDENTIFIER ('with')
+      DOT ('.')
+      IDENTIFIER ('root')
+    """.trimIndent())
+
+    doTest("@.long.path.with.eval", """
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('long')
+      DOT ('.')
+      IDENTIFIER ('path')
+      DOT ('.')
+      IDENTIFIER ('with')
+      DOT ('.')
+      IDENTIFIER ('eval')
+    """.trimIndent())
+  }
+
+  fun testQuotedPaths() {
+    doTest("\$['quoted']['path']", """
+      ROOT_CONTEXT ('$ROOT')
+      LBRACKET ('[')
+      SINGLE_QUOTED_STRING (''quoted'')
+      RBRACKET (']')
+      LBRACKET ('[')
+      SINGLE_QUOTED_STRING (''path'')
+      RBRACKET (']')
+    """.trimIndent())
+    doTest("\$.['quoted'].path", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      LBRACKET ('[')
+      SINGLE_QUOTED_STRING (''quoted'')
+      RBRACKET (']')
+      DOT ('.')
+      IDENTIFIER ('path')
+    """.trimIndent())
+    doTest("\$.[\"quo\\ted\"]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      LBRACKET ('[')
+      DOUBLE_QUOTED_STRING ('"quo\ted"')
+      RBRACKET (']')
+    """.trimIndent())
+  }
+
+  fun testFilterExpression() {
+    doTest("\$.demo[?(@.filter > 2)]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      FILTER_OPERATOR ('?')
+      LPARENTH ('(')
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('filter')
+      WHITE_SPACE (' ')
+      GT_OP ('>')
+      WHITE_SPACE (' ')
+      INTEGER_NUMBER ('2')
+      RPARENTH (')')
+      RBRACKET (']')
+    """.trimIndent())
+
+    doTest("\$.demo[?(@.filter == 7.2)]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      FILTER_OPERATOR ('?')
+      LPARENTH ('(')
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('filter')
+      WHITE_SPACE (' ')
+      EQ_OP ('==')
+      WHITE_SPACE (' ')
+      DOUBLE_NUMBER ('7.2')
+      RPARENTH (')')
+      RBRACKET (']')
+    """.trimIndent())
+
+    doTest("\$.demo[?(@.filter != 'value')]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      FILTER_OPERATOR ('?')
+      LPARENTH ('(')
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('filter')
+      WHITE_SPACE (' ')
+      NE_OP ('!=')
+      WHITE_SPACE (' ')
+      SINGLE_QUOTED_STRING (''value'')
+      RPARENTH (')')
+      RBRACKET (']')
+    """.trimIndent())
+
+    doTest("\$.demo[?(@.filter == true)]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      FILTER_OPERATOR ('?')
+      LPARENTH ('(')
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('filter')
+      WHITE_SPACE (' ')
+      EQ_OP ('==')
+      WHITE_SPACE (' ')
+      TRUE ('true')
+      RPARENTH (')')
+      RBRACKET (']')
+    """.trimIndent())
+
+    doTest("\$.demo[?(@.filter != false)]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      FILTER_OPERATOR ('?')
+      LPARENTH ('(')
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('filter')
+      WHITE_SPACE (' ')
+      NE_OP ('!=')
+      WHITE_SPACE (' ')
+      FALSE ('false')
+      RPARENTH (')')
+      RBRACKET (']')
+    """.trimIndent())
+
+    doTest("\$.demo[?(@.null != null)]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      FILTER_OPERATOR ('?')
+      LPARENTH ('(')
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('null')
+      WHITE_SPACE (' ')
+      NE_OP ('!=')
+      WHITE_SPACE (' ')
+      NULL ('null')
+      RPARENTH (')')
+      RBRACKET (']')
+    """.trimIndent())
+
+    doTest("\$.demo[?('a' in @.in)]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      FILTER_OPERATOR ('?')
+      LPARENTH ('(')
+      SINGLE_QUOTED_STRING (''a'')
+      WHITE_SPACE (' ')
+      IN_OP ('in')
+      WHITE_SPACE (' ')
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('in')
+      RPARENTH (')')
+      RBRACKET (']')
+    """.trimIndent())
+  }
+
+  fun testBooleanOperations() {
+    doTest("\$.demo[?(@.a>=10 && $.b<=2)]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      FILTER_OPERATOR ('?')
+      LPARENTH ('(')
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('a')
+      GE_OP ('>=')
+      INTEGER_NUMBER ('10')
+      WHITE_SPACE (' ')
+      AND_OP ('&&')
+      WHITE_SPACE (' ')
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('b')
+      LE_OP ('<=')
+      INTEGER_NUMBER ('2')
+      RPARENTH (')')
+      RBRACKET (']')
+    """.trimIndent())
+  }
+
+  fun testIndexExpression() {
+    doTest("\$.demo[(@.length - 1)]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      LPARENTH ('(')
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('length')
+      WHITE_SPACE (' ')
+      MINUS_OP ('-')
+      WHITE_SPACE (' ')
+      INTEGER_NUMBER ('1')
+      RPARENTH (')')
+      RBRACKET (']')
+    """.trimIndent())
+  }
+
+  fun testRegexLiteral() {
+    doTest("\$.demo[?(@.attr =~ /[a-z]/)]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      FILTER_OPERATOR ('?')
+      LPARENTH ('(')
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('attr')
+      WHITE_SPACE (' ')
+      RE_OP ('=~')
+      WHITE_SPACE (' ')
+      REGEX_STRING ('/[a-z]/')
+      RPARENTH (')')
+      RBRACKET (']')
+    """.trimIndent())
+
+    doTest("\$.demo[?(@.attr =~ /[0-9]/i)]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      FILTER_OPERATOR ('?')
+      LPARENTH ('(')
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('attr')
+      WHITE_SPACE (' ')
+      RE_OP ('=~')
+      WHITE_SPACE (' ')
+      REGEX_STRING ('/[0-9]/i')
+      RPARENTH (')')
+      RBRACKET (']')
+    """.trimIndent())
+
+    doTest("\$.demo[?(@.attr =~ /[0-9]/iu)]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      FILTER_OPERATOR ('?')
+      LPARENTH ('(')
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('attr')
+      WHITE_SPACE (' ')
+      RE_OP ('=~')
+      WHITE_SPACE (' ')
+      REGEX_STRING ('/[0-9]/iu')
+      RPARENTH (')')
+      RBRACKET (']')
+    """.trimIndent())
+
+    doTest("\$.demo[?(@ =~ /test/U)]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      FILTER_OPERATOR ('?')
+      LPARENTH ('(')
+      EVAL_CONTEXT ('@')
+      WHITE_SPACE (' ')
+      RE_OP ('=~')
+      WHITE_SPACE (' ')
+      REGEX_STRING ('/test/U')
+      RPARENTH (')')
+      RBRACKET (']')
+    """.trimIndent())
+  }
+
+  fun testWildcardMultiplyOperators() {
+    doTest("\$.demo[*].demo[?(@.attr * 2 == 10)]", """
+      ROOT_CONTEXT ('$ROOT')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      WILDCARD ('*')
+      RBRACKET (']')
+      DOT ('.')
+      IDENTIFIER ('demo')
+      LBRACKET ('[')
+      FILTER_OPERATOR ('?')
+      LPARENTH ('(')
+      EVAL_CONTEXT ('@')
+      DOT ('.')
+      IDENTIFIER ('attr')
+      WHITE_SPACE (' ')
+      MULTIPLY_OP ('*')
+      WHITE_SPACE (' ')
+      INTEGER_NUMBER ('2')
+      WHITE_SPACE (' ')
+      EQ_OP ('==')
+      WHITE_SPACE (' ')
+      INTEGER_NUMBER ('10')
+      RPARENTH (')')
+      RBRACKET (']')
+    """.trimIndent())
+  }
+}
\ No newline at end of file
diff --git a/json/tests/test/com/intellij/jsonpath/JsonPathTestUtils.kt b/json/tests/test/com/intellij/jsonpath/JsonPathTestUtils.kt
new file mode 100644 (file)
index 0000000..92ef09c
--- /dev/null
@@ -0,0 +1,12 @@
+// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+package com.intellij.jsonpath
+
+import com.intellij.jsonpath.psi.JsonPathParserDefinition
+import com.intellij.testFramework.ParsingTestCase
+import com.intellij.testFramework.PlatformTestUtil
+
+abstract class JsonPathParsingTestCase(subFolder: String) : ParsingTestCase(subFolder, ".jsonpath", JsonPathParserDefinition()) {
+  override fun getTestDataPath(): String {
+    return PlatformTestUtil.getCommunityPath() + "/json/tests/testData/jsonpath/parser"
+  }
+}
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/AllStructure.txt b/json/tests/testData/jsonpath/parser/goessner/AllStructure.txt
new file mode 100644 (file)
index 0000000..e5d26ea
--- /dev/null
@@ -0,0 +1,6 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(RECURSIVE_DESCENT)('..')
+  JsonPathWildcardLiteralImpl(WILDCARD_LITERAL)
+    PsiElement(WILDCARD)('*')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/DottedSegments.txt b/json/tests/testData/jsonpath/parser/goessner/DottedSegments.txt
new file mode 100644 (file)
index 0000000..5a38cc9
--- /dev/null
@@ -0,0 +1,17 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('store')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('book')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      JsonPathIndexesListImpl(INDEXES_LIST)
+        PsiElement(INTEGER_NUMBER)('0')
+      PsiElement(RBRACKET)(']')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('title')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/DottedSegmentsWithoutContext.txt b/json/tests/testData/jsonpath/parser/goessner/DottedSegmentsWithoutContext.txt
new file mode 100644 (file)
index 0000000..4798b24
--- /dev/null
@@ -0,0 +1,17 @@
+JsonPathFile
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('x')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('store')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('book')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      JsonPathIndexesListImpl(INDEXES_LIST)
+        PsiElement(INTEGER_NUMBER)('0')
+      PsiElement(RBRACKET)(']')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('title')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/FilterExpression.txt b/json/tests/testData/jsonpath/parser/goessner/FilterExpression.txt
new file mode 100644 (file)
index 0000000..f6f6484
--- /dev/null
@@ -0,0 +1,23 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(RECURSIVE_DESCENT)('..')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('book')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      PsiElement(FILTER_OPERATOR)('?')
+      PsiElement(LPARENTH)('(')
+      JsonPathFilterExpressionImpl(FILTER_EXPRESSION)
+        JsonPathConditionalExpressionImpl(CONDITIONAL_EXPRESSION)
+          JsonPathPathExpressionImpl(PATH_EXPRESSION)
+            JsonPathEvalSegmentImpl(EVAL_SEGMENT)
+              PsiElement(EVAL_CONTEXT)('@')
+            PsiElement(DOT)('.')
+            JsonPathIdSegmentImpl(ID_SEGMENT)
+              PsiElement(IDENTIFIER)('price')
+          PsiElement(LT_OP)('<')
+          JsonPathNumberLiteralImpl(NUMBER_LITERAL)
+            PsiElement(INTEGER_NUMBER)('10')
+      PsiElement(RPARENTH)(')')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/FilterWithAttribute.txt b/json/tests/testData/jsonpath/parser/goessner/FilterWithAttribute.txt
new file mode 100644 (file)
index 0000000..cc116cc
--- /dev/null
@@ -0,0 +1,19 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(RECURSIVE_DESCENT)('..')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('book')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      PsiElement(FILTER_OPERATOR)('?')
+      PsiElement(LPARENTH)('(')
+      JsonPathFilterExpressionImpl(FILTER_EXPRESSION)
+        JsonPathPathExpressionImpl(PATH_EXPRESSION)
+          JsonPathEvalSegmentImpl(EVAL_SEGMENT)
+            PsiElement(EVAL_CONTEXT)('@')
+          PsiElement(DOT)('.')
+          JsonPathIdSegmentImpl(ID_SEGMENT)
+            PsiElement(IDENTIFIER)('isbn')
+      PsiElement(RPARENTH)(')')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/Index.txt b/json/tests/testData/jsonpath/parser/goessner/Index.txt
new file mode 100644 (file)
index 0000000..604f9ee
--- /dev/null
@@ -0,0 +1,11 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(RECURSIVE_DESCENT)('..')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('book')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      JsonPathIndexesListImpl(INDEXES_LIST)
+        PsiElement(INTEGER_NUMBER)('2')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/LastExpression.txt b/json/tests/testData/jsonpath/parser/goessner/LastExpression.txt
new file mode 100644 (file)
index 0000000..22e6712
--- /dev/null
@@ -0,0 +1,24 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(RECURSIVE_DESCENT)('..')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('book')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      PsiElement(LPARENTH)('(')
+      JsonPathIndexExpressionImpl(INDEX_EXPRESSION)
+        JsonPathMinusExpressionImpl(MINUS_EXPRESSION)
+          JsonPathPathExpressionImpl(PATH_EXPRESSION)
+            JsonPathEvalSegmentImpl(EVAL_SEGMENT)
+              PsiElement(EVAL_CONTEXT)('@')
+            PsiElement(DOT)('.')
+            JsonPathIdSegmentImpl(ID_SEGMENT)
+              PsiElement(IDENTIFIER)('length')
+          PsiWhiteSpace(' ')
+          PsiElement(MINUS_OP)('-')
+          PsiWhiteSpace(' ')
+          JsonPathNumberLiteralImpl(NUMBER_LITERAL)
+            PsiElement(INTEGER_NUMBER)('1')
+      PsiElement(RPARENTH)(')')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/LastIndex.txt b/json/tests/testData/jsonpath/parser/goessner/LastIndex.txt
new file mode 100644 (file)
index 0000000..298f69f
--- /dev/null
@@ -0,0 +1,12 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(RECURSIVE_DESCENT)('..')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('book')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      JsonPathSpliceExpressionImpl(SPLICE_EXPRESSION)
+        PsiElement(INTEGER_NUMBER)('-1')
+        PsiElement(COLON)(':')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/QuotedEscaping.txt b/json/tests/testData/jsonpath/parser/goessner/QuotedEscaping.txt
new file mode 100644 (file)
index 0000000..778ba79
--- /dev/null
@@ -0,0 +1,9 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  JsonPathQuotedSegmentImpl(QUOTED_SEGMENT)
+    PsiElement(LBRACKET)('[')
+    JsonPathQuotedPathsListImpl(QUOTED_PATHS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''store \' name'')
+    PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/QuotedSegments.txt b/json/tests/testData/jsonpath/parser/goessner/QuotedSegments.txt
new file mode 100644 (file)
index 0000000..70f3222
--- /dev/null
@@ -0,0 +1,26 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  JsonPathQuotedSegmentImpl(QUOTED_SEGMENT)
+    PsiElement(LBRACKET)('[')
+    JsonPathQuotedPathsListImpl(QUOTED_PATHS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''store'')
+    PsiElement(RBRACKET)(']')
+  JsonPathQuotedSegmentImpl(QUOTED_SEGMENT)
+    PsiElement(LBRACKET)('[')
+    JsonPathQuotedPathsListImpl(QUOTED_PATHS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''book'')
+    PsiElement(RBRACKET)(']')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      JsonPathIndexesListImpl(INDEXES_LIST)
+        PsiElement(INTEGER_NUMBER)('0')
+      PsiElement(RBRACKET)(']')
+  JsonPathQuotedSegmentImpl(QUOTED_SEGMENT)
+    PsiElement(LBRACKET)('[')
+    JsonPathQuotedPathsListImpl(QUOTED_PATHS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''title'')
+    PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/QuotedSegmentsWithoutContext.txt b/json/tests/testData/jsonpath/parser/goessner/QuotedSegmentsWithoutContext.txt
new file mode 100644 (file)
index 0000000..46a5306
--- /dev/null
@@ -0,0 +1,26 @@
+JsonPathFile
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('x')
+  JsonPathQuotedSegmentImpl(QUOTED_SEGMENT)
+    PsiElement(LBRACKET)('[')
+    JsonPathQuotedPathsListImpl(QUOTED_PATHS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''store'')
+    PsiElement(RBRACKET)(']')
+  JsonPathQuotedSegmentImpl(QUOTED_SEGMENT)
+    PsiElement(LBRACKET)('[')
+    JsonPathQuotedPathsListImpl(QUOTED_PATHS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''book'')
+    PsiElement(RBRACKET)(']')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      JsonPathIndexesListImpl(INDEXES_LIST)
+        PsiElement(INTEGER_NUMBER)('0')
+      PsiElement(RBRACKET)(']')
+  JsonPathQuotedSegmentImpl(QUOTED_SEGMENT)
+    PsiElement(LBRACKET)('[')
+    JsonPathQuotedPathsListImpl(QUOTED_PATHS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''title'')
+    PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/RecursiveDescent.txt b/json/tests/testData/jsonpath/parser/goessner/RecursiveDescent.txt
new file mode 100644 (file)
index 0000000..3621383
--- /dev/null
@@ -0,0 +1,6 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(RECURSIVE_DESCENT)('..')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('author')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/RecursiveDescentWithPath.txt b/json/tests/testData/jsonpath/parser/goessner/RecursiveDescentWithPath.txt
new file mode 100644 (file)
index 0000000..e95f2ac
--- /dev/null
@@ -0,0 +1,9 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('store')
+  PsiElement(RECURSIVE_DESCENT)('..')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('price')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/SpliceFrom.txt b/json/tests/testData/jsonpath/parser/goessner/SpliceFrom.txt
new file mode 100644 (file)
index 0000000..40a041b
--- /dev/null
@@ -0,0 +1,12 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(RECURSIVE_DESCENT)('..')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('book')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      JsonPathSpliceExpressionImpl(SPLICE_EXPRESSION)
+        PsiElement(INTEGER_NUMBER)('2')
+        PsiElement(COLON)(':')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/SpliceTo.txt b/json/tests/testData/jsonpath/parser/goessner/SpliceTo.txt
new file mode 100644 (file)
index 0000000..a53b631
--- /dev/null
@@ -0,0 +1,12 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(RECURSIVE_DESCENT)('..')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('book')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      JsonPathSpliceExpressionImpl(SPLICE_EXPRESSION)
+        PsiElement(COLON)(':')
+        PsiElement(INTEGER_NUMBER)('2')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/TwoIndexes.txt b/json/tests/testData/jsonpath/parser/goessner/TwoIndexes.txt
new file mode 100644 (file)
index 0000000..3d6c20f
--- /dev/null
@@ -0,0 +1,13 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(RECURSIVE_DESCENT)('..')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('book')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      JsonPathIndexesListImpl(INDEXES_LIST)
+        PsiElement(INTEGER_NUMBER)('0')
+        PsiElement(COMMA)(',')
+        PsiElement(INTEGER_NUMBER)('1')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/WildcardEnding.txt b/json/tests/testData/jsonpath/parser/goessner/WildcardEnding.txt
new file mode 100644 (file)
index 0000000..609a522
--- /dev/null
@@ -0,0 +1,9 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('store')
+  PsiElement(DOT)('.')
+  JsonPathWildcardLiteralImpl(WILDCARD_LITERAL)
+    PsiElement(WILDCARD)('*')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/goessner/WildcardIndexes.txt b/json/tests/testData/jsonpath/parser/goessner/WildcardIndexes.txt
new file mode 100644 (file)
index 0000000..2be6eea
--- /dev/null
@@ -0,0 +1,17 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('store')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('book')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      JsonPathWildcardLiteralImpl(WILDCARD_LITERAL)
+        PsiElement(WILDCARD)('*')
+      PsiElement(RBRACKET)(']')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('author')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/AndOperator.txt b/json/tests/testData/jsonpath/parser/jayway/AndOperator.txt
new file mode 100644 (file)
index 0000000..6ecd509
--- /dev/null
@@ -0,0 +1,44 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('text')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      PsiElement(FILTER_OPERATOR)('?')
+      PsiElement(LPARENTH)('(')
+      JsonPathFilterExpressionImpl(FILTER_EXPRESSION)
+        JsonPathAndExpressionImpl(AND_EXPRESSION)
+          JsonPathConditionalExpressionImpl(CONDITIONAL_EXPRESSION)
+            JsonPathPathExpressionImpl(PATH_EXPRESSION)
+              JsonPathEvalSegmentImpl(EVAL_SEGMENT)
+                PsiElement(EVAL_CONTEXT)('@')
+              PsiElement(DOT)('.')
+              JsonPathIdSegmentImpl(ID_SEGMENT)
+                PsiElement(IDENTIFIER)('name')
+            PsiWhiteSpace(' ')
+            PsiElement(EQ_OP)('==')
+            PsiWhiteSpace(' ')
+            JsonPathStringLiteralImpl(STRING_LITERAL)
+              PsiElement(SINGLE_QUOTED_STRING)(''name'')
+          PsiWhiteSpace(' ')
+          PsiElement(AND_OP)('&&')
+          PsiWhiteSpace(' ')
+          JsonPathConditionalExpressionImpl(CONDITIONAL_EXPRESSION)
+            JsonPathPathExpressionImpl(PATH_EXPRESSION)
+              JsonPathRootSegmentImpl(ROOT_SEGMENT)
+                PsiElement(ROOT_CONTEXT)('$')
+              PsiElement(DOT)('.')
+              JsonPathFunctionCallImpl(FUNCTION_CALL)
+                JsonPathFunctionNameImpl(FUNCTION_NAME)
+                  PsiElement(IDENTIFIER)('length')
+                PsiElement(LPARENTH)('(')
+                PsiElement(RPARENTH)(')')
+            PsiWhiteSpace(' ')
+            PsiElement(GT_OP)('>')
+            PsiWhiteSpace(' ')
+            JsonPathNumberLiteralImpl(NUMBER_LITERAL)
+              PsiElement(INTEGER_NUMBER)('2')
+      PsiElement(RPARENTH)(')')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/DashInsideIdentifier.txt b/json/tests/testData/jsonpath/parser/jayway/DashInsideIdentifier.txt
new file mode 100644 (file)
index 0000000..40c9773
--- /dev/null
@@ -0,0 +1,6 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('int-max-property')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/DotBeforeQuotedSegment.txt b/json/tests/testData/jsonpath/parser/jayway/DotBeforeQuotedSegment.txt
new file mode 100644 (file)
index 0000000..9203fac
--- /dev/null
@@ -0,0 +1,22 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathQuotedSegmentImpl(QUOTED_SEGMENT)
+    PsiElement(LBRACKET)('[')
+    JsonPathQuotedPathsListImpl(QUOTED_PATHS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''store'')
+    PsiElement(RBRACKET)(']')
+  PsiElement(DOT)('.')
+  JsonPathQuotedSegmentImpl(QUOTED_SEGMENT)
+    PsiElement(LBRACKET)('[')
+    JsonPathQuotedPathsListImpl(QUOTED_PATHS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''book'')
+    PsiElement(RBRACKET)(']')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      JsonPathIndexesListImpl(INDEXES_LIST)
+        PsiElement(INTEGER_NUMBER)('0')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/FilterWithComparison.txt b/json/tests/testData/jsonpath/parser/jayway/FilterWithComparison.txt
new file mode 100644 (file)
index 0000000..6fea3fa
--- /dev/null
@@ -0,0 +1,50 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('batches')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('results')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      PsiElement(FILTER_OPERATOR)('?')
+      PsiElement(LPARENTH)('(')
+      JsonPathFilterExpressionImpl(FILTER_EXPRESSION)
+        JsonPathConditionalExpressionImpl(CONDITIONAL_EXPRESSION)
+          JsonPathPathExpressionImpl(PATH_EXPRESSION)
+            JsonPathEvalSegmentImpl(EVAL_SEGMENT)
+              PsiElement(EVAL_CONTEXT)('@')
+            PsiElement(DOT)('.')
+            JsonPathIdSegmentImpl(ID_SEGMENT)
+              PsiElement(IDENTIFIER)('values')
+            PsiElement(DOT)('.')
+            JsonPathFunctionCallImpl(FUNCTION_CALL)
+              JsonPathFunctionNameImpl(FUNCTION_NAME)
+                PsiElement(IDENTIFIER)('length')
+              PsiElement(LPARENTH)('(')
+              PsiElement(RPARENTH)(')')
+          PsiWhiteSpace(' ')
+          PsiElement(GE_OP)('>=')
+          PsiWhiteSpace(' ')
+          JsonPathPathExpressionImpl(PATH_EXPRESSION)
+            JsonPathRootSegmentImpl(ROOT_SEGMENT)
+              PsiElement(ROOT_CONTEXT)('$')
+            PsiElement(DOT)('.')
+            JsonPathIdSegmentImpl(ID_SEGMENT)
+              PsiElement(IDENTIFIER)('batches')
+            PsiElement(DOT)('.')
+            JsonPathIdSegmentImpl(ID_SEGMENT)
+              PsiElement(IDENTIFIER)('minBatchSize')
+      PsiElement(RPARENTH)(')')
+      PsiElement(RBRACKET)(']')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('values')
+  PsiElement(DOT)('.')
+  JsonPathFunctionCallImpl(FUNCTION_CALL)
+    JsonPathFunctionNameImpl(FUNCTION_NAME)
+      PsiElement(IDENTIFIER)('avg')
+    PsiElement(LPARENTH)('(')
+    PsiElement(RPARENTH)(')')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/FunctionLiteralArg.txt b/json/tests/testData/jsonpath/parser/jayway/FunctionLiteralArg.txt
new file mode 100644 (file)
index 0000000..a4454ce
--- /dev/null
@@ -0,0 +1,12 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathFunctionCallImpl(FUNCTION_CALL)
+    JsonPathFunctionNameImpl(FUNCTION_NAME)
+      PsiElement(IDENTIFIER)('sum')
+    PsiElement(LPARENTH)('(')
+    JsonPathFunctionArgsListImpl(FUNCTION_ARGS_LIST)
+      JsonPathNumberLiteralImpl(NUMBER_LITERAL)
+        PsiElement(INTEGER_NUMBER)('50')
+    PsiElement(RPARENTH)(')')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/FunctionOnTopLevel.txt b/json/tests/testData/jsonpath/parser/jayway/FunctionOnTopLevel.txt
new file mode 100644 (file)
index 0000000..634ca20
--- /dev/null
@@ -0,0 +1,17 @@
+JsonPathFile
+  JsonPathFunctionCallImpl(FUNCTION_CALL)
+    JsonPathFunctionNameImpl(FUNCTION_NAME)
+      PsiElement(IDENTIFIER)('concat')
+    PsiElement(LPARENTH)('(')
+    JsonPathFunctionArgsListImpl(FUNCTION_ARGS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(DOUBLE_QUOTED_STRING)('"/"')
+      PsiElement(COMMA)(',')
+      PsiWhiteSpace(' ')
+      JsonPathPathExpressionImpl(PATH_EXPRESSION)
+        JsonPathRootSegmentImpl(ROOT_SEGMENT)
+          PsiElement(ROOT_CONTEXT)('$')
+        PsiElement(DOT)('.')
+        JsonPathIdSegmentImpl(ID_SEGMENT)
+          PsiElement(IDENTIFIER)('key')
+    PsiElement(RPARENTH)(')')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/FunctionWithArgumentExpression.txt b/json/tests/testData/jsonpath/parser/jayway/FunctionWithArgumentExpression.txt
new file mode 100644 (file)
index 0000000..28637b9
--- /dev/null
@@ -0,0 +1,16 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathFunctionCallImpl(FUNCTION_CALL)
+    JsonPathFunctionNameImpl(FUNCTION_NAME)
+      PsiElement(IDENTIFIER)('sum')
+    PsiElement(LPARENTH)('(')
+    JsonPathFunctionArgsListImpl(FUNCTION_ARGS_LIST)
+      JsonPathPathExpressionImpl(PATH_EXPRESSION)
+        JsonPathRootSegmentImpl(ROOT_SEGMENT)
+          PsiElement(ROOT_CONTEXT)('$')
+        PsiElement(RECURSIVE_DESCENT)('..')
+        JsonPathIdSegmentImpl(ID_SEGMENT)
+          PsiElement(IDENTIFIER)('timestamp')
+    PsiElement(RPARENTH)(')')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/FunctionWithMultipleArgs.txt b/json/tests/testData/jsonpath/parser/jayway/FunctionWithMultipleArgs.txt
new file mode 100644 (file)
index 0000000..1740108
--- /dev/null
@@ -0,0 +1,26 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathFunctionCallImpl(FUNCTION_CALL)
+    JsonPathFunctionNameImpl(FUNCTION_NAME)
+      PsiElement(IDENTIFIER)('max')
+    PsiElement(LPARENTH)('(')
+    JsonPathFunctionArgsListImpl(FUNCTION_ARGS_LIST)
+      JsonPathPathExpressionImpl(PATH_EXPRESSION)
+        JsonPathRootSegmentImpl(ROOT_SEGMENT)
+          PsiElement(ROOT_CONTEXT)('$')
+        PsiElement(RECURSIVE_DESCENT)('..')
+        JsonPathIdSegmentImpl(ID_SEGMENT)
+          PsiElement(IDENTIFIER)('timestamp')
+        PsiElement(DOT)('.')
+        JsonPathFunctionCallImpl(FUNCTION_CALL)
+          JsonPathFunctionNameImpl(FUNCTION_NAME)
+            PsiElement(IDENTIFIER)('avg')
+          PsiElement(LPARENTH)('(')
+          PsiElement(RPARENTH)(')')
+      PsiElement(COMMA)(',')
+      PsiWhiteSpace(' ')
+      JsonPathNumberLiteralImpl(NUMBER_LITERAL)
+        PsiElement(INTEGER_NUMBER)('100')
+    PsiElement(RPARENTH)(')')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/MixedSegmentTypes.txt b/json/tests/testData/jsonpath/parser/jayway/MixedSegmentTypes.txt
new file mode 100644 (file)
index 0000000..110c587
--- /dev/null
@@ -0,0 +1,16 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  JsonPathQuotedSegmentImpl(QUOTED_SEGMENT)
+    PsiElement(LBRACKET)('[')
+    JsonPathQuotedPathsListImpl(QUOTED_PATHS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''a'')
+      PsiElement(COMMA)(',')
+      PsiWhiteSpace(' ')
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''c'')
+    PsiElement(RBRACKET)(']')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('v')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/MultipleQuotedPaths.txt b/json/tests/testData/jsonpath/parser/jayway/MultipleQuotedPaths.txt
new file mode 100644 (file)
index 0000000..f177994
--- /dev/null
@@ -0,0 +1,13 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  JsonPathQuotedSegmentImpl(QUOTED_SEGMENT)
+    PsiElement(LBRACKET)('[')
+    JsonPathQuotedPathsListImpl(QUOTED_PATHS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''a'')
+      PsiElement(COMMA)(',')
+      PsiWhiteSpace(' ')
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''x'')
+    PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/NestedFunctionCall.txt b/json/tests/testData/jsonpath/parser/jayway/NestedFunctionCall.txt
new file mode 100644 (file)
index 0000000..f52ffda
--- /dev/null
@@ -0,0 +1,36 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathFunctionCallImpl(FUNCTION_CALL)
+    JsonPathFunctionNameImpl(FUNCTION_NAME)
+      PsiElement(IDENTIFIER)('avg')
+    PsiElement(LPARENTH)('(')
+    JsonPathFunctionArgsListImpl(FUNCTION_ARGS_LIST)
+      JsonPathPathExpressionImpl(PATH_EXPRESSION)
+        JsonPathRootSegmentImpl(ROOT_SEGMENT)
+          PsiElement(ROOT_CONTEXT)('$')
+        PsiElement(DOT)('.')
+        JsonPathIdSegmentImpl(ID_SEGMENT)
+          PsiElement(IDENTIFIER)('numbers')
+        PsiElement(DOT)('.')
+        JsonPathFunctionCallImpl(FUNCTION_CALL)
+          JsonPathFunctionNameImpl(FUNCTION_NAME)
+            PsiElement(IDENTIFIER)('min')
+          PsiElement(LPARENTH)('(')
+          PsiElement(RPARENTH)(')')
+      PsiElement(COMMA)(',')
+      PsiWhiteSpace(' ')
+      JsonPathPathExpressionImpl(PATH_EXPRESSION)
+        JsonPathRootSegmentImpl(ROOT_SEGMENT)
+          PsiElement(ROOT_CONTEXT)('$')
+        PsiElement(DOT)('.')
+        JsonPathIdSegmentImpl(ID_SEGMENT)
+          PsiElement(IDENTIFIER)('numbers')
+        PsiElement(DOT)('.')
+        JsonPathFunctionCallImpl(FUNCTION_CALL)
+          JsonPathFunctionNameImpl(FUNCTION_NAME)
+            PsiElement(IDENTIFIER)('max')
+          PsiElement(LPARENTH)('(')
+          PsiElement(RPARENTH)(')')
+    PsiElement(RPARENTH)(')')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/OrOperator.txt b/json/tests/testData/jsonpath/parser/jayway/OrOperator.txt
new file mode 100644 (file)
index 0000000..1928028
--- /dev/null
@@ -0,0 +1,44 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('text')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      PsiElement(FILTER_OPERATOR)('?')
+      PsiElement(LPARENTH)('(')
+      JsonPathFilterExpressionImpl(FILTER_EXPRESSION)
+        JsonPathOrExpressionImpl(OR_EXPRESSION)
+          JsonPathConditionalExpressionImpl(CONDITIONAL_EXPRESSION)
+            JsonPathPathExpressionImpl(PATH_EXPRESSION)
+              JsonPathEvalSegmentImpl(EVAL_SEGMENT)
+                PsiElement(EVAL_CONTEXT)('@')
+              PsiElement(DOT)('.')
+              JsonPathIdSegmentImpl(ID_SEGMENT)
+                PsiElement(IDENTIFIER)('name')
+            PsiWhiteSpace(' ')
+            PsiElement(EQ_OP)('==')
+            PsiWhiteSpace(' ')
+            JsonPathStringLiteralImpl(STRING_LITERAL)
+              PsiElement(SINGLE_QUOTED_STRING)(''name'')
+          PsiWhiteSpace(' ')
+          PsiElement(OR_OP)('||')
+          PsiWhiteSpace(' ')
+          JsonPathConditionalExpressionImpl(CONDITIONAL_EXPRESSION)
+            JsonPathPathExpressionImpl(PATH_EXPRESSION)
+              JsonPathRootSegmentImpl(ROOT_SEGMENT)
+                PsiElement(ROOT_CONTEXT)('$')
+              PsiElement(DOT)('.')
+              JsonPathFunctionCallImpl(FUNCTION_CALL)
+                JsonPathFunctionNameImpl(FUNCTION_NAME)
+                  PsiElement(IDENTIFIER)('length')
+                PsiElement(LPARENTH)('(')
+                PsiElement(RPARENTH)(')')
+            PsiWhiteSpace(' ')
+            PsiElement(LT_OP)('<')
+            PsiWhiteSpace(' ')
+            JsonPathNumberLiteralImpl(NUMBER_LITERAL)
+              PsiElement(INTEGER_NUMBER)('2')
+      PsiElement(RPARENTH)(')')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/ProgrammaticFilterPlaceholder.txt b/json/tests/testData/jsonpath/parser/jayway/ProgrammaticFilterPlaceholder.txt
new file mode 100644 (file)
index 0000000..47ddcff
--- /dev/null
@@ -0,0 +1,10 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('programmatic_filter')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      PsiElement(FILTER_OPERATOR)('?')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/QuotedSegmentInTheMiddle.txt b/json/tests/testData/jsonpath/parser/jayway/QuotedSegmentInTheMiddle.txt
new file mode 100644 (file)
index 0000000..bb0df07
--- /dev/null
@@ -0,0 +1,24 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('x')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      JsonPathWildcardLiteralImpl(WILDCARD_LITERAL)
+        PsiElement(WILDCARD)('*')
+      PsiElement(RBRACKET)(']')
+  JsonPathQuotedSegmentImpl(QUOTED_SEGMENT)
+    PsiElement(LBRACKET)('[')
+    JsonPathQuotedPathsListImpl(QUOTED_PATHS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''a'')
+      PsiElement(COMMA)(',')
+      PsiWhiteSpace(' ')
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''c'')
+    PsiElement(RBRACKET)(']')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('v')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/QuotedSegmentWithFilter.txt b/json/tests/testData/jsonpath/parser/jayway/QuotedSegmentWithFilter.txt
new file mode 100644 (file)
index 0000000..fec3298
--- /dev/null
@@ -0,0 +1,29 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  JsonPathQuotedSegmentImpl(QUOTED_SEGMENT)
+    PsiElement(LBRACKET)('[')
+    JsonPathQuotedPathsListImpl(QUOTED_PATHS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''a'')
+      PsiElement(COMMA)(',')
+      PsiWhiteSpace(' ')
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(SINGLE_QUOTED_STRING)(''c'')
+    PsiElement(RBRACKET)(']')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      PsiElement(FILTER_OPERATOR)('?')
+      PsiElement(LPARENTH)('(')
+      JsonPathFilterExpressionImpl(FILTER_EXPRESSION)
+        JsonPathPathExpressionImpl(PATH_EXPRESSION)
+          JsonPathEvalSegmentImpl(EVAL_SEGMENT)
+            PsiElement(EVAL_CONTEXT)('@')
+          PsiElement(DOT)('.')
+          JsonPathIdSegmentImpl(ID_SEGMENT)
+            PsiElement(IDENTIFIER)('flag')
+      PsiElement(RPARENTH)(')')
+      PsiElement(RBRACKET)(']')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('v')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/RegexCaseInsensitive.txt b/json/tests/testData/jsonpath/parser/jayway/RegexCaseInsensitive.txt
new file mode 100644 (file)
index 0000000..c7960fa
--- /dev/null
@@ -0,0 +1,22 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('data_text')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      PsiElement(FILTER_OPERATOR)('?')
+      PsiElement(LPARENTH)('(')
+      JsonPathFilterExpressionImpl(FILTER_EXPRESSION)
+        JsonPathRegexExpressionImpl(REGEX_EXPRESSION)
+          JsonPathPathExpressionImpl(PATH_EXPRESSION)
+            JsonPathEvalSegmentImpl(EVAL_SEGMENT)
+              PsiElement(EVAL_CONTEXT)('@')
+          PsiWhiteSpace(' ')
+          PsiElement(RE_OP)('=~')
+          PsiWhiteSpace(' ')
+          JsonPathRegexLiteralImpl(REGEX_LITERAL)
+            PsiElement(REGEX_STRING)('/test/i')
+      PsiElement(RPARENTH)(')')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/RegexMatch.txt b/json/tests/testData/jsonpath/parser/jayway/RegexMatch.txt
new file mode 100644 (file)
index 0000000..bfd0e50
--- /dev/null
@@ -0,0 +1,22 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('text')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      PsiElement(FILTER_OPERATOR)('?')
+      PsiElement(LPARENTH)('(')
+      JsonPathFilterExpressionImpl(FILTER_EXPRESSION)
+        JsonPathRegexExpressionImpl(REGEX_EXPRESSION)
+          JsonPathPathExpressionImpl(PATH_EXPRESSION)
+            JsonPathEvalSegmentImpl(EVAL_SEGMENT)
+              PsiElement(EVAL_CONTEXT)('@')
+          PsiWhiteSpace(' ')
+          PsiElement(RE_OP)('=~')
+          PsiWhiteSpace(' ')
+          JsonPathRegexLiteralImpl(REGEX_LITERAL)
+            PsiElement(REGEX_STRING)('/9.*9/')
+      PsiElement(RPARENTH)(')')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/RegexWithSlashes.txt b/json/tests/testData/jsonpath/parser/jayway/RegexWithSlashes.txt
new file mode 100644 (file)
index 0000000..66353dc
--- /dev/null
@@ -0,0 +1,22 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('regex')
+    JsonPathSegmentExpressionImpl(SEGMENT_EXPRESSION)
+      PsiElement(LBRACKET)('[')
+      PsiElement(FILTER_OPERATOR)('?')
+      PsiElement(LPARENTH)('(')
+      JsonPathFilterExpressionImpl(FILTER_EXPRESSION)
+        JsonPathRegexExpressionImpl(REGEX_EXPRESSION)
+          JsonPathPathExpressionImpl(PATH_EXPRESSION)
+            JsonPathEvalSegmentImpl(EVAL_SEGMENT)
+              PsiElement(EVAL_CONTEXT)('@')
+          PsiWhiteSpace(' ')
+          PsiElement(RE_OP)('=~')
+          PsiWhiteSpace(' ')
+          JsonPathRegexLiteralImpl(REGEX_LITERAL)
+            PsiElement(REGEX_STRING)('/^\w+$/U')
+      PsiElement(RPARENTH)(')')
+      PsiElement(RBRACKET)(']')
\ No newline at end of file
diff --git a/json/tests/testData/jsonpath/parser/jayway/StringLiteralsConcat.txt b/json/tests/testData/jsonpath/parser/jayway/StringLiteralsConcat.txt
new file mode 100644 (file)
index 0000000..b042ab3
--- /dev/null
@@ -0,0 +1,19 @@
+JsonPathFile
+  JsonPathRootSegmentImpl(ROOT_SEGMENT)
+    PsiElement(ROOT_CONTEXT)('$')
+  PsiElement(DOT)('.')
+  JsonPathIdSegmentImpl(ID_SEGMENT)
+    PsiElement(IDENTIFIER)('text')
+  PsiElement(DOT)('.')
+  JsonPathFunctionCallImpl(FUNCTION_CALL)
+    JsonPathFunctionNameImpl(FUNCTION_NAME)
+      PsiElement(IDENTIFIER)('concat')
+    PsiElement(LPARENTH)('(')
+    JsonPathFunctionArgsListImpl(FUNCTION_ARGS_LIST)
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(DOUBLE_QUOTED_STRING)('"-"')
+      PsiElement(COMMA)(',')
+      PsiWhiteSpace(' ')
+      JsonPathStringLiteralImpl(STRING_LITERAL)
+        PsiElement(DOUBLE_QUOTED_STRING)('"some"')
+    PsiElement(RPARENTH)(')')
\ No newline at end of file