Commit Graph

31 Commits

Author SHA1 Message Date
Sam Atkins
f242bee7f3 Meta: Replace GenerateNamedCharacterReferences with a python generator
This is a direct conversion, and produces the same output.
2026-04-29 17:28:09 +01:00
Sam Atkins
7a7b838ed5 Meta: Replace GenerateAriaRoles with a python generator
This is a direct conversion, and produces the same output.
2026-04-29 17:28:09 +01:00
Shannon Booth
6cd7425a4b Meta: Port GenerateWindowOrWorkerInterfaces to Python
This replaces the C++ GenerateWindowOrWorkerInterfaces generator with a
python3 port.

The generator uses the new python WebIDL parser and writes directly to a
TextIO instance instead of porting SourceGenerator.

For validation, the python generator was diffed against the existing C++
generator over the full LibWeb IDL input set. The generated output is
behaviorally identical, and the only changes are whitespace changes
(all improvements).
2026-04-29 12:24:00 +01:00
Shannon Booth
4a9deb3afa Meta: Combine Lexer's consume_specific_char and consume_specific_string
consume_specific_string() already handles 1-character strings correctly.
2026-04-29 12:24:00 +01:00
Callum Law
44ad7e30b4 LibWeb: Generate <symbol> parsing 2026-04-29 11:42:57 +01:00
Callum Law
09418e8c77 Meta: Implement CSS value type parsing code generation
To do this we parse the grammar supplied in `ValueTypes.json` and
generate the appropriate parsing function in `CSS::Parser::Parser`

Only a small subset of the CSS grammar (i.e. types `<foo>` and
alternatives `<foo> | <bar>`) is implemented so far, it will be
expanded in later commits.
2026-04-29 11:42:57 +01:00
Callum Law
8849435d6f Meta+LibWeb: Initial scaffolding for CSS value type parsing code gen
In the future we should switch to using a better file format for this,
i.e. one that supports directly pasting CSS grammar production blocks
(https://drafts.csswg.org/css-values-4/#css-grammar-production-block)
and has support for inline comments, but we use JSON for now for
simplicity's sake.
2026-04-29 11:42:57 +01:00
Sam Atkins
2ed3868012 Meta: Replace GenerateCSSPropertyID with a python generator
We don't match the C++ output byte-for-byte here, because the key
iteration order is different. So I've taken the opportunity to tidy up
some whitespace too.
2026-04-25 12:02:49 +02:00
Sam Atkins
3580e2506c Meta: Replace GenerateCSSStyleProperties with a python generator 2026-04-25 12:02:49 +02:00
Sam Atkins
d3d124b1d8 Meta: Replace GenerateCSSNumericFactoryMethods with a python generator
Adds a new `invoke_py_idl_generator` CMake helper for python scripts
that also produce an IDL file.
2026-04-25 12:02:49 +02:00
Sam Atkins
399341c3de Meta: Replace GenerateCSSPseudoElement with a python generator 2026-04-25 12:02:49 +02:00
Sam Atkins
353846fe79 Meta: Replace GenerateCSSMathFunctions with a python generator 2026-04-25 12:02:49 +02:00
Sam Atkins
143f1bc34d Meta: Replace GenerateCSSDescriptors with a python generator 2026-04-25 12:02:49 +02:00
Sam Atkins
5fbf6f6801 Meta: Replace GenerateCSSUnits with a python generator 2026-04-25 12:02:49 +02:00
Sam Atkins
f2ead8b520 Meta: Replace GenerateCSSMediaFeatureID with a python generator 2026-04-25 12:02:49 +02:00
Sam Atkins
91022151d6 Meta: Replace GenerateCSSPseudoClass with a python generator 2026-04-25 12:02:49 +02:00
Sam Atkins
f7898d2c8b Meta: Replace GenerateCSSTransformFunctions with a python generator 2026-04-25 12:02:49 +02:00
Sam Atkins
f9dc467cae Meta: Replace GenerateCSSKeyword with a python generator 2026-04-25 12:02:49 +02:00
Sam Atkins
f6a3ff388b Meta: Replace GenerateCSSEnvironmentVariable with a python generator 2026-04-25 12:02:49 +02:00
Sam Atkins
4de5f3056b Meta: Replace GenerateCSSEnums with a python generator 2026-04-25 12:02:49 +02:00
Timothy Flynn
ce7b69ff31 Meta: Move utility scripts to a subfolder
The idea is that scripts directly under Meta are meant to be run by
people. Scripts that are only imported or run by other scripts are
moved to a subdirectory.
2026-04-23 12:36:08 -04:00
Timothy Flynn
cfa24d3367 LibIPC: Return a StringView for IPC message names 2026-04-23 09:42:07 -04:00
Timothy Flynn
373db4e157 LibIPC: Inline some generated if statements / function calls 2026-04-23 09:42:07 -04:00
Timothy Flynn
90d53c0d12 LibIPC: Generate zero-argument IPC message handlers with less code 2026-04-23 09:42:07 -04:00
Timothy Flynn
e9515a3109 LibIPC: Use snake cased message names for IPC message handlers 2026-04-23 09:42:07 -04:00
Timothy Flynn
6567b71573 LibIPC: Format constructors to be more readable 2026-04-23 09:42:07 -04:00
Timothy Flynn
fff7598ea9 LibIPC: Remove needless virtual destructor overrides 2026-04-23 09:42:07 -04:00
Timothy Flynn
899de41e04 LibIPC: Remove some superfluous whitespace from generated IPC defintions 2026-04-23 09:42:07 -04:00
Timothy Flynn
464a3296b9 LibIPC: Bump opening braces for functions to a new line 2026-04-23 09:42:07 -04:00
Timothy Flynn
922b811279 Meta: Replace IPCCompiler with a python generator
This replaces the C++ IPC compiler and generator with a python3 port.

For validation, the parser is nearly a line-for-line port of the C++
parser. This patch includes lexer.py, which is a simple port of our
GenericLexer, as the mechanics actually felt pretty nice in python as
well.

The code generator does not include a port of our SourceGenerator, as
that felt less nice. Instead, we write directly to a TextIO instance.
The generated output is almost byte-for-byte identical with our C++
generator, with trivial whitespace differences:

* The C++ generator included extraneous newlines before and after all
  switch statements, which is not kept here.
* The C++ generator did not include newlines between message handling
  functions, which we now do.
* The C++ generator had some extraneous spaces at the end of some lines,
  and incorrect tabbing (3 spaces) at the beginning of some lines.
2026-04-23 07:31:19 -04:00
Timothy Flynn
5c34c7f554 Meta: Move python code generators to a subdirectory
Let's have a bit of organization here, rather than an ever-growing Meta
folder.
2026-04-23 07:31:19 -04:00