aboutsummaryrefslogtreecommitdiff
path: root/internal/config/dir.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-16 01:02:33 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-16 01:02:33 +0200
commitbe4b1275c76b9cad984dfafaa8023db94eb3eecf (patch)
tree2a4db9266515d65f313bc26fb0ee5db14625b736 /internal/config/dir.go
parent40ecbfae85c4c76a8ed944a91f8c000b4ec55fc5 (diff)
downloadkrino-be4b1275c76b9cad984dfafaa8023db94eb3eecf.tar.gz
krino-be4b1275c76b9cad984dfafaa8023db94eb3eecf.zip
config prints and splices one form
Diffstat (limited to 'internal/config/dir.go')
-rw-r--r--internal/config/dir.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/config/dir.go b/internal/config/dir.go
index 54ee35e..b82a0b3 100644
--- a/internal/config/dir.go
+++ b/internal/config/dir.go
@@ -28,6 +28,7 @@ type Dir struct {
// excluded when any one form matches it.
type Exclude struct {
Pos sexp.Pos
+ End sexp.Pos // just past the form's closing paren, for Splice
Text string // the form as written, whitespace collapsed, for check and explain
When []*sexp.Node // the conditions, all of which must hold
}
@@ -51,13 +52,14 @@ func parseExclude(n *sexp.Node, src []byte, d *diags) *Exclude {
return nil
}
text := strings.Join(strings.Fields(string(src[n.Pos.Offset:n.End.Offset])), " ")
- return &Exclude{Pos: n.Pos, Text: text, When: conds}
+ return &Exclude{Pos: n.Pos, End: n.End, Text: text, When: conds}
}
// Rule is a named condition with the actions it performs.
type Rule struct {
Name string
Pos sexp.Pos
+ End sexp.Pos // just past the form's closing paren, for Splice
When []*sexp.Node // the conditions, all of which must hold
HasWhen bool // false: the rule matches every file
Settings Settings // only case, fold and on-conflict
@@ -188,7 +190,7 @@ func parseRule(n *sexp.Node, d *diags) *Rule {
d.at(n, `rule names cannot start with "(": (review) marks choices made in review`)
return nil
}
- r := &Rule{Name: args[0].Text, Pos: n.Pos}
+ r := &Rule{Name: args[0].Text, Pos: n.Pos, End: n.End}
seen := map[string]*sexp.Node{}
var whenNode *sexp.Node
triedAction, deleted := false, false