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

Improve exception messages when a token is not found #73

Merged
merged 2 commits into from
Jan 9, 2019
Merged

Commits on Jan 9, 2019

  1. Improve exception messages when a token is not found

    In most cases, a full selector is parsed as a token, and if not, we
    report the character we are at as invalid. While better context is
    provided in exceptions for tokens that are fully parsed and validated,
    when we don't parse a token, very little is conveyed back to the user.
    There are only a few types of selectors allowed in CSS: tags, attr,
    class, id, pseudo-class, pseudo-elements, and combinators. You can have
    variations of these, but that is it.  We cover most of these cases
    already with decent context, but there are still a few case that are
    just reported as invalid characters. Moving forward, we will see if the
    invalid character represents the start of one of the basic, supported
    types. Only attr, class, id, and pseudo-(class|element) really fall into
    the category that would generate one of these ambiguous exceptions, so
    identify their starting character and raise an appropriate "malformed"
    selector exception.
    
    Also remove unnecessary "+" in PAT_PSEUDO_CLASS.
    facelessuser committed Jan 9, 2019
    Configuration menu
    Copy the full SHA
    d717d78 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    51c3abc View commit details
    Browse the repository at this point in the history