Skip to content

Instantly share code, notes, and snippets.

@s3u
Created December 25, 2011 01:54
Show Gist options
  • Save s3u/1518617 to your computer and use it in GitHub Desktop.
Save s3u/1518617 to your computer and use it in GitHub Desktop.
JSONPath
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