Load whatever is well-formed and means one thing: ignore a part with no effect, print a constant sample, render any JSON value, draw no weight-0 item, and let a name, a rows file, a struct or a CLI flag go unused

This commit is contained in:
2026-10-07 23:39:59 +02:00
committed by Lillem4n
parent 052a52fc7a
commit ee236d7955
14 changed files with 165 additions and 213 deletions
+3 -3
View File
@@ -1,9 +1,9 @@
package fejkdata
import (
"encoding/json"
"fmt"
"github.com/larvit/fejkdata/internal/datafiles"
"github.com/larvit/fejkdata/internal/grammar"
)
@@ -71,8 +71,8 @@ func compileInput(input string) (node, error) {
// inputValue reads an inline template as the value compile takes: the JSON value it holds, the
// whitespace around it dropped, or the input itself as a format string when it is not JSON.
func inputValue(input string) any {
var raw any
if err := json.Unmarshal([]byte(input), &raw); err != nil {
raw, err := datafiles.DecodeJSON([]byte(input))
if err != nil {
return input
}
return raw