Previously, SimpleSelectors optionally had Attribute-selector data
as well as their main type. Now, they're either one or the other,
which better matches the spec, and makes parsing and matching more
straightforward.
Had to adjust some places that were using Token.to_string() for
non-debug-logging purposes. Changed its name to to_debug_string()
to make the usage clearer.
Whitespace marks the end of a compound-selector, no matter where
it occurs. `check_for_eof_or_whitespace()` reconsumes the whitespace
token for convenience.
The entry points for CSS parsing in the spec are defined as accepting
any of a stream of Tokens, or a stream of ComponentValues, or a String.
TokenStream is an attempt to reduce the duplication of code for that.
The end goal here is to make the two classes mostly interchangeable, as
the CSS spec requires that the various parser algorithms can take a
stream of either class, and we want to have that functionality without
needing to duplicate all of the code.
Rather than passing a ComponentType, and then manually modifying the
data fields, we now create them initialized.
The constructor that takes a Token is intentionally left implicit,
so that we can automatically convert when using the TokenStream later.
AtStyleRule being a subclass of QualifiedStyleRule was causing
problems when trying to distinguish between them. Combining them
and then distinguishing between them with a Type enum makes that
check simpler, and is in line with how similar checks are done
elsewhere in the parser.
The new one is the same as the old one, just in the new Parser's
source files. This isn't the most elegant solution but it seemed
like the best option. And it's all temporary, after all.
Previous implementation was returning everything in a single Vector,
when what we really want is a Vector of Vectors, one for each comma-
separated part of the list.
This is very much stubbed out for now. Most notably is
Parser::convert_rule() where most of the conversion will happen
from the parser's internal rule classes to CSSRule and its children.
Noticed while doing this that attribute selectors have two different
ways of saying "starts with", and so AttributeMatchType::StartsWith
needs a better name. But I'll change that when I add the missing
types.
These class names are a mouthful to fit in a commit message. :^)
Previously these were all passed around by value, but some of them
(StyleComponentValueRule and StyleBlockRule) want to include each
other as fields, so this had to change.
Adds support for the :active pseudo-class for hyperlinks (<a> tags
only).
Also, since it was very similar to :focus and an element having a
focused state was already implemented, I went ahead and implemented
that pseudo-class too, although I cannot come up with a working
example to validate it.
We had some inconsistencies before:
- Sometimes "The", sometimes "the"
- Sometimes trailing ".", sometimes no trailing "."
I picked the most common one (lowecase "the", trailing ".") and applied
it to all copyright headers.
By using the exact same string everywhere we can ensure nothing gets
missed during a global search (and replace), and that these
inconsistencies are not spread any further (as copyright headers are
commonly copied to new files).
SPDX License Identifiers are a more compact / standardized
way of representing file license information.
See: https://spdx.dev/resources/use/#identifiers
This was done with the `ambr` search and replace tool.
ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *