| 110 | } |
| 111 | |
| 112 | func (p *parser) fail() { |
| 113 | var where string |
| 114 | var line int |
| 115 | if p.parser.context_mark.line != 0 { |
| 116 | line = p.parser.context_mark.line |
| 117 | // Scanner errors don't iterate line before returning error |
| 118 | if p.parser.error == yaml_SCANNER_ERROR { |
| 119 | line++ |
| 120 | } |
| 121 | } else if p.parser.problem_mark.line != 0 { |
| 122 | line = p.parser.problem_mark.line |
| 123 | // Scanner errors don't iterate line before returning error |
| 124 | if p.parser.error == yaml_SCANNER_ERROR { |
| 125 | line++ |
| 126 | } |
| 127 | } |
| 128 | if line != 0 { |
| 129 | where = "line " + strconv.Itoa(line) + ": " |
| 130 | } |
| 131 | var msg string |
| 132 | if len(p.parser.problem) > 0 { |
| 133 | msg = p.parser.problem |
| 134 | } else { |
| 135 | msg = "unknown problem parsing YAML content" |
| 136 | } |
| 137 | failf("%s%s", where, msg) |
| 138 | } |
| 139 | |
| 140 | func (p *parser) anchor(n *Node, anchor []byte) { |
| 141 | if anchor != nil { |