Build a basic code block.
        Positional arguments should be instances of CodeBlock or strings.
        All code blocks passed as positional arguments are added at indentation level 0.
        None blocks are skipped.
348922
def block(self, *blocks, **kwargs) -> "CodeBlock":
        
        assert "name" not in kwargs
        kwargs.setdefault("code", self)
        code = CodeBlock(**kwargs)
        for block in blocks:
            if block is not None:
                code._blocks.append((0, block))
        return code
847996
def add_basic_block(self, basic_block):
        """"""
        assert(isinstance(basic_block, BasicBlock))
        self.basic_block_list.append(basic_block)
1156675
static ArrayBlock createArrayBlockInternal(int arrayOffset, int positionCount, @Nullable boolean[] valueIsNull, int[] offsets, Block values)
    {
        validateConstructorArguments(arrayOffset, positionCount, valueIsNull, offsets, values);
        return new ArrayBlock(arrayOffset, positionCount, valueIsNull, offsets, values);
    }
612623
function(){
    var tok = this.expect('indent');
    var block = this.emptyBlock(tok.loc.start.line);
    while ('outdent' != this.peek().type) {
      if ('newline' == this.peek().type) {
        this.advance();
      } else if ('text-html' == this.peek().type) {
        block.nodes = block.nodes.concat(this.parseTextHtml());
      } else {
        var expr = this.parseExpr();
        if (expr.type === 'Block') {
          block.nodes = block.nodes.concat(expr.nodes);
        } else {
          block.nodes.push(expr);
        }
      }
    }
    this.expect('outdent');
    return block;
  }
728881
def position_code(code_start)
      assemblers.each do |asm|
        Position.log.debug "Method start #{code_start.to_s(16)} #{asm.callable.name}"
        code_pos = CodeListener.init(asm.callable.binary, platform)
        instructions = asm.instructions
        InstructionListener.init( instructions, asm.callable.binary)
        code_pos.position_listener( LabelListener.new(instructions))
        code_pos.set(code_start)
        code_start = Position.get(asm.callable.binary.last_code).next_slot
      end
    end
810448
def beginning_of_code_block(node, line_number, full_contents, is_code_node):
    """"""
    if SPHINX_INSTALLED and not is_code_node:
        delta = len(node.non_default_attributes())
        current_line_contents = full_contents.splitlines()[line_number:]
        blank_lines = next(
            (i for (i, x) in enumerate(current_line_contents) if x),
            0)
        return (
            line_number +
            delta - 1 +
            blank_lines - 1 +
            SPHINX_CODE_BLOCK_DELTA)
    else:
        lines = full_contents.splitlines()
        code_block_length = len(node.rawsource.splitlines())

        try:
            # Case where there are no extra spaces.
            if lines[line_number - 1].strip():
                return line_number - code_block_length + 1
        except IndexError:
            pass

        # The offsets are wrong if the RST text has multiple blank lines after
        # the code block. This is a workaround.
        for line_number in range(line_number, 1, -1):
            if lines[line_number - 2].strip():
                break

        return line_number - code_block_length
1249629
def build_lines_data(self, code_obj):
        

        # Offset: lineno pairs, only for offsets which start line.
        # Locally we use list for more convenient iteration using indices
        if self.version > 1.4:
            linestarts = list(self.opc.findlinestarts(code_obj))
        else:
            linestarts = [[0, 1]]
        self.linestarts = dict(linestarts)

        # 'List-map' which shows line number of current op and offset of
        # first op on following line, given offset of op as index
        lines = []
        LineTuple = namedtuple('LineTuple', ['l_no', 'next'])

        # Iterate through available linestarts, and fill
        # the data for all code offsets encountered until
        # last linestart offset
        _, prev_line_no = linestarts[0]
        offset = 0
        for start_offset, line_no in linestarts[1:]:
            while offset < start_offset:
                lines.append(LineTuple(prev_line_no, start_offset))
                offset += 1
            prev_line_no = line_no

        # Fill remaining offsets with reference to last line number
        # and code length as start offset of following non-existing line
        codelen = len(self.code)
        while offset < codelen:
            lines.append(LineTuple(prev_line_no, codelen))
            offset += 1
        return lines
1136297
def _writeblocks(cls, blocks, available, cont_size, padding_func):
        """"""

        # write everything except padding
        data = bytearray()
        for block in blocks:
            if isinstance(block, Padding):
                continue
            data += cls._writeblock(block)
        blockssize = len(data)

        # take the padding overhead into account. we always add one
        # to make things simple.
        padding_block = Padding()
        blockssize += len(cls._writeblock(padding_block))

        # finally add a padding block
        info = PaddingInfo(available - blockssize, cont_size)
        padding_block.length = min(info._get_padding(padding_func),
                                   cls._MAX_SIZE)
        data += cls._writeblock(padding_block, is_last=True)

        return data
