diff options
Diffstat (limited to 'gopher/gophermap/extended.go')
-rw-r--r-- | gopher/gophermap/extended.go | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/gopher/gophermap/extended.go b/gopher/gophermap/extended.go index 8b04104..e1db9dc 100644 --- a/gopher/gophermap/extended.go +++ b/gopher/gophermap/extended.go @@ -33,6 +33,8 @@ func ParseExtended(input io.Reader, location *url.URL) (*ExtendedMapDocument, er outer: for num := 1; ; num += 1 { + var item gopher.MapItem + var spl []string line, err := rdr.ReadString('\n') isEOF := errors.Is(err, io.EOF) if err != nil && !isEOF { @@ -48,41 +50,41 @@ outer: Type: CommentType, Display: strings.TrimPrefix(line[1:], " "), }) - continue outer + goto next case '!': doc.Lines = append(doc.Lines, gopher.MapItem{ Type: TitleType, Display: line[1:], }) - continue outer + goto next case '-': doc.Lines = append(doc.Lines, gopher.MapItem{ Type: HiddenType, Selector: line[1:], }) - continue outer + goto next case ':': doc.Lines = append(doc.Lines, gopher.MapItem{ Type: ExtensionType, Display: line[1:], }) - continue outer + goto next case '=': doc.Lines = append(doc.Lines, gopher.MapItem{ Type: InclusionType, Selector: line[1:], }) - continue outer + goto next } } switch line { case "~": doc.Lines = append(doc.Lines, gopher.MapItem{Type: UserListType}) - continue outer + goto next case "%": doc.Lines = append(doc.Lines, gopher.MapItem{Type: VHostListType}) - continue outer + goto next case ".": doc.Lines = append(doc.Lines, gopher.MapItem{Type: EndDocType}) break outer @@ -99,12 +101,12 @@ outer: Hostname: location.Hostname(), Port: location.Port(), }) - continue + goto next } - item := gopher.MapItem{Type: types.Status(line[0])} + item = gopher.MapItem{Type: types.Status(line[0])} - spl := strings.Split(line[1:], "\t") + spl = strings.Split(line[1:], "\t") if len(spl) != 4 { return doc, InvalidLine(num) } @@ -117,6 +119,7 @@ outer: } doc.Lines = append(doc.Lines, item) + next: if isEOF { break } |