// Block renders a statement list enclosed by curly braces. Use for code blocks. A special case applies when used directly after Case or Default, where the braces are omitted. This allows use in switch and select statements.
977081
func (s *Statement) Block(statements ...Code) *Statement {
	g := &Group{
		close:     "}",
		items:     statements,
		multi:     true,
		name:      "block",
		open:      "{",
		separator: "",
	}
	*s = append(*s, g)
	return s
}
1093722
func (b *Blacklist) Block(path string) bool {
	_, _, blocked := b.tree.LongestPrefix(path)
	return blocked
}
274904
func (w Wrapper) Block(height *int64) (*ctypes.ResultBlock, error) {
	resBlock, err := w.Client.Block(height)
	if err != nil {
		return nil, err
	}
	// get a checkpoint to verify from
	resCommit, err := w.Commit(height)
	if err != nil {
		return nil, err
	}
	sh := resCommit.SignedHeader

	// now verify
	err = ValidateBlockMeta(resBlock.BlockMeta, sh)
	if err != nil {
		return nil, err
	}
	err = ValidateBlock(resBlock.Block, sh)
	if err != nil {
		return nil, err
	}
	return resBlock, nil
}
55575
func (g *BlockGate) Block(hash chainhash.Hash) (*dcrutil.Block, error) {
	// Try block cache first.
	block, err := g.CachedBlock(hash)
	if err == nil {
		return block, nil
	}

	// Cache miss. Retrieve from dcrd RPC.
	block, err = GetBlockByHash(&hash, g.client)
	if err != nil {
		return nil, fmt.Errorf("GetBlock (%v) failed: %v", hash, err)
	}

	g.mtx.RLock()
	fmt.Printf("Block cache miss: requested %d, cache capacity %d, tip %d.",
		block.Height(), g.expireQueue.cap, g.height)
	g.mtx.RUnlock()
	return block, nil
}
5888
func (v *evalVisitor) pushBlock(block *ast.BlockStatement) {
	v.blocks = append(v.blocks, block)
}
1005219
func blockEnd(data []byte, openSym byte, closeSym byte) int {
	level := 0
	i := 0
	ln := len(data)

	for i < ln {
		switch data[i] {
		case '"': // If inside string, skip it
			se, _ := stringEnd(data[i+1:])
			if se == -1 {
				return -1
			}
			i += se
		case openSym: // If open symbol, increase level
			level++
		case closeSym: // If close symbol, increase level
			level--

			// If we have returned to the original level, we're done
			if level == 0 {
				return i + 1
			}
		}
		i++
	}

	return -1
}
390190
func (d *Provider) Block() {
	if d.blocked == true {
		return
	}
	for key, defaultVal := range d.defaultInstances {
		if _, ok := d.instances[key]; !ok {
			if d.autoclean {
				delete(d.defaultFactories, key)
				delete(d.factories, key)
			}
			d.instances[key] = defaultVal
		}
	}
	d.defaultInstances = nil
	d.blocked = true
}
788802
func BlockType(block []byte) (byte, error) {
	blockType := block[0]
	switch blockType {
	case BlockFloat64, BlockInteger, BlockUnsigned, BlockBoolean, BlockString:
		return blockType, nil
	default:
		return 0, fmt.Errorf("unknown block type: %d", blockType)
	}
}
1064593
func (v *MrbValue) CallBlock(method string, args ...Value) (*MrbValue, error) {
	if len(args) == 0 {
		return nil, fmt.Errorf("args must be non-empty and have a proc at the end")
	}

	n := len(args)
	return v.call(method, args[:n-1], args[n-1])
}
297573
func (p *parser) parseOpenBlock() (*ast.BlockStatement, []string) {
	// OPEN_BLOCK | OPEN_INVERSE | OPEN_INVERSE_CHAIN
	tok := p.shift()

	// helperName param* hash? blockParams?
	result, blockParams := p.parseOpenBlockExpression(tok)

	// CLOSE
	tokClose := p.shift()
	if tokClose.Kind != lexer.TokenClose {
		errExpected(lexer.TokenClose, tokClose)
	}

	result.OpenStrip = ast.NewStrip(tok.Val, tokClose.Val)

	// named returned values
	return result, blockParams
}
931212
func (block *BestBlock) Hash() *chainhash.Hash {
	// Caller should check hash instead of error
	hash, _ := chainhash.NewHashFromStr(block.HashStr())
	return hash
}
259252
func (s *state) renderBlock(node ast.Node) []byte {
	var buf bytes.Buffer
	origWriter := s.wr
	s.wr = &buf
	s.walk(node)
	s.wr = origWriter
	return buf.Bytes()
}
576549
func (mat *T) maskedBlock(blockI, blockJ int) *mat3.T {
	var m mat3.T
	m_i := 0
	for i := 0; i < 4; i++ {
		if i == blockI {
			continue
		}
		m_j := 0
		for j := 0; j < 4; j++ {
			if j == blockJ {
				continue
			}
			m[m_i][m_j] = mat[i][j]
			m_j++
		}
		m_i++
	}
	return &m
}
269144
func (_m *ChainPuller) PullBlock(seq uint64) *common.Block {
	ret := _m.Called(seq)

	var r0 *common.Block
	if rf, ok := ret.Get(0).(func(uint64) *common.Block); ok {
		r0 = rf(seq)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*common.Block)
		}
	}

	return r0
}
642
func (e *Eval) Reblock(args *structs.EvalUpdateRequest, reply *structs.GenericResponse) error {
	if done, err := e.srv.forward("Eval.Reblock", args, args, reply); done {
		return err
	}
	defer metrics.MeasureSince([]string{"nomad", "eval", "reblock"}, time.Now())

	// Ensure there is only a single update with token
	if len(args.Evals) != 1 {
		return fmt.Errorf("only a single eval can be reblocked")
	}
	eval := args.Evals[0]

	// Verify the evaluation is outstanding, and that the tokens match.
	if err := e.srv.evalBroker.OutstandingReset(eval.ID, args.EvalToken); err != nil {
		return err
	}

	// Look for the eval
	snap, err := e.srv.fsm.State().Snapshot()
	if err != nil {
		return err
	}

	ws := memdb.NewWatchSet()
	out, err := snap.EvalByID(ws, eval.ID)
	if err != nil {
		return err
	}
	if out == nil {
		return fmt.Errorf("evaluation does not exist")
	}
	if out.Status != structs.EvalStatusBlocked {
		return fmt.Errorf("evaluation not blocked")
	}

	// Reblock the eval
	e.srv.blockedEvals.Reblock(eval, args.EvalToken)
	return nil
}
780402
func lexBlock(lx *lexer) stateFn {
	r := lx.next()

	//u.Debugf("lexBlock() pos=%d len=%d  %q", lx.pos, len(lx.input), lx.input[lx.pos:])

	switch {
	case r == blockEnd:

		lx.backup() // unconsume )  we are going to verify below
		lx.backup() // unconsume previous rune to ensure it is newline

		// Looking for a ')' character on a line by itself, if the previous
		// character isn't a new line, then break so we keep processing the block.
		if lx.next() != '\n' {
			lx.next() // if inline ( this will consume it
			break
		}
		lx.next()

		// Make sure the next character is a new line or an eof. We want a ')' on a
		// bare line by itself.
		switch r = lx.next(); r {
		case '\n', eof:
			if r == eof {
				lx.width = 1
			}
			lx.backup() // unconsume the \n, or eof
			r = lx.peek()
			if r != ')' { // For some reason on EOF we aren't where we think
				lx.backup() // unconsume the )
			}
			lx.backup() // unconsume the \n
			lx.emit(itemString)
			lx.next() // consume the previous line \n
			lx.next() // consume the )
			lx.ignore()
			return lx.pop()
		}
		lx.backup()
	}
	return lexBlock
}
1100106
func (b *Block) Hash() *chainhash.Hash {
	// Return the cached block hash if it has already been generated.
	if b.blockHash != nil {
		return b.blockHash
	}

	// Cache the block hash and return it.
	hash := b.msgBlock.BlockHash()
	b.blockHash = &hash
	return &hash
}