161274
private boolean handleCodeBlock(TextCursor cursor, ArrayList<MDSection> paragraphs) {
        if (mode != MODE_ONLY_LINKS) {
            int blockStart = findCodeBlockStart(cursor);
            if (blockStart >= 0) {
                int blockEnd = findCodeBlockEnd(cursor, blockStart);
                if (blockEnd >= 0) {
                    // Adding Text Block if there are some elements before code block
                    if (cursor.currentOffset < blockStart) {
                        handleTextBlock(cursor, blockStart, paragraphs);
                    }

                    String codeContent = cursor.text.substring(cursor.currentOffset + 3, blockEnd - 3).trim();

                    // TODO: Better removing of empty leading and tailing lines
                    // Required to remove only ONE line
                    if (codeContent.startsWith("\n")) {
                        codeContent = codeContent.substring(1);
                    }
                    if (codeContent.endsWith("\n")) {
                        codeContent = codeContent.substring(0, codeContent.length() - 1);
                    }

                    cursor.currentOffset = blockEnd;
                    paragraphs.add(new MDSection(new MDCode(codeContent)));
                    return true;
                }
            }
        }

        // Adding remaining text blocks
        if (cursor.currentOffset < cursor.text.length()) {
            handleTextBlock(cursor, cursor.text.length(), paragraphs);
        }
        return false;
    }
451875
def declare!(inst, *args, &block)
      _indent
      @target << "<!#{inst}"
      args.each do |arg|
        case arg
        when ::String
          @target << %{ "#{arg}"} # " WART
        when ::Symbol
          @target << " #{arg}"
        end
      end
      if ::Kernel::block_given?
        @target << " ["
        _newline
        _nested_structures(block)
        @target << "]"
      end
      @target << ">"
      _newline
    end
1211913
function parseComponentBlockParams(element, program) {
      var l = element.attributes.length;
      var attrNames = [];

      for (var i = 0; i < l; i++) {
        attrNames.push(element.attributes[i].name);
      }

      var asIndex = attrNames.indexOf('as');

      if (asIndex !== -1 && l > asIndex && attrNames[asIndex + 1].charAt(0) === '|') {
        // Some basic validation, since we're doing the parsing ourselves
        var paramsString = attrNames.slice(asIndex).join(' ');
        if (paramsString.charAt(paramsString.length - 1) !== '|' || paramsString.match(/\|/g).length !== 2) {
          throw new Error('Invalid block parameters syntax: \'' + paramsString + '\'');
        }

        var params = [];
        for (i = asIndex + 1; i < l; i++) {
          var param = attrNames[i].replace(/\|/g, '');
          if (param !== '') {
            if (ID_INVERSE_PATTERN.test(param)) {
              throw new Error('Invalid identifier for block parameters: \'' + param + '\' in \'' + paramsString + '\'');
            }
            params.push(param);
          }
        }

        if (params.length === 0) {
          throw new Error('Cannot use zero block parameters: \'' + paramsString + '\'');
        }

        element.attributes = element.attributes.slice(0, asIndex);
        program.blockParams = params;
      }
    }
980858
def create_for_block(
            cls, i=None, name=None, cname=None, version=None, **kwargs):
        

        if cname is None:
            cname = name or 'values_block_{idx}'.format(idx=i)
        if name is None:
            name = cname

        # prior to 0.10.1, we named values blocks like: values_block_0 an the
        # name values_0
        try:
            if version[0] == 0 and version[1] <= 10 and version[2] == 0:
                m = re.search(r"values_block_(\d+)", name)
                if m:
                    name = "values_{group}".format(group=m.groups()[0])
        except IndexError:
            pass

        return cls(name=name, cname=cname, **kwargs)
1319751
private CFG inlineAll() throws CFGBuilderException {
        CFG result = new CFG();

        Context rootContext = new Context(null, topLevelSubroutine, result);
        rootContext.mapBlock(topLevelSubroutine.getEntry(), result.getEntry());
        rootContext.mapBlock(topLevelSubroutine.getExit(), result.getExit());

        BasicBlock resultStartBlock = rootContext.getBlock(topLevelSubroutine.getStartBlock());
        result.createEdge(result.getEntry(), resultStartBlock, START_EDGE);

        inline(rootContext);

        return result;
    }
325517
private static List< Block > createBlocks(int[] data, boolean debug) {

        List< Block > blocks = new ArrayList<>();
        Block current = null;

        for (int i = 0; i < data.length; i++) {
            EncodingMode mode = chooseMode(data[i]);
            if ((current != null && current.mode == mode) &&
                (mode != EncodingMode.NUM || current.length < MAX_NUMERIC_COMPACTION_BLOCK_SIZE)) {
                current.length++;
            } else {
                current = new Block(mode);
                blocks.add(current);
            }
        }

        if (debug) {
            System.out.println("Initial block pattern: " + blocks);
        }

        smoothBlocks(blocks);

        if (debug) {
            System.out.println("Final block pattern: " + blocks);
        }

        return blocks;
    }
