-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Compiletest: Simplify {Html,Json}DocCk directive handling #143850
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
base: master
Are you sure you want to change the base?
Conversation
The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes. cc @BoxyUwU, @jieyouxu, @Kobzol, @tshepang Some changes occurred in src/tools/compiletest cc @jieyouxu |
if args and not args[:1].isspace(): | ||
print_err(lineno, line, "Invalid template syntax") | ||
continue |
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.
In a roundabout way this used to check that the separator between the directive and its args was a space because the capture group args
used to immediately follow the directive name.
This comment has been minimized.
This comment has been minimized.
src/etc/htmldocck.py
Outdated
LINE_PATTERN = re.compile( | ||
r""" | ||
//@\s+ | ||
(?P<negated>!?)(?P<cmd>[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*) | ||
(?P<negated>!?)(?P<cmd>.+?) | ||
[\s:] |
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 basically had to extend the grammar of {Html,Json}DocCk directives to admit :
as a legal separator besides whitespace.
Otherwise it would've either been included in the args if I hadn't relaxed cmd
's grammar (so //@ has: ...
would've meant [has
, : ...
]) which would've lead to bad diagnostics down the line like "unexpected argument" (because : ...
would've been further split into [:
, ...
] by shlex) or it would've been accepted by compiletest but rejected ignored by HtmlDocCk (remember, we can't reject any unknown or malformed directive in HtmlDocCk since it no longer knows if it's a compiletest directive or not).
Disregarding the technical reasons, {Html,Json}DocCk directives should be extensions to regular compiletest directives, so it only makes sense that :
is allowed as a separator.
c9870d8
to
48c3962
Compare
48c3962
to
60471e3
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
4d6875e
to
1be2c85
Compare
1be2c85
to
917171a
Compare
So much more maintainable and extensible.
r? @jieyouxu as discussed