Move how the template language is written into internal/grammar

This commit is contained in:
2026-10-05 12:11:36 +02:00
committed by Lillem4n
parent 41292f9d89
commit c2f2e86735
21 changed files with 903 additions and 853 deletions
+3 -2
View File
@@ -10,6 +10,7 @@ import (
"strings"
"github.com/larvit/fejkdata/internal/drawstate"
"github.com/larvit/fejkdata/internal/grammar"
)
// FakeStruct fills the struct v points to. Each exported field tagged `fake:"…"` is a
@@ -222,14 +223,14 @@ func tagValue(sf reflect.StructField, tag string) (any, error) {
if err := checkTaggedType(sf); err != nil {
return nil, err
}
inline, err := isTemplate(tag)
inline, err := grammar.IsTemplate(tag)
switch {
case err != nil:
return nil, err
case inline:
return inputValue(tag)
}
if err := checkPathNames(tag); err != nil {
if err := grammar.CheckPathNames(tag); err != nil {
return nil, err
}
return "{/" + tag + "}", nil