Rename Mn1 -> M1

This commit is contained in:
rwxrob 2022-03-04 16:34:27 -05:00
parent 0bdb9536ef
commit 1763b79d16
No known key found for this signature in database
GPG Key ID: 2B9111F33082AE77
3 changed files with 7 additions and 7 deletions

View File

@ -130,8 +130,8 @@ type M struct {
This any
}
// Mn1 is shorthand for is.Min{1,This}.
type Mn1 struct{ This any }
// M1 is shorthand for z.M{1,This}.
type M1 struct{ This any }
// C is a parameterized advancing expression that matches an exact count
// of the given expression (This). Use within is.It to disable

View File

@ -418,7 +418,7 @@ func (s *R) Expect(expr any) (*Cur, error) {
}
return end, nil
case z.Mn1: // ----------------------------------------------------
case z.M1: // ----------------------------------------------------
m := s.Mark()
c, err := s.Expect(z.M{1, v.This})
if err != nil {
@ -530,7 +530,7 @@ func (s *R) ErrorExpected(this any, args ...any) error {
case z.O:
str := `expected an optional %v`
msg = fmt.Sprintf(str, v)
case z.Mn1:
case z.M1:
str := `expected one or more %q`
msg = fmt.Sprintf(str, v.This)
case z.M:

View File

@ -417,15 +417,15 @@ func ExampleExpect_o_Optional_Success() {
// U+0020 ' ' 1,5-5 (5-5)
}
func ExampleExpect_mn1() {
func ExampleExpect_minimum_One() {
s, _ := scan.New("sommme thing")
start := s.Mark()
s.ScanN(2)
c, _ := s.Expect(z.Mn1{'m'}) // goggles up all three
c, _ := s.Expect(z.M1{'m'}) // goggles up all three
c.Print()
s.Print()
s.Jump(start)
c, _ = s.Expect(z.Mn1{'s'}) // yep, just one
c, _ = s.Expect(z.M1{'s'}) // yep, just one
c.Print()
s.Print()
// Output: