|
|
@ -4,6 +4,7 @@ import com.jayway.jsonpath.InvalidPathException; |
|
|
|
import com.jayway.jsonpath.Predicate; |
|
|
|
import com.jayway.jsonpath.Predicate; |
|
|
|
import com.jayway.jsonpath.internal.CharacterIndex; |
|
|
|
import com.jayway.jsonpath.internal.CharacterIndex; |
|
|
|
import com.jayway.jsonpath.internal.Path; |
|
|
|
import com.jayway.jsonpath.internal.Path; |
|
|
|
|
|
|
|
import com.jayway.jsonpath.internal.Utils; |
|
|
|
import com.jayway.jsonpath.internal.filter.FilterCompiler; |
|
|
|
import com.jayway.jsonpath.internal.filter.FilterCompiler; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
@ -361,16 +362,22 @@ public class PathCompiler { |
|
|
|
int readPosition = startPosition; |
|
|
|
int readPosition = startPosition; |
|
|
|
int endPosition = 0; |
|
|
|
int endPosition = 0; |
|
|
|
boolean inProperty = false; |
|
|
|
boolean inProperty = false; |
|
|
|
|
|
|
|
boolean inEscape = false; |
|
|
|
|
|
|
|
|
|
|
|
while (path.inBounds(readPosition)) { |
|
|
|
while (path.inBounds(readPosition)) { |
|
|
|
char c = path.charAt(readPosition); |
|
|
|
char c = path.charAt(readPosition); |
|
|
|
|
|
|
|
|
|
|
|
if (c == CLOSE_SQUARE_BRACKET && !inProperty) { |
|
|
|
if(inEscape){ |
|
|
|
|
|
|
|
inEscape = false; |
|
|
|
|
|
|
|
} else if('\\' == c){ |
|
|
|
|
|
|
|
inEscape = true; |
|
|
|
|
|
|
|
} else if (c == CLOSE_SQUARE_BRACKET && !inProperty) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} else if (c == potentialStringDelimiter) { |
|
|
|
} else if (c == potentialStringDelimiter) { |
|
|
|
if (inProperty) { |
|
|
|
if (inProperty && !inEscape) { |
|
|
|
endPosition = readPosition; |
|
|
|
endPosition = readPosition; |
|
|
|
properties.add(path.subSequence(startPosition, endPosition).toString()); |
|
|
|
String prop = path.subSequence(startPosition, endPosition).toString(); |
|
|
|
|
|
|
|
properties.add(Utils.unescape(prop)); |
|
|
|
inProperty = false; |
|
|
|
inProperty = false; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
startPosition = readPosition + 1; |
|
|
|
startPosition = readPosition + 1; |
|
|
|