From 3592b234045662061c100fc1b4293ab164289895 Mon Sep 17 00:00:00 2001 From: rwxrob Date: Mon, 28 Feb 2022 20:21:13 -0500 Subject: [PATCH] Rename package scanner to scan --- {scanner => scan}/cur.go | 4 +-- {scanner => scan}/cur_test.go | 6 ++-- {scanner => scan}/is/is.go | 0 scanner/scanner.go => scan/scan.go | 6 ++-- scanner/scanner_test.go => scan/scan_test.go | 38 ++++++++++---------- {scanner => scan}/tk/tk.go | 0 6 files changed, 27 insertions(+), 27 deletions(-) rename {scanner => scan}/cur.go (97%) rename {scanner => scan}/cur_test.go (60%) rename {scanner => scan}/is/is.go (100%) rename scanner/scanner.go => scan/scan.go (98%) rename scanner/scanner_test.go => scan/scan_test.go (83%) rename {scanner => scan}/tk/tk.go (100%) diff --git a/scanner/cur.go b/scan/cur.go similarity index 97% rename from scanner/cur.go rename to scan/cur.go index 81bef56..7a2ac62 100644 --- a/scanner/cur.go +++ b/scan/cur.go @@ -1,12 +1,12 @@ // Copyright 2022 Robert S. Muhlestein. // SPDX-License-Identifier: Apache-2.0 -package scanner +package scan import ( "fmt" - "github.com/rwxrob/bonzai/scanner/tk" + "github.com/rwxrob/bonzai/scan/tk" ) // Pos contains the user-land position for reporting back when there is diff --git a/scanner/cur_test.go b/scan/cur_test.go similarity index 60% rename from scanner/cur_test.go rename to scan/cur_test.go index d1b32bc..6b3f2f0 100644 --- a/scanner/cur_test.go +++ b/scan/cur_test.go @@ -1,9 +1,9 @@ -package scanner_test +package scan_test -import "github.com/rwxrob/bonzai/scanner" +import "github.com/rwxrob/bonzai/scan" func ExampleCur() { - m := new(scanner.Cur) + m := new(scan.Cur) m.Print() m.NewLine() m.Print() diff --git a/scanner/is/is.go b/scan/is/is.go similarity index 100% rename from scanner/is/is.go rename to scan/is/is.go diff --git a/scanner/scanner.go b/scan/scan.go similarity index 98% rename from scanner/scanner.go rename to scan/scan.go index 6943ef6..c0b2760 100644 --- a/scanner/scanner.go +++ b/scan/scan.go @@ -1,7 +1,7 @@ // Copyright 2022 Robert S. Muhlestein. // SPDX-License-Identifier: Apache-2.0 -package scanner +package scan import ( "errors" @@ -9,8 +9,8 @@ import ( "io" "unicode/utf8" - "github.com/rwxrob/bonzai/scanner/is" - "github.com/rwxrob/bonzai/scanner/tk" + "github.com/rwxrob/bonzai/scan/is" + "github.com/rwxrob/bonzai/scan/tk" ) // Scanner implements a non-linear, rune-centric, buffered data scanner. diff --git a/scanner/scanner_test.go b/scan/scan_test.go similarity index 83% rename from scanner/scanner_test.go rename to scan/scan_test.go index 90835ae..611c1cd 100644 --- a/scanner/scanner_test.go +++ b/scan/scan_test.go @@ -1,15 +1,15 @@ -package scanner_test +package scan_test import ( "fmt" "strings" - "github.com/rwxrob/bonzai/scanner" - "github.com/rwxrob/bonzai/scanner/is" + "github.com/rwxrob/bonzai/scan" + "github.com/rwxrob/bonzai/scan/is" ) func ExampleNew_string() { - s, err := scanner.New("some thing") + s, err := scan.New("some thing") if err != nil { fmt.Println(err) } @@ -22,7 +22,7 @@ func ExampleNew_string() { } func ExampleNew_bytes() { - s, err := scanner.New([]byte{'s', 'o', 'm'}) + s, err := scan.New([]byte{'s', 'o', 'm'}) if err != nil { fmt.Println(err) } @@ -38,7 +38,7 @@ func ExampleNew_bytes() { func ExampleNew_reader() { r := strings.NewReader("some thing") - s, err := scanner.New(r) + s, err := scan.New(r) if err != nil { fmt.Println(err) } @@ -51,7 +51,7 @@ func ExampleNew_reader() { } func ExampleInit() { - s, err := scanner.New("some thing") + s, err := scan.New("some thing") if err != nil { fmt.Println(err) } @@ -68,7 +68,7 @@ func ExampleInit() { } func ExampleMark() { - s, err := scanner.New("some thing") + s, err := scan.New("some thing") if err != nil { fmt.Println(err) } @@ -81,17 +81,17 @@ func ExampleMark() { } func ExampleJump() { - s1, _ := scanner.New("some thing") + s1, _ := scan.New("some thing") s1.ScanN(5) s1.Print() // t - s2, _ := scanner.New("other thing") + s2, _ := scan.New("other thing") s2.ScanN(6) s2.Print() // t s1.Jump(s2.Cur) // WRONG, must be same source buffer s1.Print() - s3, _ := scanner.New("some thing") // identical + s3, _ := scan.New("some thing") // identical s3.ScanN(6) s3.Print() // h s1.Jump(s3.Cur) @@ -113,7 +113,7 @@ func ExampleJump() { } func ExamplePeek() { - s, _ := scanner.New("some thing") + s, _ := scan.New("some thing") s.ScanN(6) fmt.Println(s.Peek(3)) // Output: @@ -121,7 +121,7 @@ func ExamplePeek() { } func ExampleLook() { - s, _ := scanner.New("some thing") + s, _ := scan.New("some thing") s.Scan() m1 := s.Mark() m1.Print() @@ -140,7 +140,7 @@ func ExampleLook() { } func ExampleLookSlice() { - s, _ := scanner.New("some thing") + s, _ := scan.New("some thing") s.Scan() m1 := s.Mark() m1.Print() @@ -155,7 +155,7 @@ func ExampleLookSlice() { } func ExampleNewLine() { - s, _ := scanner.New("some thing") + s, _ := scan.New("some thing") s.Print() s.NewLine() s.Print() @@ -165,7 +165,7 @@ func ExampleNewLine() { } func ExampleErrorExpected() { - s, _ := scanner.New("some thing") + s, _ := scan.New("some thing") fmt.Println(s.ErrorExpected("foo")) fmt.Println(s.ErrorExpected('f')) fmt.Println(s.ErrorExpected([]byte{'f', 'o', 'o'})) @@ -176,7 +176,7 @@ func ExampleErrorExpected() { } func ExampleExpect_basic() { - s, _ := scanner.New("some thing") + s, _ := scan.New("some thing") c, _ := s.Expect("some", ' ', "thin") c.Print() fmt.Println(s.Done()) @@ -193,7 +193,7 @@ func ExampleExpect_basic() { } func ExampleCheck() { - s, _ := scanner.New("some thing") + s, _ := scan.New("some thing") c, _ := s.Check("some", ' ', "thin") // same as Expect ... c.Print() // ... with cur return ... s.Print() // ... just doesn't advance @@ -203,7 +203,7 @@ func ExampleCheck() { } func ExampleExpect_not() { - s, _ := scanner.New("some thing") + s, _ := scan.New("some thing") c1, e1 := s.Expect(is.Not{"foo"}) c1.Print() fmt.Println(e1) diff --git a/scanner/tk/tk.go b/scan/tk/tk.go similarity index 100% rename from scanner/tk/tk.go rename to scan/tk/tk.go