// The lines we're passing look like this:
//
//     main.(*foo).destruct(0xc208067e98)
//             /0/go/src/github.com/bugsnag/bugsnag-go/pan/main.go:22 +0x151
352904
func parsePanicFrame(name string, line string, createdBy bool) (*StackFrame, error) {
	idx := strings.LastIndex(name, "(")
	if idx == -1 && !createdBy {
		return nil, Errorf("bugsnag.panicParser: Invalid line (no call): %s", name)
	}
	if idx != -1 {
		name = name[:idx]
	}
	pkg := ""

	if lastslash := strings.LastIndex(name, "/"); lastslash >= 0 {
		pkg += name[:lastslash] + "/"
		name = name[lastslash+1:]
	}
	if period := strings.Index(name, "."); period >= 0 {
		pkg += name[:period]
		name = name[period+1:]
	}

	name = strings.Replace(name, "·", ".", -1)

	if !strings.HasPrefix(line, "\t") {
		return nil, Errorf("bugsnag.panicParser: Invalid line (no tab): %s", line)
	}

	idx = strings.LastIndex(line, ":")
	if idx == -1 {
		return nil, Errorf("bugsnag.panicParser: Invalid line (no line number): %s", line)
	}
	file := line[1:idx]

	number := line[idx+1:]
	if idx = strings.Index(number, " +"); idx > -1 {
		number = number[:idx]
	}

	lno, err := strconv.ParseInt(number, 10, 32)
	if err != nil {
		return nil, Errorf("bugsnag.panicParser: Invalid line (bad line number): %s", line)
	}

	return &StackFrame{
		File:       file,
		LineNumber: int(lno),
		Package:    pkg,
		Name:       name,
	}, nil
}
1007071
func (l *logger) linePrefix(skipFrames int) string {
	runtime.Callers(skipFrames, l.pc)
	funcForPc := runtime.FuncForPC(l.pc[0])
	file, line := funcForPc.FileLine(l.pc[0] - 1)
	return fmt.Sprintf("%s%s:%d ", l.prefix, filepath.Base(file), line)
}
736916
func splitLines(data []byte, eof bool) (advance int, token []byte, err error) {
	if eof && len(data) == 0 {
		return 0, nil, nil
	}

	if i := bytes.IndexByte(data, '\n'); i >= 0 {
		orgStdout.Write(data[nextOutPos : i+1])
		nextOutPos = 0
		return i + 1, data[0:i], nil
	}

	orgStdout.Write(data[nextOutPos:])
	nextOutPos = len(data)

	if eof {
		// This is a final, non-terminated line. Return it.
		return len(data), data, nil
	}

	return 0, nil, nil
}
613623
func (this *Manidator) eraseLinesN(count int) {
	fmt.Printf(strings.Repeat(eraseLine, count))
}
796924
func removeSpaceAndSuffix(line string) string {
	parts := strings.Split(line, " ")
	return strings.Join(parts[:len(parts)-1], " ")
}
1181400
func manualStrip(file []byte) []byte {
	stripped := []byte{}
	for _, line := range bytes.Split(file, []byte("\n")) {
		if bytes.HasPrefix(bytes.TrimSpace(line), []byte("#")) {
			continue
		}
		stripped = append(stripped, line...)
		stripped = append(stripped, '\n')
	}
	return stripped
}
418621
func SourceLine(e error) string {
	file, line := Location(e)
	if line != 0 {
		return fmt.Sprintf("%s:%d", file, line)
	}
	return ""
}
567421
func (r *renderedError) toLines(excludePkgs ...string) lines {
	buf := bytes.Buffer{}
	r.dumpTo(&buf, excludePkgs...)
	return strings.Split(strings.TrimSuffix(buf.String(), "\n"), "\n")
}
778403
func (ctx *compctx) ErrorLine() int {
	var n int
	fmt.Sscanf(ctx.Error(), "Error > stdin:%d", &n)
	return n
}
536641
func (r *Render) BreakLine(buffer *Buffer) {
	// Erasing and Render
	cursor := runewidth.StringWidth(buffer.Document().TextBeforeCursor()) + runewidth.StringWidth(r.getCurrentPrefix())
	r.clear(cursor)
	r.renderPrefix()
	r.out.SetColor(r.inputTextColor, r.inputBGColor, false)
	r.out.WriteStr(buffer.Document().Text + "\n")
	r.out.SetColor(DefaultColor, DefaultColor, false)
	debug.AssertNoError(r.out.Flush())

	r.previousCursor = 0
}
1240497
func (bi *BinaryInfo) LineToPC(filename string, lineno int) (pc uint64, fn *Function, err error) {
	for _, cu := range bi.compileUnits {
		if cu.lineInfo.Lookup[filename] != nil {
			pc = cu.lineInfo.LineToPC(filename, lineno)
			if pc == 0 {
				// Check to see if this file:line belongs to the call site
				// of an inlined function.
				for _, ifn := range cu.concreteInlinedFns {
					if strings.Contains(ifn.CallFile, filename) && ifn.CallLine == int64(lineno) {
						pc = ifn.LowPC
						fn = ifn.Parent
						return
					}
				}
			}
			fn = bi.PCToFunc(pc)
			if fn != nil {
				return
			}
		}
	}
	err = fmt.Errorf("could not find %s:%d", filename, lineno)
	return
}
1173246
func (pg *GoEvtxMap) Del(path ...string) {
	if len(path) > 0 {
		if ge, ok := (*pg)[path[0]]; ok {
			if len(path) == 1 {
				delete((*pg), path[0])
			}
			switch ge.(type) {
			case GoEvtxMap:
				p := ge.(GoEvtxMap)
				p.Del(path[1:]...)
			}
		}
	}
}
932911
func main() {
	args := map[string]string{}
	gp := geopattern.URIimage(args)
	fmt.Println(gp)
}
83412
func line(box orb.Bound, in orb.LineString, open bool) orb.MultiLineString {
	if len(in) == 0 {
		return nil
	}

	var out orb.MultiLineString
	line := 0

	var codeA int
	if open {
		codeA = bitCodeOpen(box, in[0])
	} else {
		codeA = bitCode(box, in[0])
	}

	loopTo := len(in)
	for i := 1; i < loopTo; i++ {
		a := in[i-1]
		b := in[i]

		var codeB int
		if open {
			codeB = bitCodeOpen(box, b)
		} else {
			codeB = bitCode(box, b)
		}
		endCode := codeB

		// loops through all the intersection of the line and box.
		// eg. across a corner could have two intersections.
		for {
			if codeA|codeB == 0 {
				// both points are in the box, accept
				out = push(out, line, a)
				if codeB != endCode { // segment went outside
					out = push(out, line, b)
					if i < loopTo-1 {
						line++
					}
				} else if i == loopTo-1 {
					out = push(out, line, b)
				}
				break
			} else if codeA&codeB != 0 {
				// both on one side of the box.
				// segment not part of the final result.
				break
			} else if codeA != 0 {
				// A is outside, B is inside, clip edge
				a = intersect(box, codeA, a, b)
				codeA = bitCode(box, a)
			} else {
				// B is outside, A is inside, clip edge
				b = intersect(box, codeB, a, b)
				codeB = bitCode(box, b)
			}
		}

		codeA = endCode // new start is the old end
	}

	return out
}
21620
func source(lines [][]byte, n int) []byte {
	n-- // in stack trace, lines are 1-indexed but our array is 0-indexed
	if n < 0 || n >= len(lines) {
		return dunno
	}
	return bytes.TrimSpace(lines[n])
}
1209039
func Grep(re, lines string) (string, error) {
	match := ""
	regex, regexErr := regexp.Compile(re)
	if regexErr != nil {
		return "", regexErr
	}

	for _, line := range strings.Split(lines, "\n") {
		if regex.MatchString(line) {
			match = match + "\n" + line
		}
	}
	return match, nil
}
808117
func string_splitlines(fnname string, recv Value, args Tuple, kwargs []Tuple) (Value, error) {
	var keepends bool
	if err := UnpackPositionalArgs(fnname, args, kwargs, 0, &keepends); err != nil {
		return nil, err
	}
	s := string(recv.(String))
	var lines []string
	// TODO(adonovan): handle CRLF correctly.
	if keepends {
		lines = strings.SplitAfter(s, "\n")
	} else {
		lines = strings.Split(s, "\n")
	}
	if strings.HasSuffix(s, "\n") {
		lines = lines[:len(lines)-1]
	}
	list := make([]Value, len(lines))
	for i, x := range lines {
		list[i] = String(x)
	}
	return NewList(list), nil
}