mirror of
https://github.com/rwxrob/bonzai
synced 2024-11-14 18:12:59 +00:00
Rename Mn1 -> M1
This commit is contained in:
parent
0bdb9536ef
commit
1763b79d16
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user