// NewOptionalListTokensPosition returns new Position
760623
func (b *PositionBuilder) NewOptionalListTokensPosition(list []node.Node, t *scanner.Token, endToken *scanner.Token) *position.Position {
	if list == nil {
		return &position.Position{
			StartLine: t.StartLine,
			EndLine:   endToken.EndLine,
			StartPos:  t.StartPos,
			EndPos:    endToken.EndPos,
		}
	}

	return &position.Position{
		StartLine: b.getListStartPos(list).startLine,
		EndLine:   endToken.EndLine,
		StartPos:  b.getListStartPos(list).startPos,
		EndPos:    endToken.EndPos,
	}
}
1037063
func allTokens(input io.Reader) ([]Token, error) {
	l := new(lexer)
	err := l.load(input)
	if err != nil {
		return nil, err
	}
	var tokens []Token
	for l.next() {
		tokens = append(tokens, l.token)
	}
	return tokens, nil
}
695543
func NewNGramIndex(opts ...Option) (*NGramIndex, error) {
	ngram := new(NGramIndex)
	for _, opt := range opts {
		if err := opt(ngram); err != nil {
			return nil, err
		}
	}
	ngram.init()
	return ngram, nil
}
394120
func (c oauthClient) SubtaskPosition(subTaskPositionID uint) (wl.Position, error) {
	if subTaskPositionID == 0 {
		return wl.Position{}, errors.New("subTaskPositionID must be > 0")
	}

	url := fmt.Sprintf(
		"%s/subtask_positions/%d",
		c.apiURL,
		subTaskPositionID,
	)

	req, err := c.newGetRequest(url)
	if err != nil {
		return wl.Position{}, err
	}

	resp, err := c.do(req)
	if err != nil {
		return wl.Position{}, err
	}

	if resp.StatusCode != http.StatusOK {
		return wl.Position{}, fmt.Errorf("Unexpected response code %d - expected %d", resp.StatusCode, http.StatusOK)
	}

	subtaskPosition := wl.Position{}
	err = json.NewDecoder(resp.Body).Decode(&subtaskPosition)
	if err != nil {
		return wl.Position{}, err
	}
	return subtaskPosition, nil
}
34945
func (s *GetResourcesOutput) SetPaginationToken(v string) *GetResourcesOutput {
	s.PaginationToken = &v
	return s
}
1372487
func (b *PositionBuilder) NewTokenPosition(t *scanner.Token) *position.Position {
	return &position.Position{
		StartLine: t.StartLine,
		EndLine:   t.EndLine,
		StartPos:  t.StartPos,
		EndPos:    t.EndPos,
	}
}
536710
func (s *DetectEntitiesOutput) SetPaginationToken(v string) *DetectEntitiesOutput {
	s.PaginationToken = &v
	return s
}
530815
func NewOptionBlockObject(value string, text *TextBlockObject) *OptionBlockObject {
	return &OptionBlockObject{
		Text:  text,
		Value: value,
	}
}
329456
func (w *Lucene41PostingsWriter) AddPosition(position int,
	payload []byte, startOffset, endOffset int) error {

	w.posDeltaBuffer[w.posBufferUpto] = position - w.lastPosition
	if w.fieldHasPayloads {
		if len(payload) == 0 {
			// no paylaod
			w.payloadLengthBuffer[w.posBufferUpto] = 0
		} else {
			panic("not implemented yet")
		}
	}

	if w.fieldHasOffsets {
		panic("not implemented yet")
	}

	w.posBufferUpto++
	w.lastPosition = position
	if w.posBufferUpto == LUCENE41_BLOCK_SIZE {
		var err error
		if err = w.forUtil.writeBlock(w.posDeltaBuffer, w.encoded, w.posOut); err != nil {
			return err
		}

		if w.fieldHasPayloads {
			panic("niy")
		}
		if w.fieldHasOffsets {
			panic("niy")
		}
		w.posBufferUpto = 0
	}
	return nil
}
1116433
func newMarkAllocator(base, size int) *markAllocator {
	ma := &markAllocator{
		marks: make([]uint32, 0, size),
	}
	for i := 0; i < size; i++ {
		ma.put(uint32(base + i))
	}
	return ma
}
953131
func (s *ListUserImportJobsOutput) SetPaginationToken(v string) *ListUserImportJobsOutput {
	s.PaginationToken = &v
	return s
}
880157
func NewHook(token string, env string, opts ...OptionFunc) *Hook {
	h := NewHookForLevels(token, env, defaultTriggerLevels)

	for _, o := range opts {
		o(h)
	}

	return h
}
94074
func (im *IndexMappingImpl) AddCustomTokenizer(name string, config map[string]interface{}) error {
	_, err := im.cache.DefineTokenizer(name, config)
	if err != nil {
		return err
	}
	im.CustomAnalysis.Tokenizers[name] = config
	return nil
}
586326
func (s *GetResourcesInput) SetPaginationToken(v string) *GetResourcesInput {
	s.PaginationToken = &v
	return s
}
542592
func (s *GetTagValuesInput) SetPaginationToken(v string) *GetTagValuesInput {
	s.PaginationToken = &v
	return s
}
1284816
func NewOptional(it graph.Iterator) *Optional {
	return &Optional{
		uid:   NextUID(),
		subIt: it,
	}
}
617975
func (s *ListUsersOutput) SetPaginationToken(v string) *ListUsersOutput {
	s.PaginationToken = &v
	return s
}