ladybird/Userland/Libraries/LibWeb/CSS/Parser
Sam Atkins b645e26e9b LibWeb/CSS: Bring TokenStream in line with spec
When the TokenStream code was originally written, there was no such
concept in the CSS Syntax spec. But since then, it's been officially
added, (https://drafts.csswg.org/css-syntax/#css-token-stream) and the
parsing algorithms are described in terms of it. This patch brings our
implementation in line with the spec. A few deprecated TokenStream
methods are left around until their users are also updated to match the
newer spec.

There are a few differences:

- They name things differently. The main confusing one is we had
  `next_token()` which consumed a token and returned it, but the spec
  has a `next_token()` which peeks the next token. The spec names are
  honestly better than what I'd come up with. (`discard_a_token()` is a
  nice addition too!)

- We used to store the index of the token that was just consumed, and
  they instead store the index of the token that will be consumed next.
  This is a perfect breeding ground for off-by-one errors, so I've
  finally added a test suite for TokenStream itself.

- We use a transaction system for rewinding, and the spec uses a stack
  of "marks", which can be manually rewound to. These should be able to
  coexist as long as we stick with marks in the parser spec algorithms,
  and stick with transactions elsewhere.
2024-10-09 17:29:29 +01:00
..
Block.cpp LibWeb: Make serializing CSS Parser types infallible 2023-08-22 17:51:48 +01:00
Block.h LibWeb: Make serializing CSS Parser types infallible 2023-08-22 17:51:48 +01:00
ComponentValue.cpp LibWeb: Add ComponentValue::is_function(name) and is_ident(name) helpers 2023-09-11 17:03:22 +01:00
ComponentValue.h Meta: Update my e-mail address everywhere 2024-10-04 13:19:50 +02:00
Declaration.cpp LibWeb: Make serializing CSS Parser types infallible 2023-08-22 17:51:48 +01:00
Declaration.h LibWeb: Port custom properties to FlyString 2023-11-07 11:33:41 +01:00
DeclarationOrAtRule.cpp LibWeb: Port CSS::Parser::Rule to new Strings 2023-02-15 12:48:26 -05:00
DeclarationOrAtRule.h LibWeb: Port CSS::Parser::Rule to new Strings 2023-02-15 12:48:26 -05:00
Dimension.h LibWeb: Implement Flex and FlexStyleValue types 2023-09-28 20:33:20 +01:00
Function.cpp LibWeb: Stop adding extra whitespace when serializing CSS Functions 2023-09-20 18:29:37 +02:00
Function.h LibWeb: Expose Parser::Function name as FlyString const& 2023-09-05 14:27:23 +02:00
GradientParsing.cpp LibWeb/CSS: Bring TokenStream in line with spec 2024-10-09 17:29:29 +01:00
Helpers.cpp Meta: Update my e-mail address everywhere 2024-10-04 13:19:50 +02:00
MediaParsing.cpp LibWeb/CSS: Bring TokenStream in line with spec 2024-10-09 17:29:29 +01:00
Parser.cpp LibWeb/CSS: Bring TokenStream in line with spec 2024-10-09 17:29:29 +01:00
Parser.h LibWeb/CSS: Parse and propagate font-feature-settings property 2024-10-02 16:28:55 +01:00
ParsingContext.cpp Meta: Update my e-mail address everywhere 2024-10-04 13:19:50 +02:00
ParsingContext.h LibWeb: Add CSS ParsingContext constructor with a realm and URL 2024-05-16 08:02:43 +02:00
Rule.cpp LibWeb: Port CSS::Parser::Rule to new Strings 2023-02-15 12:48:26 -05:00
Rule.h LibWeb: Port CSS::Parser::Rule to new Strings 2023-02-15 12:48:26 -05:00
SelectorParsing.cpp LibWeb/CSS: Bring TokenStream in line with spec 2024-10-09 17:29:29 +01:00
Token.cpp LibWeb: Make serializing CSS Parser types infallible 2023-08-22 17:51:48 +01:00
Token.h LibWeb: Use code_points helper for getting delim CSS token codepoint 2023-12-11 16:54:59 +01:00
Tokenizer.cpp LibWeb/CSS: Remove tiny-oom propagation from CSS Tokenizer 2024-07-26 17:29:20 +02:00
Tokenizer.h LibWeb/CSS: Remove tiny-oom propagation from CSS Tokenizer 2024-07-26 17:29:20 +02:00
TokenStream.h LibWeb/CSS: Bring TokenStream in line with spec 2024-10-09 17:29:29 +01:00