Simplify parser
Change-Id: I5ae560d7c984cf9899b908adc2dd645714114202
diff --git a/parser/title_parser.go b/parser/title_parser.go
index 839ff5a..87bd809 100644
--- a/parser/title_parser.go
+++ b/parser/title_parser.go
@@ -30,9 +30,9 @@
}
}
-// ParseTitleAttribute parses a single title attribute string
+// parseTitleAttribute parses a single title attribute string
// Expects format: "foundry/layer:key" or "foundry/layer:key[:=]value"
-func (p *TitleAttributeParser) ParseTitleAttribute(title string) (*TitleAttribute, error) {
+func (p *TitleAttributeParser) parseTitleAttribute(title string) (*TitleAttribute, error) {
if title == "" {
return nil, fmt.Errorf("empty title attribute")
}
@@ -63,7 +63,7 @@
terms := make([]ast.Node, 0) // Initialize as empty slice instead of nil
for _, title := range titles {
- attr, err := p.ParseTitleAttribute(title)
+ attr, err := p.parseTitleAttribute(title)
if err != nil {
return nil, fmt.Errorf("failed to parse title '%s': %w", title, err)
}
@@ -81,22 +81,3 @@
return terms, nil
}
-
-// ToAST converts a TitleAttribute to an AST Term node
-func (attr *TitleAttribute) ToAST() ast.Node {
- return &ast.Term{
- Foundry: attr.Foundry,
- Layer: attr.Layer,
- Key: attr.Key,
- Value: attr.Value,
- Match: ast.MatchEqual,
- }
-}
-
-// String returns a string representation of the title attribute
-func (attr *TitleAttribute) String() string {
- if attr.Value != "" {
- return fmt.Sprintf("%s/%s:%s=%s", attr.Foundry, attr.Layer, attr.Key, attr.Value)
- }
- return fmt.Sprintf("%s/%s:%s", attr.Foundry, attr.Layer, attr.Key)
-}