449107
public final void block() throws RecognitionException {
		int block_StartIndex = input.index();


		            increaseLevel();
		        
		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 80) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:693:5: ( '{' ( blockStatement )* '}' )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:693:7: '{' ( blockStatement )* '}'
			{
			match(input,121,FOLLOW_121_in_block2769); if (state.failed) return;
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:693:11: ( blockStatement )*
			loop104:
			while (true) {
				int alt104=2;
				int LA104_0 = input.LA(1);
				if ( ((LA104_0 >= CharacterLiteral && LA104_0 <= DecimalLiteral)||LA104_0==ENUM||LA104_0==FloatingPointLiteral||(LA104_0 >= HexLiteral && LA104_0 <= Identifier)||(LA104_0 >= OctalLiteral && LA104_0 <= StringLiteral)||LA104_0==29||LA104_0==36||(LA104_0 >= 40 && LA104_0 <= 41)||(LA104_0 >= 44 && LA104_0 <= 45)||(LA104_0 >= 52 && LA104_0 <= 53)||LA104_0==58||(LA104_0 >= 63 && LA104_0 <= 67)||(LA104_0 >= 70 && LA104_0 <= 73)||(LA104_0 >= 75 && LA104_0 <= 77)||(LA104_0 >= 79 && LA104_0 <= 80)||(LA104_0 >= 82 && LA104_0 <= 83)||(LA104_0 >= 85 && LA104_0 <= 87)||LA104_0==90||(LA104_0 >= 92 && LA104_0 <= 98)||(LA104_0 >= 100 && LA104_0 <= 112)||(LA104_0 >= 114 && LA104_0 <= 121)||LA104_0==126) ) {
					alt104=1;
				}

				switch (alt104) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:693:11: blockStatement
					{
					pushFollow(FOLLOW_blockStatement_in_block2771);
					blockStatement();
					state._fsp--;
					if (state.failed) return;
					}
					break;

				default :
					break loop104;
				}
			}

			match(input,125,FOLLOW_125_in_block2774); if (state.failed) return;
			}

			if ( state.backtracking==0 ) {
			            if( localVariableLevel <= 1 ) {
			                // this is the top level block, so set the top level declarations
			                rootBlockDescr.setInScopeLocalVars( getLocalDeclarations() );
			            }
			            decreaseLevel();
			        }
		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 80, block_StartIndex); }

		}
	}
218672
def tryCComment(self, block):
        
        indentation = None

        prevNonEmptyBlock = self._prevNonEmptyBlock(block)
        if not prevNonEmptyBlock.isValid():
            return None

        prevNonEmptyBlockText = prevNonEmptyBlock.text()

        if prevNonEmptyBlockText.endswith('*/'):
            try:
                foundBlock, notUsedColumn = self.findTextBackward(prevNonEmptyBlock, prevNonEmptyBlock.length(), '/*')
            except ValueError:
                foundBlock = None

            if foundBlock is not None:
                dbg("tryCComment: success (1) in line %d" % foundBlock.blockNumber())
                return self._lineIndent(foundBlock.text())

        if prevNonEmptyBlock != block.previous():
            # inbetween was an empty line, so do not copy the "*" character
            return None

        blockTextStripped = block.text().strip()
        prevBlockTextStripped = prevNonEmptyBlockText.strip()

        if prevBlockTextStripped.startswith('/*') and not '*/' in prevBlockTextStripped:
            indentation = self._blockIndent(prevNonEmptyBlock)
            if CFG_AUTO_INSERT_STAR:
                # only add '*', if there is none yet.
                indentation += ' '
                if not blockTextStripped.endswith('*'):
                    indentation += '*'
                secondCharIsSpace = len(blockTextStripped) > 1 and blockTextStripped[1].isspace()
                if not secondCharIsSpace and \
                   not blockTextStripped.endswith("*/"):
                    indentation += ' '
            dbg("tryCComment: success (2) in line %d" % block.blockNumber())
            return indentation

        elif prevBlockTextStripped.startswith('*') and \
             (len(prevBlockTextStripped) == 1 or prevBlockTextStripped[1].isspace()):

            # in theory, we could search for opening /*, and use its indentation
            # and then one alignment character. Let's not do this for now, though.
            indentation = self._lineIndent(prevNonEmptyBlockText)
            # only add '*', if there is none yet.
            if CFG_AUTO_INSERT_STAR and not blockTextStripped.startswith('*'):
                indentation += '*'
                if len(blockTextStripped) < 2 or not blockTextStripped[1].isspace():
                    indentation += ' '

            dbg("tryCComment: success (2) in line %d" % block.blockNumber())
            return indentation

        return None
31298
def pre_process_code_block(block):
        
        if 'indent' in block and block['indent']:
            indent = r'^' + block['indent']
            block['content'] = re.sub(indent, '', block['icontent'],
                                      flags=re.MULTILINE)