| 1 | // Copyright (c) Bartłomiej Płotka @bwplotka |
| 2 | // Licensed under the Apache License 2.0. |
| 3 | |
| 4 | package makefilescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/ |
| 5 | |
| 6 | import ( |
| 7 | "ioscip-go gomod github.com/golang/go/src go1.24.9 io/" |
| 8 | "osscip-go gomod github.com/golang/go/src go1.24.9 os/" |
| 9 | "path/filepathscip-go gomod github.com/golang/go/src go1.24.9 `path/filepath`/" |
| 10 | "stringsscip-go gomod github.com/golang/go/src go1.24.9 strings/" |
| 11 | |
| 12 | "github.com/efficientgo/core/errorsscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/errors`/" |
| 13 | ) |
| 14 | |
| 15 | // Copied from https://github.com/tj/mmake/blob/b15229aac1a8ea3f0875f064a0864f7250bd7850/parser & improved. |
| 16 | |
| 17 | // Node interface. |
| 18 | type Nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Node# interface { |
| 19 | Linesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Node#Lines.() []int |
| 20 | } |
| 21 | |
| 22 | type nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/node# struct { |
| 23 | linesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/node#lines. []int |
| 24 | } |
| 25 | |
| 26 | func (n nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/node#) Linesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/node#Lines().() []int { |
| 27 | return n.linesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/node#lines. |
| 28 | } |
| 29 | |
| 30 | // Comment node. |
| 31 | type Commentscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment# struct { |
| 32 | nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#node. |
| 33 | |
| 34 | Targetscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#Target. string |
| 35 | Valuescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#Value. string |
| 36 | Defaultscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#Default. bool |
| 37 | } |
| 38 | |
| 39 | // Include node. |
| 40 | type Includescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Include# struct { |
| 41 | nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Include#node. |
| 42 | |
| 43 | Valuescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Include#Value. string |
| 44 | } |
| 45 | |
| 46 | // Parser is a quick-n-dirty Makefile "parser", not |
| 47 | // really, just comments and a few directives, but |
| 48 | // you'll forgive me. |
| 49 | type Parserscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser# struct { |
| 50 | iscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#i. int |
| 51 | linesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#lines. []string |
| 52 | nodeBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodeBuf. nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/node# |
| 53 | commentBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#commentBuf. []string |
| 54 | targetscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#target. string |
| 55 | nodesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodes. []Nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Node# |
| 56 | } |
| 57 | |
| 58 | // Parse the given input reader. |
| 59 | // TODO(bwplotka): Streaming version would be nice. |
| 60 | func (p *Parserscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#) Parsescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#Parse().(r ioscip-go gomod github.com/golang/go/src go1.24.9 io/.Readerscip-go gomod github.com/golang/go/src go1.24.9 io/Reader#) ([]Nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Node#, error) { |
| 61 | b, err := ioscip-go gomod github.com/golang/go/src go1.24.9 io/.ReadAllscip-go gomod github.com/golang/go/src go1.24.9 io/ReadAll().(r) |
| 62 | if err != nil { |
| 63 | return nil, errorsscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/errors`/.Wrapscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/errors`/Wrap().(err, "reading") |
| 64 | } |
| 65 | |
| 66 | p.linesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#lines. = stringsscip-go gomod github.com/golang/go/src go1.24.9 strings/.Splitscip-go gomod github.com/golang/go/src go1.24.9 strings/Split().(string(b), "\n") |
| 67 | |
| 68 | if err := p.parsescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#parse().(); err != nil { |
| 69 | return nil, errorsscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/errors`/.Wrapscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/errors`/Wrap().(err, "parsing") |
| 70 | } |
| 71 | |
| 72 | return p.nodesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodes., nil |
| 73 | } |
| 74 | |
| 75 | // Peek at the next line. |
| 76 | func (p *Parserscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#) peekscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#peek().() string { |
| 77 | return p.linesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#lines.[p.iscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#i.] |
| 78 | } |
| 79 | |
| 80 | // Advance the next line. |
| 81 | func (p *Parserscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#) advancescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#advance().() string { |
| 82 | s := p.linesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#lines.[p.iscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#i.] |
| 83 | p.iscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#i.++ |
| 84 | return s |
| 85 | } |
| 86 | |
| 87 | // Buffer comment. |
| 88 | func (p *Parserscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#) bufferCommentscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#bufferComment().() { |
| 89 | s := p.advancescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#advance().()[1:] |
| 90 | |
| 91 | if len(s) > 0 { |
| 92 | if s[0] == '-' { |
| 93 | return |
| 94 | } |
| 95 | |
| 96 | // leading space |
| 97 | if s[0] == ' ' { |
| 98 | s = s[1:] |
| 99 | } |
| 100 | } |
| 101 | p.commentBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#commentBuf. = append(p.commentBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#commentBuf., s) |
| 102 | } |
| 103 | |
| 104 | // Push comment node. |
| 105 | func (p *Parserscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#) pushCommentscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#pushComment().() { |
| 106 | if len(p.commentBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#commentBuf.) == 0 { |
| 107 | return |
| 108 | } |
| 109 | |
| 110 | s := stringsscip-go gomod github.com/golang/go/src go1.24.9 strings/.Joinscip-go gomod github.com/golang/go/src go1.24.9 strings/Join().(p.commentBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#commentBuf., "\n") |
| 111 | |
| 112 | p.nodesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodes. = append(p.nodesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodes., Commentscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#{ |
| 113 | nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#node.: p.nodeBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodeBuf., |
| 114 | Targetscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#Target.: p.targetscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#target., |
| 115 | Valuescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#Value.: stringsscip-go gomod github.com/golang/go/src go1.24.9 strings/.Trimscip-go gomod github.com/golang/go/src go1.24.9 strings/Trim().(s, "\n"), |
| 116 | }) |
| 117 | p.nodeBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodeBuf. = nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/node#{} |
| 118 | p.commentBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#commentBuf. = nil |
| 119 | p.targetscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#target. = "" |
| 120 | } |
| 121 | |
| 122 | // Push include node. |
| 123 | func (p *Parserscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#) pushIncludescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#pushInclude().() { |
| 124 | s := stringsscip-go gomod github.com/golang/go/src go1.24.9 strings/.Trimscip-go gomod github.com/golang/go/src go1.24.9 strings/Trim().(stringsscip-go gomod github.com/golang/go/src go1.24.9 strings/.Replacescip-go gomod github.com/golang/go/src go1.24.9 strings/Replace().(p.advancescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#advance().(), "include ", "", 1), " ") |
| 125 | p.nodeBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodeBuf..linesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/node#lines. = append(p.nodeBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodeBuf..linesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/node#lines., p.iscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#i.-1) |
| 126 | p.nodesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodes. = append(p.nodesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodes., Includescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Include#{ |
| 127 | nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Include#node.: p.nodeBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodeBuf., |
| 128 | Valuescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Include#Value.: s, |
| 129 | }) |
| 130 | p.nodeBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodeBuf. = nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/node#{} |
| 131 | } |
| 132 | |
| 133 | // Parse the input. |
| 134 | func (p *Parserscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#) parsescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#parse().() error { |
| 135 | for { |
| 136 | switch { |
| 137 | case p.iscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#i. == len(p.linesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#lines.)-1: |
| 138 | return nil |
| 139 | case stringsscip-go gomod github.com/golang/go/src go1.24.9 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.24.9 strings/HasPrefix().(p.peekscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#peek().(), ".PHONY"): |
| 140 | p.advancescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#advance().() |
| 141 | case len(p.peekscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#peek().()) == 0: |
| 142 | p.pushCommentscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#pushComment().() |
| 143 | p.advancescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#advance().() |
| 144 | case p.peekscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#peek().()[0] == '#': |
| 145 | p.bufferCommentscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#bufferComment().() |
| 146 | case stringsscip-go gomod github.com/golang/go/src go1.24.9 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.24.9 strings/HasPrefix().(p.peekscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#peek().(), "include "): |
| 147 | p.pushIncludescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#pushInclude().() |
| 148 | case stringsscip-go gomod github.com/golang/go/src go1.24.9 strings/.ContainsRunescip-go gomod github.com/golang/go/src go1.24.9 strings/ContainsRune().(p.peekscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#peek().(), ':'): |
| 149 | p.targetscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#target. = stringsscip-go gomod github.com/golang/go/src go1.24.9 strings/.Splitscip-go gomod github.com/golang/go/src go1.24.9 strings/Split().(p.advancescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#advance().(), ":")[0] |
| 150 | p.nodeBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodeBuf..linesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/node#lines. = append(p.nodeBufscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#nodeBuf..linesscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/node#lines., p.iscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#i.-1) |
| 151 | p.pushCommentscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#pushComment().() |
| 152 | default: |
| 153 | p.advancescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#advance().() |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | // Parse the given input. |
| 159 | func Parsescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parse().(r ioscip-go gomod github.com/golang/go/src go1.24.9 io/.Readerscip-go gomod github.com/golang/go/src go1.24.9 io/Reader#) ([]Nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Node#, error) { |
| 160 | return (&Parserscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#{}).Parsescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parser#Parse().(r) |
| 161 | } |
| 162 | |
| 163 | // ParseRecursive parses the given input recursively |
| 164 | // relative to the given dir such as /usr/local/include. |
| 165 | func ParseRecursivescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/ParseRecursive().(r ioscip-go gomod github.com/golang/go/src go1.24.9 io/.Readerscip-go gomod github.com/golang/go/src go1.24.9 io/Reader#, dir string) ([]Nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Node#, error) { |
| 166 | nodes, err := parseRecursiveHelperscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/parseRecursiveHelper().(r, dir) |
| 167 | |
| 168 | for i := range nodes { |
| 169 | defaultComment, ok := nodes[i].(Commentscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#) |
| 170 | if !ok { |
| 171 | continue |
| 172 | } |
| 173 | |
| 174 | defaultComment.Defaultscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#Default. = true |
| 175 | nodes[i] = Commentscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#{ |
| 176 | Targetscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#Target.: defaultComment.Targetscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#Target., |
| 177 | Valuescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#Value.: defaultComment.Valuescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#Value., |
| 178 | Defaultscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Comment#Default.: true, |
| 179 | } |
| 180 | break |
| 181 | } |
| 182 | |
| 183 | return nodes, err |
| 184 | } |
| 185 | |
| 186 | func parseRecursiveHelperscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/parseRecursiveHelper().(r ioscip-go gomod github.com/golang/go/src go1.24.9 io/.Readerscip-go gomod github.com/golang/go/src go1.24.9 io/Reader#, dir string) ([]Nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Node#, error) { |
| 187 | nodes, err := Parsescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Parse().(r) |
| 188 | |
| 189 | if err != nil { |
| 190 | return nil, errorsscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/errors`/.Wrapscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/errors`/Wrap().(err, "parsing") |
| 191 | } |
| 192 | |
| 193 | otherNodes := []Nodescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Node#{} |
| 194 | for _, n := range nodes { |
| 195 | otherNodes = append(otherNodes, n) |
| 196 | |
| 197 | inc, ok := n.(Includescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Include#) |
| 198 | |
| 199 | if !ok { |
| 200 | continue |
| 201 | } |
| 202 | |
| 203 | path := filepathscip-go gomod github.com/golang/go/src go1.24.9 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.24.9 `path/filepath`/Join().(dir, inc.Valuescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/Include#Value.) |
| 204 | f, err := osscip-go gomod github.com/golang/go/src go1.24.9 os/.Openscip-go gomod github.com/golang/go/src go1.24.9 os/Open().(path) |
| 205 | if err != nil { |
| 206 | return nil, errorsscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/errors`/.Wrapfscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/errors`/Wrapf().(err, "opening %q", path) |
| 207 | } |
| 208 | |
| 209 | more, err := parseRecursiveHelperscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/pkg/makefile`/parseRecursiveHelper().(f, dir) |
| 210 | |
| 211 | if err != nil { |
| 212 | return nil, errorsscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/errors`/.Wrapfscip-go gomod github.com/efficientgo/core v1.0.0-rc.3 `github.com/efficientgo/core/errors`/Wrapf().(err, "parsing %q", path) |
| 213 | } |
| 214 | |
| 215 | otherNodes = append(otherNodes, more...) |
| 216 | |
| 217 | f.Closescip-go gomod github.com/golang/go/src go1.24.9 os/File#Close().() |
| 218 | } |
| 219 | |
| 220 | return otherNodes, nil |
| 221 | } |