mirror of
				https://github.com/gohugoio/hugo.git
				synced 2024-05-11 05:54:58 +00:00 
			
		
		
		
	@@ -48,7 +48,7 @@ func Parse(r io.Reader) (Result, error) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func parseMainSection(input []byte, from int) Result {
 | 
			
		||||
	lexer := newPageLexer(input, pos(from), lexMainSection) // TODO(bep) 2errors
 | 
			
		||||
	lexer := newPageLexer(input, Pos(from), lexMainSection) // TODO(bep) 2errors
 | 
			
		||||
	lexer.run()
 | 
			
		||||
	return lexer
 | 
			
		||||
}
 | 
			
		||||
@@ -57,7 +57,7 @@ func parseMainSection(input []byte, from int) Result {
 | 
			
		||||
// if needed.
 | 
			
		||||
type Iterator struct {
 | 
			
		||||
	l       *pageLexer
 | 
			
		||||
	lastPos pos // position of the last item returned by nextItem
 | 
			
		||||
	lastPos Pos // position of the last item returned by nextItem
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// consumes and returns the next item
 | 
			
		||||
@@ -69,7 +69,7 @@ func (t *Iterator) Next() Item {
 | 
			
		||||
var errIndexOutOfBounds = Item{tError, 0, []byte("no more tokens")}
 | 
			
		||||
 | 
			
		||||
func (t *Iterator) current() Item {
 | 
			
		||||
	if t.lastPos >= pos(len(t.l.items)) {
 | 
			
		||||
	if t.lastPos >= Pos(len(t.l.items)) {
 | 
			
		||||
		return errIndexOutOfBounds
 | 
			
		||||
	}
 | 
			
		||||
	return t.l.items[t.lastPos]
 | 
			
		||||
@@ -98,7 +98,7 @@ func (t *Iterator) Peek() Item {
 | 
			
		||||
// PeekWalk will feed the next items in the iterator to walkFn
 | 
			
		||||
// until it returns false.
 | 
			
		||||
func (t *Iterator) PeekWalk(walkFn func(item Item) bool) {
 | 
			
		||||
	for i := t.lastPos + 1; i < pos(len(t.l.items)); i++ {
 | 
			
		||||
	for i := t.lastPos + 1; i < Pos(len(t.l.items)); i++ {
 | 
			
		||||
		item := t.l.items[i]
 | 
			
		||||
		if !walkFn(item) {
 | 
			
		||||
			break
 | 
			
		||||
@@ -120,5 +120,5 @@ func (t *Iterator) Consume(cnt int) {
 | 
			
		||||
 | 
			
		||||
// LineNumber returns the current line number. Used for logging.
 | 
			
		||||
func (t *Iterator) LineNumber() int {
 | 
			
		||||
	return bytes.Count(t.l.input[:t.current().pos], lf) + 1
 | 
			
		||||
	return bytes.Count(t.l.input[:t.current().Pos], lf) + 1
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user