go.talks/pkg/present: remove dead code
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12307043
diff --git a/pkg/present/args.go b/pkg/present/args.go
index c315f4f..49ee1a9 100644
--- a/pkg/present/args.go
+++ b/pkg/present/args.go
@@ -227,34 +227,3 @@
}
return m[0], m[1], nil
}
-
-// lineToByte returns the byte index of the first byte of line n.
-// Line numbers begin at 1.
-func lineToByte(data []byte, n int) int {
- if n <= 1 {
- return 0
- }
- n--
- for i, c := range data {
- if c == '\n' {
- if n--; n == 0 {
- return i + 1
- }
- }
- }
- return len(data)
-}
-
-// byteToLine returns the number of the line containing the byte at index i.
-func byteToLine(data []byte, i int) int {
- l := 1
- for j, c := range data {
- if j == i {
- return l
- }
- if c == '\n' {
- l++
- }
- }
- return l
-}
diff --git a/pkg/present/code.go b/pkg/present/code.go
index 9a7f342..4d82d9a 100644
--- a/pkg/present/code.go
+++ b/pkg/present/code.go
@@ -224,70 +224,6 @@
return 0, "", false, fmt.Errorf("unrecognized argument %v type %T", arg, arg)
}
-// oneLine returns the single line generated by a two-argument code invocation.
-func oneLine(ctx *Context, file, text string, arg interface{}) (line, before, after string, err error) {
- contentBytes, err := ctx.ReadFile(file)
- if err != nil {
- return "", "", "", err
- }
- lines := strings.SplitAfter(string(contentBytes), "\n")
- lineNum, pattern, isInt, err := parseArg(arg, len(lines))
- if err != nil {
- return "", "", "", err
- }
- var n int
- if isInt {
- n = lineNum - 1
- } else {
- n, err = match(file, 0, lines, pattern)
- n -= 1
- }
- if err != nil {
- return "", "", "", err
- }
- return lines[n],
- strings.Join(lines[:n], ""),
- strings.Join(lines[n+1:], ""),
- nil
-}
-
-// multipleLines returns the text generated by a three-argument code invocation.
-func multipleLines(ctx *Context, file string, arg1, arg2 interface{}) (line, before, after string, err error) {
- contentBytes, err := ctx.ReadFile(file)
- lines := strings.SplitAfter(string(contentBytes), "\n")
- if err != nil {
- return "", "", "", err
- }
- line1, pattern1, isInt1, err := parseArg(arg1, len(lines))
- if err != nil {
- return "", "", "", err
- }
- line2, pattern2, isInt2, err := parseArg(arg2, len(lines))
- if err != nil {
- return "", "", "", err
- }
- if !isInt1 {
- line1, err = match(file, 0, lines, pattern1)
- }
- if !isInt2 {
- line2, err = match(file, line1, lines, pattern2)
- } else if line2 < line1 {
- return "", "", "", fmt.Errorf("lines out of order for %q: %d %d", file, line1, line2)
- }
- if err != nil {
- return "", "", "", err
- }
- for k := line1 - 1; k < line2; k++ {
- if strings.HasSuffix(lines[k], "OMIT\n") {
- lines[k] = ""
- }
- }
- return strings.Join(lines[line1-1:line2], ""),
- strings.Join(lines[:line1-1], ""),
- strings.Join(lines[line2:], ""),
- nil
-}
-
// match identifies the input line that matches the pattern in a code invocation.
// If start>0, match lines starting there rather than at the beginning.
// The return value is 1-indexed.