| 185 | } |
| 186 | |
| 187 | func fragmentRange(anchors []*ast.AnchorNode, anchorName string, line, character int) (*token.Position, *token.Position) { |
| 188 | var start *token.Position |
| 189 | for i := range anchors { |
| 190 | if anchors[i].Name.GetToken().Value == anchorName { |
| 191 | p := anchors[i].GetToken().Position |
| 192 | if p.Line < line || (p.Line == line && p.Column < character) { |
| 193 | start = p |
| 194 | } else { |
| 195 | return start, &token.Position{ |
| 196 | Line: p.Line, |
| 197 | Column: p.Column - 1, |
| 198 | } |
| 199 | } |
| 200 | } |
| 201 | } |
| 202 | return start, nil |
| 203 | } |
| 204 | |
| 205 | func fragmentReference(mappingNode *ast.MappingNode, line, character int) (*ast.AnchorNode, []*ast.AliasNode) { |
| 206 | anchors, aliases := findFragments(mappingNode, []*ast.AnchorNode{}, []*ast.AliasNode{}) |