func ParseComment(s *scanner.Scanner) (bool, string, error) { // ParseComment: Consume a comment if it exists. Stop leaving \n next // return: // - bool: if a comment was parsed // - string: the comment that was parsed // - error: errors next := <-s.PeekUntil(`[\n;]`) if next.Value != ";" { return false, "", nil } for { peek := <-s.Peek() if peek.Value == "\n" || peek.End { break } <-s.Next() } return true, "", nil }