From 5dc04d29d9e6247f43c97ca339e43f3e810b76f3 Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L de Mello" Date: Fri, 16 May 2025 15:08:06 -0300 Subject: [PATCH] feat(ast): create Element interface --- ipub/ast/ast.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 ipub/ast/ast.go diff --git a/ipub/ast/ast.go b/ipub/ast/ast.go new file mode 100644 index 0000000..9faefbc --- /dev/null +++ b/ipub/ast/ast.go @@ -0,0 +1,37 @@ +package ast + +import ( + "encoding/xml" + "fmt" + "io" + "slices" +) + +type Element interface { + Kind() ElementKind + + NextSibling() Element + SetNextSibling(Element) + + PreviousSibling() Element + SetPreviousSibling(Element) + + Parent() Element + SetParent(Element) + + HasChildren() bool + ChildCount() uint + + FirstChild() Element + LastChild() Element + + AppendChild(self, v Element) + RemoveChild(self, v Element) + + RemoveChildren(self Element) + ReplaceChild(self, v1, insertee Element) + + InsertBefore(self, v1, insertee Element) + InsertAfter(self, v1, insertee Element) + +}