Add support keeping rewrites
diff --git a/ast/ast.go b/ast/ast.go
index 685483c..07a6df1 100644
--- a/ast/ast.go
+++ b/ast/ast.go
@@ -19,6 +19,7 @@
 	TokenNode     NodeType     = "token"
 	TermGroupNode NodeType     = "termGroup"
 	TermNode      NodeType     = "term"
+	RewriteNode   NodeType     = "rewrite"
 	AndRelation   RelationType = "and"
 	OrRelation    RelationType = "or"
 	MatchEqual    MatchType    = "eq"
@@ -30,9 +31,23 @@
 	Type() NodeType
 }
 
+// Rewrite represents a koral:rewrite
+type Rewrite struct {
+	Editor    string `json:"editor,omitempty"`
+	Operation string `json:"operation,omitempty"`
+	Scope     string `json:"scope,omitempty"`
+	Src       string `json:"src,omitempty"`
+	Comment   string `json:"_comment,omitempty"`
+}
+
+func (r *Rewrite) Type() NodeType {
+	return RewriteNode
+}
+
 // Token represents a koral:token
 type Token struct {
-	Wrap Node `json:"wrap"`
+	Wrap     Node      `json:"wrap"`
+	Rewrites []Rewrite `json:"rewrites,omitempty"`
 }
 
 func (t *Token) Type() NodeType {
@@ -43,6 +58,7 @@
 type TermGroup struct {
 	Operands []Node       `json:"operands"`
 	Relation RelationType `json:"relation"`
+	Rewrites []Rewrite    `json:"rewrites,omitempty"`
 }
 
 func (tg *TermGroup) Type() NodeType {
@@ -51,11 +67,12 @@
 
 // Term represents a koral:term
 type Term struct {
-	Foundry string    `json:"foundry"`
-	Key     string    `json:"key"`
-	Layer   string    `json:"layer"`
-	Match   MatchType `json:"match"`
-	Value   string    `json:"value,omitempty"`
+	Foundry  string    `json:"foundry"`
+	Key      string    `json:"key"`
+	Layer    string    `json:"layer"`
+	Match    MatchType `json:"match"`
+	Value    string    `json:"value,omitempty"`
+	Rewrites []Rewrite `json:"rewrites,omitempty"`
 }
 
 func (t *Term) Type() NodeType {