mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 22:52:22 +02:00
test-css-tokenizer is updated to run both the C++ and Rust tokenizers and compare their output, to ensure they behave identically. The Parser still uses the C++ Tokenizer. The LibWeb crate, FFI layer etc are all based on the existing ones for other libraries. This is a direct AI translation to get us started, and not idiomatic Rust. Future work can be done to make it more sensible.
31 lines
498 B
C++
31 lines
498 B
C++
/*
|
|
* Copyright (c) 2026, the Ladybird developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/StringView.h>
|
|
#include <AK/Vector.h>
|
|
#include <LibWeb/CSS/Parser/Token.h>
|
|
#include <LibWeb/Export.h>
|
|
|
|
namespace Web::CSS::Parser::FFI {
|
|
|
|
struct CssToken;
|
|
|
|
}
|
|
|
|
namespace Web::CSS::Parser {
|
|
|
|
class WEB_API RustTokenizer {
|
|
public:
|
|
static Vector<Token> tokenize(StringView input, StringView encoding);
|
|
|
|
private:
|
|
static Token token_from_ffi(FFI::CssToken const&);
|
|
};
|
|
|
|
}
|