Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add regular expression for page ranges #476
Add regular expression for page ranges #476
Changes from all commits
69580e7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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, I'm nervous about introducing regex into the spec, because I suspect in practice there are enough differences between dialects that they are likely to lead to interop problems.
In particular the regexp above is wrong per spec (though probably works OK in a js implementation) because CDDL specifies that it follows https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#regexs. That implicitly anchors expressions, so
^
and$
match literals rather than start/end of the string. I also don't think it has capture groups, so I'm not sure what?:
would actually do (I think the:
would match itself, but the?
might be a syntax error? Not sure; I've literally never looked at this spec before).Given that, I think we'd either have to intentionally violate the CDDL spec and pick a different syntax (e.g. ECMAScript, although that itself might not work for code generation in languages with different regex implementations e.g. Go or Rust), or use the XSD format and rely on everyone implementing a conversion into an actual implemented regex syntax. Or just not use regex and avoid the entire problem, at the cost of having to write a bit of extra code whenever there's string parsing. Which is hopefully "almost never", since we can generally choose to use structured data instead.
So I think my preference is to drop this PR.
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'd be in favor of the universal minimal syntax. Based on the XSD, it looks like that format is the minimal.
That said, how about we change page ranges to use
(* [js-uint,js-uint] | js-uint)
? I think we can avoid this all together if we just allowed 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.
The string possibility comes from webdriver classic: https://w3c.github.io/webdriver/#print
I believe we need to be permissive in order to keep compatibility with it, otherwise it would be a regression/downgrade.
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.
(* [js-uint,js-uint] | js-uint)
would also be wrong because one can omit the ends of the range. So we'd have to allownull
in either the first or second position, but not both. I don't think this would be incompatible with the goal of having classic be implementable on top of BiDi, but it would add some complexity. The main argument against using the fully array-based syntax is that it's trickier to write by hand (and less like what you write in the print dialog).