aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2025-07-30 02:08:18 +0200
committerThomas Voss <mail@thomasvoss.com> 2025-07-30 02:08:18 +0200
commitba65ab8962d4b2fe7be595231a9d28e89348fa42 (patch)
treea5069cd9b8b4b36b0e9f723e1a09fe9f4f289f33 /cmd
parent616e22ddccd177fc1ec88bcf59ad0b27b73df5ee (diff)
Catch more extraction edge-cases
Diffstat (limited to 'cmd')
-rw-r--r--cmd/exttmpl/main.go24
1 files changed, 21 insertions, 3 deletions
diff --git a/cmd/exttmpl/main.go b/cmd/exttmpl/main.go
index 9017ab8..7a7891f 100644
--- a/cmd/exttmpl/main.go
+++ b/cmd/exttmpl/main.go
@@ -162,18 +162,35 @@ func processNode(node parse.Node) {
case *parse.WithNode:
processBranch(n.BranchNode)
case *parse.ActionNode:
- for _, cmd := range n.Pipe.Cmds {
+ processNode(n.Pipe)
+ case *parse.PipeNode:
+ for _, cmd := range n.Cmds {
if len(cmd.Args) == 0 {
continue
}
+ var funcname string
f, ok := cmd.Args[0].(*parse.FieldNode)
if !ok || len(f.Ident) == 0 {
- continue
+ ff, ok := cmd.Args[0].(*parse.VariableNode)
+ if !ok || len(ff.Ident) == 0 {
+ fff, ok := cmd.Args[0].(*parse.IdentifierNode)
+ if !ok {
+ continue
+ }
+ funcname = fff.Ident
+ } else {
+ funcname = ff.Ident[len(ff.Ident)-1]
+ }
+ } else {
+ funcname = f.Ident[len(f.Ident)-1]
}
- cfg, ok := configs[f.Ident[len(f.Ident)-1]]
+ cfg, ok := configs[funcname]
if !ok {
+ for _, pipe := range cmd.Args {
+ processNode(pipe)
+ }
continue
}
@@ -184,6 +201,7 @@ func processNode(node parse.Node) {
if sn, ok := cmd.Args[cfg.arg].(*parse.StringNode); ok {
tl.msgid = sn.Text
+ /* println(sn.Text) */
linenr = getlinenr(sn.Pos.Position())
} else {
continue