Simplify ast
diff --git a/ast/ast.go b/ast/ast.go
index 7159393..685483c 100644
--- a/ast/ast.go
+++ b/ast/ast.go
@@ -1,6 +1,6 @@
package ast
-// ast is the abstract syntax tree for the term mapper.
+// ast is the abstract syntax tree for the query term mapper.
import (
"encoding/json"
@@ -9,26 +9,20 @@
// NodeType represents the type of a node in the AST
type NodeType string
-const (
- TokenNode NodeType = "token"
- TermGroupNode NodeType = "termGroup"
- TermNode NodeType = "term"
-)
-
// RelationType represents the type of relation between nodes
type RelationType string
-const (
- AndRelation RelationType = "and"
- OrRelation RelationType = "or"
-)
-
// MatchType represents the type of match operation
type MatchType string
const (
- MatchEqual MatchType = "eq"
- MatchNotEqual MatchType = "ne"
+ TokenNode NodeType = "token"
+ TermGroupNode NodeType = "termGroup"
+ TermNode NodeType = "term"
+ AndRelation RelationType = "and"
+ OrRelation RelationType = "or"
+ MatchEqual MatchType = "eq"
+ MatchNotEqual MatchType = "ne"
)
// Node represents a node in the AST
@@ -36,7 +30,7 @@
Type() NodeType
}
-// Token represents a token node in the query
+// Token represents a koral:token
type Token struct {
Wrap Node `json:"wrap"`
}
@@ -45,7 +39,7 @@
return TokenNode
}
-// TermGroup represents a group of terms with a relation
+// TermGroup represents a koral:termGroup
type TermGroup struct {
Operands []Node `json:"operands"`
Relation RelationType `json:"relation"`
@@ -55,7 +49,7 @@
return TermGroupNode
}
-// Term represents a terminal node with matching criteria
+// Term represents a koral:term
type Term struct {
Foundry string `json:"foundry"`
Key string `json:"key"`