Parse an x86 instruction.
189794
def parse_instruction(string, location, tokens):
    
    prefix_str = tokens.get("prefix", None)
    mnemonic_str = tokens.get("mnemonic")
    operands = [op for op in tokens.get("operands", [])]

    infer_operands_size(operands)

    # Quick hack: Capstone returns rep instead of repe for cmps and scas
    # instructions.
    if prefix_str == "rep" and (mnemonic_str.startswith("cmps") or mnemonic_str.startswith("scas")):
        prefix_str = "repe"

    instr = X86Instruction(
        prefix_str,
        mnemonic_str,
        operands,
        arch_info.architecture_mode
    )

    return instr
1313553
def _read_mac_addr(self):
        """"""
        _byte = self._read_fileng(6)
        _addr = '-'.join(textwrap.wrap(_byte.hex(), 2))
        return _addr
1131434
function parse() {
  var msie = /MSIE.(\d+)/i.exec(ua);
  var rv = /Trident.+rv:(\d+)/i.exec(ua);
  var version = msie || rv || undefined;
  return version ? +version[1] : version;
}
1015887
def _parse_hwtype(self):
        """"""

        self.chip_name = KNOWN_HARDWARE_TYPES.get(self.hw_type, "Unknown Chip (type=%d)" % self.hw_type)
901218
void emitX86(INST_CODE code, Operand o1) {
        _emitX86(code, o1, _none, _none);
    }
1079278
def instruction_COM_memory(self, opcode, ea, m):
        
        r = self.COM(value=m)
#        log.debug("$%x COM memory $%x to $%x" % (
#            self.program_counter, m, r,
#        ))
        return ea, r & 0xff
1294358
def parse(self, instrs):
        
        instrs_reil = []

        try:
            for instr in instrs:
                instr_lower = instr.lower()

                # If the instruction to parsed is not in the cache,
                # parse it and add it to the cache.
                if instr_lower not in self._cache:
                    self._cache[instr_lower] = instruction.parseString(
                        instr_lower)[0]

                # Retrieve parsed instruction from the cache and clone
                # it.
                instrs_reil += [copy.deepcopy(self._cache[instr_lower])]
        except:
            error_msg = "Failed to parse instruction: %s"

            logger.error(error_msg, instr, exc_info=True)

        return instrs_reil
646740
def parse(self, string, parent):
        """"""
        result = {}
        for member in self.RE_MEMBERS.finditer(string):
            mems = self._process_member(member, parent, string)
            #The regex match could contain multiple members that were defined
            #on the same line in the code file.
            for onemem in mems:
                result[onemem.name.lower()] = onemem
                
        return result
846769
def parse(code, mode='exec', **exception_kwargs):
    """"""

    try:
        return _ast_util.parse(code, '<unknown>', mode)
    except Exception:
        raise exceptions.SyntaxException(
                    "(%s) %s (%r)" % (
                        compat.exception_as().__class__.__name__,
                        compat.exception_as(),
                        code[0:50]
                    ), **exception_kwargs)
572062
def parse_addr(text):
    ""
    if text:
        parts = text.split(':')
        length = len(parts)
        if length== 3:
            return parts[0], parts[1], int(parts[2])
        elif length == 2:
            return None, parts[0], int(parts[1])
        elif length == 1:
            return None, '', int(parts[0])
    return None, None, None
997244
def parse(self, *args, **kw):
        """"""

        ev = 'errex' in kw and kw.pop('errex')
        if ev and not isinstance(ev, int):
            raise TypeError("error exit value should be an integer")

        try:
            self.cmdline = self.parser.parse_args(*args, **kw)
        except OptParseError:
          if ev:
              sys.exit(ev)
          raise

        return self.fuse_args
811846
def assemble(io)
      operand = 0
      raise "invalid operand argument #{inspect}" unless (@first.is_a?(Array))
      @first.each do |r|
        raise "nil register in push, index #{r}- #{inspect}" if r.nil?
        operand = operand | (1 << reg_code(r))
      end
      val = operand
      val = val | (reg_code(@rn) <<             16)
      val = val | (is_pop <<              16 + 4) #20
      val = val | (1          <<          16 + 4 + 1)
      val = val | (@attributes[:update_status] <<  16 + 4 + 1 + 1)
      val = val | (up_down <<             16 + 4 + 1 + 1 + 1)
      val = val | (pre_post_index <<      16 + 4 + 1 + 1 + 1 + 1)#24
      val = val | instruction_code
      val = val | (cond <<                16 + 4 + 1 + 1 + 1 + 1 + 2 + 2)
      io.write_unsigned_int_32 val
    end
462172
def _Parse(self):
    """"""
    vslvm_logical_volume = self._file_entry.GetLVMLogicalVolume()

    volume_attribute = volume_system.VolumeAttribute(
        'identifier', vslvm_logical_volume.identifier)
    self._AddAttribute(volume_attribute)

    # TODO: implement in pyvslvm
    # TODO: add support for creation time
    # TODO: add support for logical volume extents
    volume_extent = volume_system.VolumeExtent(0, vslvm_logical_volume.size)
    self._extents.append(volume_extent)
774681
def parse(self, pointer):
        """"""
        if isinstance(pointer, Pointer):
            return pointer.tokens[:]
        elif pointer == '':
            return []

        tokens = []
        staged, _, children = pointer.partition('/')
        if staged:
            try:
                token = StagesToken(staged)
                token.last = False
                tokens.append(token)
            except ValueError:
                raise ParseError('pointer must start with / or int', pointer)

        if _:
            for part in children.split('/'):
                part = part.replace('~1', '/')
                part = part.replace('~0', '~')
                token = ChildToken(part)
                token.last = False
                tokens.append(token)

        return tokens
484478
def __parse_addr(self, addr):
        

        from email.utils import parseaddr

        value = parseaddr(addr)
        return value[0], value[1]
1097920
def encode_instruction(self, pc, instr):
        
        data = instr.split()
        operation = data[0]

        try:
            mips_op_info = MIPS.operations[operation]
        except KeyError, e:
            raise RuntimeError('Unknown operation: {}'.format(operation))

        # Grab the parsing info from the assembler operations table
        # Generate the initial operand map using the specified tokenizer
        parse_info = self.operations[operation]
        encoding_map = parse_info.tokenizer(parse_info.tokens, ''.join(data[1:]))

        # Get the binary equivalents of the operands and MIPS operation information
        self.resolve_operands(encoding_map, operation, pc)

        # Pull MIPS operation info into encoding map
        self.resolve_operation_info(encoding_map, mips_op_info)

        instruction = self.mips.generate_instruction(mips_op_info.format)
        return instruction.encode(encoding_map)
1266451
final void _emitOpCode(int opCode) {
        // instruction prefix
        if ((opCode & 0xFF000000) != 0) {
            _emitByte((byte) ((opCode & 0xFF000000) >> 24));
        }
        // instruction opcodes
        if ((opCode & 0x00FF0000) != 0) {
            _emitByte((byte) ((opCode & 0x00FF0000) >> 16));
        }
        if ((opCode & 0x0000FF00) != 0) {
            _emitByte((byte) ((opCode & 0x0000FF00) >> 8));
        }
        // last opcode is always emitted (can be also 0x00)
        _emitByte((byte) (opCode & 0x000000FF));
    }