Skip to content
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

Allow whitespace (or nothing) in the initial-value of @property with universal syntax #657

Merged
merged 6 commits into from
Jan 13, 2024

Commits on Jan 10, 2024

  1. Configuration menu
    Copy the full SHA
    97895ed View commit details
    Browse the repository at this point in the history
  2. include whitespace when parsing the syntax: '*' values

    I know that this isn't 100% correct because we _only_ want to do that
    for the `initial-value` property and not for everything.
    
    We also "abuse" the fact that `initial-value:;` results in an
    `EndOfInput` error and then we conver that to `Whitespace("")`.
    
    But the idea is as follows:
    Instead of skipping whitespace, allow it and even allow "nothing". If we
    skip whitespace, the current parser expects a valid token but there is
    none and therefore results in an `EndOfInput`.
    
    But in case of `initial-value: ;` or `initial-value:;` these values are
    allowed.
    
    Later, we can "ignore" all the whitespace, and only emit a single one
    (or nothing) for the `initial-value`.
    RobinMalfait committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    a8ebcf5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3db620d View commit details
    Browse the repository at this point in the history
  4. improve wording

    RobinMalfait committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    397ee28 View commit details
    Browse the repository at this point in the history

Commits on Jan 11, 2024

  1. move custom initial-value parsing to Property parser

    This is the better spot because now it is specific to the
    `initial-value` of an `@property` with Universal syntax.
    
    Used `is_exhausted` to know that we are "done" or not, it will skip
    whitespace so it will be true in both the `initial-value:;` and
    `initial-value: ;` case.
    
    Then we still use `parser.next_including_whitespace()` because we are
    still interested in the whitespace if there is some (in case of
    `initial-value: ;`). If there is no whitespace, then it results in an
    end of input error which we can convert to a `WhiteSpace("")` token.
    
    We do capture the error to default to an empty whitespace token, but we
    can capture _all_ errors safely because if _something_ was actually
    wrong, the wrapping `parser.is_exhausted()` would not have been ok and
    therefore false.
    RobinMalfait committed Jan 11, 2024
    Configuration menu
    Copy the full SHA
    f61531f View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2024

  1. Configuration menu
    Copy the full SHA
    803c631 View commit details
    Browse the repository at this point in the history