// start pos in the text.
321042
func (node *Node) StartPos() int {
	pFirstNode, _ := strconv.Atoi(fmt.Sprintf("%d", node.head.surface))
	pCurrentNode, _ := strconv.Atoi(fmt.Sprintf("%d", node.current.surface))
	return utf8.RuneCountInString(C.GoStringN(node.head.surface, C.int(pCurrentNode-pFirstNode)))
}
1354431
func (o *OpenPGP) Start() error {
	var err error

	var privKF, pubKF *os.File

	if o.PrivateKeyPath != "" {
		if privKF, err = os.Open(o.PrivateKeyPath); err != nil {
			return err
		}
		o.PrivateKey = privKF
		defer privKF.Close()
	}

	if o.PublicKeyPath != "" {
		if pubKF, err = os.Open(o.PublicKeyPath); err != nil {
			return err
		}
		o.PublicKey = pubKF
		defer pubKF.Close()
	}

	if o.PrivateKey != nil {
		if err = o.loadPrivateKey(); err != nil {
			return err
		}
	}

	if o.PublicKey != nil {
		o.publicEntityList, err = openpgp.ReadKeyRing(o.PublicKey)
		if err != nil {
			return err
		}
	}
	return err
}
1294046
func (r *tokenReader) Begin() {
	r.runes = r.runes[r.cursor:]
	r.cursor = 0
	r.oldPos = r.pos
}
662678
func (m *manager) Start() {
	dec := json.NewDecoder(m.Reader)
	enc := json.NewEncoder(m.Writer)

	for {
		var msg input
		err := dec.Decode(&msg)

		if err == io.EOF {
			break
		}

		if err != nil {
			log.Printf("error decoding input: %s", err)
			break
		}

		v, err := m.Handler.Handle(msg.Event, msg.Context)
		out := output{ID: msg.ID, Value: v}

		if err != nil {
			out.Error = err.Error()
		}

		if err := enc.Encode(out); err != nil {
			log.Printf("error encoding output: %s", err)
		}
	}
}
1244808
func (s *scanner) updatePosition(text string) {
	width := utf8.RuneCountInString(text)
	lines := strings.Count(text, "\n")
	s.row += lines
	if lines == 0 {
		s.col += width
	} else {
		s.col = utf8.RuneCountInString(text[strings.LastIndex(text, "\n"):])
	}
	s.pos += len(text)
}
1141442
func (p *Init) Start(ctx context.Context) error {
	p.mu.Lock()
	defer p.mu.Unlock()

	return p.initState.Start(ctx)
}
1309781
func start() {
	fmt.Printf("Starting %s...", AppName)
	if err := Start(1); err != nil {
		failed(err)
	} else {
		fmt.Println("OK")
	}
}
1020750
func (t *tree) startParse(lex *lexer) {
	t.Root = nil
	t.lex = lex
}
1169229
func (s *scanner) string() string {
	return s.buf[s.start:s.pos]
}
134438
func (p *Parser) Start() {
	go func() {
		defer close(p.Done)
		expressions := make([]Sexp, 0, SliceDefaultCap)

		// maybe we already have input, be optimistic!
		// no need to call p.GetMoreInput() before staring
		// our loop.

		for {
			expr, err := p.ParseExpression(0)
			if err != nil || expr == SexpEnd {
				if err == ParserHaltRequested {
					return
				}
				err = p.GetMoreInput(expressions, err)
				if err == ParserHaltRequested {
					return
				}
				// GetMoreInput will have delivered what we gave them. Reset since we
				// don't own that memory any more.
				expressions = make([]Sexp, 0, SliceDefaultCap)
			} else {
				// INVAR: err == nil && expr is not SexpEnd
				expressions = append(expressions, expr)
			}
		}
	}()
}
679546
func (s *UtxoSweeper) Start() error {
	if !atomic.CompareAndSwapUint32(&s.started, 0, 1) {
		return nil
	}

	log.Tracef("Sweeper starting")

	// Retrieve last published tx from database.
	lastTx, err := s.cfg.Store.GetLastPublishedTx()
	if err != nil {
		return fmt.Errorf("get last published tx: %v", err)
	}

	// Republish in case the previous call crashed lnd. We don't care about
	// the return value, because inputs will be re-offered and retried
	// anyway. The only reason we republish here is to prevent the corner
	// case where lnd goes into a restart loop because of a crashing publish
	// tx where we keep deriving new output script. By publishing and
	// possibly crashing already now, we haven't derived a new output script
	// yet.
	if lastTx != nil {
		log.Debugf("Publishing last tx %v", lastTx.TxHash())

		// Error can be ignored. Because we are starting up, there are
		// no pending inputs to update based on the publish result.
		err := s.cfg.PublishTransaction(lastTx)
		if err != nil && err != lnwallet.ErrDoubleSpend {
			log.Errorf("last tx publish: %v", err)
		}
	}

	// Retrieve relay fee for dust limit calculation. Assume that this will
	// not change from here on.
	s.relayFeePerKW = s.cfg.FeeEstimator.RelayFeePerKW()

	// Register for block epochs to retry sweeping every block.
	bestHash, bestHeight, err := s.cfg.ChainIO.GetBestBlock()
	if err != nil {
		return fmt.Errorf("get best block: %v", err)
	}

	log.Debugf("Best height: %v", bestHeight)

	blockEpochs, err := s.cfg.Notifier.RegisterBlockEpochNtfn(
		&chainntnfs.BlockEpoch{
			Height: bestHeight,
			Hash:   bestHash,
		},
	)
	if err != nil {
		return fmt.Errorf("register block epoch ntfn: %v", err)
	}

	// Start sweeper main loop.
	s.wg.Add(1)
	go func() {
		defer blockEpochs.Cancel()
		defer s.wg.Done()

		err := s.collector(blockEpochs.Epochs, bestHeight)
		if err != nil {
			log.Errorf("sweeper stopped: %v", err)
		}
	}()

	return nil
}
1353055
func (ln *Line) Prompt() (err error) {
	if _, err = term.Output.Write(DelLine_CR); err != nil {
		return outputError(err.Error())
	}
	if _, err = fmt.Fprint(term.Output, ln.ps1); err != nil {
		return outputError(err.Error())
	}

	ln.buf.pos, ln.buf.size = ln.lenPS1, ln.lenPS1
	return
}
375916
func (s *SlaveHealthChecker) Start() <-chan time.Time {
	go func() {
		t := time.NewTicker(s.checkDuration)
		defer t.Stop()
		for {
			select {
			case <-t.C:
				select {
				case <-s.stop:
					return
				default:
					// continue
				}
				if paused, slavepid := func() (x bool, y upid.UPID) {
					s.RLock()
					defer s.RUnlock()
					x = s.paused
					if s.slaveUPID != nil {
						y = *s.slaveUPID
					}
					return
				}(); !paused {
					s.doCheck(slavepid)
				}
			case <-s.stop:
				return
			}
		}
	}()
	return s.ch
}
1314482
func (posixSignalManager *PosixSignalManager) Start(gs gracefulshutdown.GSInterface) error {
	go func() {
		c := make(chan os.Signal, 1)
		signal.Notify(c, posixSignalManager.signals...)

		// Block until a signal is received.
		<-c

		gs.StartShutdown(posixSignalManager)
	}()

	return nil
}
779989
func parseExtends(t *Tree, start Pos) (Node, error) {
	if t.Root().Parent != nil {
		return nil, newMultipleExtendsError(start)
	}
	tplRef, err := t.parseExpr()
	if err != nil {
		return nil, err
	}
	_, err = t.expect(tokenTagClose)
	if err != nil {
		return nil, err
	}
	n := NewExtendsNode(tplRef, start)
	t.Root().Parent = n
	return n, nil
}
658980
func (q *queue) Start() {

	q.mutex.Lock()
	defer q.mutex.Unlock()

	if q.status == queueStopped {
		q.status = queueRunning
		go q.start()
	}
}
494216
func (sc *scanner) startToken(val *tokenValue) {
	sc.token = sc.rest
	val.raw = ""
	val.pos = sc.pos
}