Skip to content

Commit

Permalink
Rename package scanner to scan
Browse files Browse the repository at this point in the history
  • Loading branch information
rwxrob committed Mar 1, 2022
1 parent 12e6aa8 commit 3592b23
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions scanner/cur.go → scan/cur.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions scanner/cur_test.go → scan/cur_test.go
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions scanner/scanner.go → scan/scan.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Copyright 2022 Robert S. Muhlestein.
// SPDX-License-Identifier: Apache-2.0

package scanner
package scan

import (
"errors"
"fmt"
"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.
Expand Down
38 changes: 19 additions & 19 deletions scanner/scanner_test.go → scan/scan_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
Expand All @@ -113,15 +113,15 @@ func ExampleJump() {
}

func ExamplePeek() {
s, _ := scanner.New("some thing")
s, _ := scan.New("some thing")
s.ScanN(6)
fmt.Println(s.Peek(3))
// Output:
// hin
}

func ExampleLook() {
s, _ := scanner.New("some thing")
s, _ := scan.New("some thing")
s.Scan()
m1 := s.Mark()
m1.Print()
Expand All @@ -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()
Expand All @@ -155,7 +155,7 @@ func ExampleLookSlice() {
}

func ExampleNewLine() {
s, _ := scanner.New("some thing")
s, _ := scan.New("some thing")
s.Print()
s.NewLine()
s.Print()
Expand All @@ -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'}))
Expand All @@ -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())
Expand All @@ -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
Expand All @@ -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)
Expand Down
File renamed without changes.

0 comments on commit 3592b23

Please sign in to comment.