Created
December 25, 2011 01:54
-
-
Save s3u/1518617 to your computer and use it in GitHub Desktop.
JSONPath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start = fieldName; | |
fieldName = selector ('.' selector)* | |
selector = word '[' (numOfexpr/ ('"' qword '"') / ('\'' qword '\'')) ']' / word / '@' | |
word = chars:([a-zA-Z$:][a-zA-Z_0-9:]*) { | |
var ret = chars[0]; | |
for(i = 1; i < chars.length; i++) { | |
ret = ret + chars[i].join(''); | |
} | |
return ret; | |
} | |
numOfexpr = number / expr | |
expr = ope | |
number = digits | |
digits = [0-9]+ | |
qword = chars:([\x20-\x21]/[\x23-\x26]/[\x28-\x7E]/[a-zA-Z]/[a-zA-Z_0-9])* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment