Compare commits
4 Commits
v0.3.9
...
c4c77d51d2
| Author | SHA1 | Date | |
|---|---|---|---|
| c4c77d51d2 | |||
| 3511e5a66d | |||
| 8e4f759260 | |||
| 2ab838ea78 |
@@ -64,3 +64,29 @@ func (p *Position) StepLine() {
|
|||||||
p.Line++
|
p.Line++
|
||||||
p.Column = 1
|
p.Column = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Next returns a new Position one rune forward
|
||||||
|
// on the line
|
||||||
|
func (p Position) Next() Position {
|
||||||
|
if p.Line == 0 {
|
||||||
|
p.Reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
return Position{
|
||||||
|
Line: p.Line,
|
||||||
|
Column: p.Column + 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NextLine returns a new Position at the begining of the next
|
||||||
|
// line.
|
||||||
|
func (p Position) NextLine() Position {
|
||||||
|
if p.Line == 0 {
|
||||||
|
p.Reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
return Position{
|
||||||
|
Line: p.Line + 1,
|
||||||
|
Column: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ func NewIsIn(s string) func(rune) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewIsInRunes generates a rune condition checker that accepts
|
||||||
|
// the runes specified
|
||||||
|
func NewIsInRunes(s ...rune) func(rune) bool {
|
||||||
|
return NewIsIn(string(s))
|
||||||
|
}
|
||||||
|
|
||||||
// NewIsOneOf generates a run condition checker that accepts runes
|
// NewIsOneOf generates a run condition checker that accepts runes
|
||||||
// accepted by any of the given checkers
|
// accepted by any of the given checkers
|
||||||
func NewIsOneOf(s ...func(rune) bool) func(rune) bool {
|
func NewIsOneOf(s ...func(rune) bool) func(rune) bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user