mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-17 00:38:59 +00:00
Iterfaces generation refacto
Signed-off-by: Francis Bouvier <francis.bouvier@gmail.com>
This commit is contained in:
@@ -12,6 +12,13 @@ const Comment = @import("comment.zig").Comment;
|
||||
const Text = @import("text.zig").Text;
|
||||
const HTMLElem = @import("../html/elements.zig");
|
||||
|
||||
// CharacterData interfaces
|
||||
pub const Interfaces = generate.Tuple(.{
|
||||
Comment,
|
||||
Text,
|
||||
});
|
||||
|
||||
// CharacterData implementation
|
||||
pub const CharacterData = struct {
|
||||
pub const Self = parser.CharacterData;
|
||||
pub const prototype = *Node;
|
||||
@@ -76,14 +83,6 @@ pub const CharacterData = struct {
|
||||
}
|
||||
};
|
||||
|
||||
pub const Types = generate.Tuple(.{
|
||||
Comment,
|
||||
Text,
|
||||
});
|
||||
const Generated = generate.Union.compile(Types);
|
||||
pub const Union = Generated._union;
|
||||
pub const Tags = Generated._enum;
|
||||
|
||||
// Tests
|
||||
// -----
|
||||
|
||||
|
||||
@@ -8,10 +8,30 @@ const generate = @import("../generate.zig");
|
||||
const parser = @import("../netsurf.zig");
|
||||
|
||||
const EventTarget = @import("event_target.zig").EventTarget;
|
||||
|
||||
// DOM
|
||||
const CData = @import("character_data.zig");
|
||||
const HTMLDocument = @import("../html/document.zig").HTMLDocument;
|
||||
const Element = @import("element.zig").Element;
|
||||
const Document = @import("document.zig").Document;
|
||||
|
||||
// HTML
|
||||
const HTML = @import("../html/html.zig");
|
||||
const HTMLElem = @import("../html/elements.zig");
|
||||
|
||||
// Node interfaces
|
||||
pub const Interfaces = generate.Tuple(.{
|
||||
CData.CharacterData,
|
||||
CData.Interfaces,
|
||||
Element,
|
||||
Document,
|
||||
|
||||
HTML.Interfaces,
|
||||
});
|
||||
const Generated = generate.Union.compile(Interfaces);
|
||||
pub const Union = Generated._union;
|
||||
pub const Tags = Generated._enum;
|
||||
|
||||
// Node implementation
|
||||
pub const Node = struct {
|
||||
pub const Self = parser.Node;
|
||||
pub const prototype = *EventTarget;
|
||||
@@ -207,15 +227,6 @@ pub const Node = struct {
|
||||
}
|
||||
};
|
||||
|
||||
pub const Types = generate.Tuple(.{
|
||||
CData.Types,
|
||||
HTMLElem.Types,
|
||||
HTMLDocument,
|
||||
});
|
||||
const Generated = generate.Union.compile(Types);
|
||||
pub const Union = Generated._union;
|
||||
pub const Tags = Generated._enum;
|
||||
|
||||
// Tests
|
||||
// -----
|
||||
|
||||
|
||||
Reference in New Issue
Block a user