-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter predicate improvements #115
Conversation
basic-expr = exist-expr / paren-expr / (neg-op paren-expr) / relation-expr | ||
exist-expr = [neg-op] path ; path existence or non-existence | ||
path = rel-path / json-path | ||
rel-path = "@" *(dot-selector / index-selector) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we only supporting a single selector here, or does the *( ... )
mean multiple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*()
means zero or more repetitions of the contents of the brackets. See section 3.6 of RFC 5234.
comparable = number / string-literal / ; primitive ... | ||
true / false / null / ; values only | ||
path ; path value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious, are we planning on supporting literal complex values (i.e. object / arrays) at some point later? Maybe this needs more discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it needs more discussion, but let's defer such discussion for now to keep this PR nice and small.
draft-ietf-jsonpath-base.md
Outdated
|:--:|:--:|:--:| | ||
| 5 | Grouping | `(...)` | | ||
| 4 | Logical NOT | `!` | | ||
| 3 | Relations | `==`<br>`!=`<br>`<`<br>`>`<br>`<=`<br>`>=`<br>`=~`<br>` in ` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to have each operator on its own line? Seems like we could do with two or three per line. Just a readability question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. I've pushed a change which groups similar operators together on single lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I realise why this had one operator per line. Putting multiple on one line, separated by space or
results in operators being wrapped in double quotes in the rendered text version (although not the HTML), thus:
+============+===========+===================+
| Precedence | Operator | Syntax |
| | type | |
+============+===========+===================+
| 5 | Grouping | (...) |
+------------+-----------+-------------------+
| 4 | Logical | ! |
| | NOT | |
+------------+-----------+-------------------+
| 3 | Relations | "==" "!=" |
| | | "<" "<=" ">" ">=" |
| | | "=~" |
| | | "in" |
+------------+-----------+-------------------+
| 2 | Logical | && |
| | AND | |
+------------+-----------+-------------------+
| 1 | Logical | || |
| | OR | |
+------------+-----------+-------------------+
This is pretty ugly, so I'm going to revert to one operator per line until someone can suggest better markup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh! The double quotes are there in the text version even when there is only one operator per line. Given I can't remove the ugliness, switching back to the multiple operators per line version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cabo Do you know a way of avoiding these extraneous double quotes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extra quotes are added by xml2rfc, but I don't know why or how to avoid this. I posted to the xml2rfc mailing list about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it seems the extra quotes are caused by a bug which will be fixed in the upcoming release of xml2rfc. I propose to leave them be for now and pick up the new release of xml2rfc in due course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. Just some curiosity questions from me.
9e867b6
to
7b23a0a
Compare
* Generalise comparisons * Make regex operator conform to Perl etc. * Add operator precedence table Note: there are some extraneous double quotes in the text rendering of the operator precedence table. This is a known issue which should be fixed in the next release of xml2rfc: https://trac.ietf.org/trac/xml2rfc/ticket/600 Fixes #112 Fixes #113 Fixes #114
7b23a0a
to
48af814
Compare
* The behaviour of operators is consistent with the 'C'-family of programming languages.
<!-- need to clarify -->
I think having the precedence table now, above remark is obsolete.
… +The following table lists filter expression operators in order of precedence from highest to lowest.
+
+| Precedence | Operator type | Syntax |
+|:--:|:--:|:--:|
+| 5 | Grouping | `(...)` |
+| 4 | Logical NOT | `!` |
+| 3 | Relations | `==`<br>`!=`<br>`<`<br>`>`<br>`<=`<br>`>=`<br>`=~`<br>` in ` |
|
Fixes #112
Fixes #113
Fixes #114