-
Notifications
You must be signed in to change notification settings - Fork 280
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
Support media queries binary logical operator syntax in platform expressions #267
Support media queries binary logical operator syntax in platform expressions #267
Conversation
src/vcpkg/platform-expression.cpp
Outdated
@@ -139,26 +142,114 @@ namespace vcpkg::PlatformExpression | |||
// platform-expression = | |||
// | platform-expression-not | |||
// | platform-expression-and | |||
// | platform-expression-or ; | |||
// | platform-expression-or | |||
// | platform-expression-low-precedence-or ; |
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.
We need to write the real syntax; this isn't fully correct.
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.
(probably in vcpkg)
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.
Thanks. I will incorporate your suggested changes (in vcpkg) and update this code.
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.
thanks mark!
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.
after a few iterations, proposed EBNF update is posted, additional tests added and comments updated
…those checks as unnecessary
…ators; parens are valid non-whitespace breaks that delimit operator keywords
|
||
m_expr = parse_expr("notANY windows"); | ||
CHECK_FALSE(m_expr); | ||
m_expr = parse_expr("not! windows"); |
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.
Why is this one invalid? Shouldn't this parse as !!windows
?
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.
That's a good question. At first glance, one would expect not! windows
to be the same as !!windows
and evaluate to windows. But the code currently fails to part both of those expressions. It also doesn't appear to be a valid parse according to the EBNF.
So I think you're right and this should be valid, but we'll need to update the grammar when we do.
This change implements support in platform expressions for binary logical operators (and, or) as defined by Media Queries.
We are extending current platform expressions as follows:
The existing platform expression parser:
To support the media queries syntax, the following changes have been made:
Implementation details:
implemented as 'plaform_expression_not | platform_expression_not'