Parse a content particle.

<pre>
[48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?
</pre>
199466
private void parseCp() throws Exception {
        if (tryRead('(')) {
            dataBufferAppend('(');
            parseElements(readBuffer);
        } else {
            dataBufferAppend(readNmtoken(true));
            char c = readCh();
            switch (c) {
                case '?':
                case '*':
                case '+':
                    dataBufferAppend(c);
                    break;
                default:
                    unread(c);
                    break;
            }
        }
    }
396364
function (content) {
            var contentType = content.contentType;

            if (contentType && contentType in this.contentProcessors) {
                return this.processContent(this.contentProcessors[contentType].processContent(content));
            }
            return content.value || "";
        }
1059520
def _parse(self, content):
        
        if content:

            stream = BytesIO(str(content))
            data = json.loads(stream.getvalue())

            return data
189323
def __parseFormat(self, fmt, content, fps = 25):
        ''''''

        headerFound = False
        subSection = ''
        for lineNo, line in enumerate(content):
            line = self._initialLinePrepare(line, lineNo)
            if not fmt.WITH_HEADER and not self._formatFound and lineNo > self._maxFmtSearch:
                return

            subSection = ''.join([subSection, line])
            if fmt.WITH_HEADER and not headerFound:
                if lineNo > self._maxHeaderLen:
                    return
                headerFound = fmt.addHeaderInfo(subSection, self._subtitles.header())
                if headerFound:
                    self._formatFound = True
                    subSection = ''
            elif fmt.subtitleEnds(line) or (lineNo + 1) == len(content):
                subtitle = fmt.createSubtitle(fps, subSection)
                if subtitle is None:
                    if subSection in ('\n', '\r\n', '\r'):
                        subSection = ''
                        continue
                    elif self._subtitles.size() > 0:
                        raise SubParsingError(_("Parsing error"), lineNo)
                    else:
                        return

                # store parsing result if new end marker occurred, then clear results
                if subtitle.start and subtitle.text:
                    self._formatFound = True
                    try:
                        self._subtitles.append(subtitle)
                    except SubException as msg:
                        raise SubParsingError(msg, lineNo)
                elif subtitle.start and not subtitle.text:
                    pass
                else:
                    return
                subSection = ''
21408
function(type, text) {
            var parser = parsers.get(type);

            return parser.parsePage(text)
                .get('content');
        }
875662
private int parseListItem (int start) {
        start = skipSpacesToNewline(start, wikiLength); // skip spaces
        int end=parseItem(start, null, ContextType.LIST_ITEM);
        if ((listLevels[listLevel]=='>' || listLevels[listLevel]==':') &&
            wikiText.substring(start, end).trim().length()==0) { // empty line within blockquote/div
            if (!blockquoteBR) {
                sb.append("<br/><br/>");
                blockquoteBR=true;
            }
        }
        else {
            blockquoteBR=false;
        }
        return end;
    }
316268
function parseSequenceParameter( $parseSequenceKeyword, $funcName, &$args, $tpl, &$text, &$text_len, &$cur_pos,
                                     $relatedTemplateName, $startLine, $startColumn, $rootNamespace )
    {
        if ( $parseSequenceKeyword )
        {
            // parse 'sequence' keyword
            $sequenceEndPos = $this->ElementParser->identifierEndPosition( $tpl, $text, $cur_pos, $text_len );
            $sequence = substr( $text, $cur_pos, $sequenceEndPos-$cur_pos );
            if ( $sequence != 'sequence' )
            {
                $this->showParseErrorMessage( $tpl, $text, $text_len, $cur_pos, $relatedTemplateName, $startLine, $startColumn,
                                              $funcName, "Expected keyword 'sequence' not found" );
                return false;
            }
            $cur_pos = $sequenceEndPos;

            // skip whitespaces
            $cur_pos = $this->ElementParser->whitespaceEndPos( $tpl, $text, $cur_pos, $text_len );
        }

        // parse sequence array
        $args['sequence_array'] = $this->ElementParser->parseVariableTag( $tpl, $relatedTemplateName, $text, $cur_pos, $cur_pos, $text_len, $rootNamespace );

        // skip whitespaces
        $cur_pos = $this->ElementParser->whitespaceEndPos( $tpl, $text, $cur_pos, $text_len );

        // parse 'as' keyword
        $asEndPos = $this->ElementParser->identifierEndPosition( $tpl, $text, $cur_pos, $text_len );
        $word = substr( $text, $cur_pos, $asEndPos-$cur_pos );
        if ( $word != 'as' )
        {
            $this->showParseErrorMessage( $tpl, $text, $text_len, $cur_pos, $relatedTemplateName, $startLine, $startColumn,
                              $funcName, "Expected keyword 'as' not found" );
            unset( $args['sequence_array'] );
            return false;
        }
        $cur_pos = $asEndPos;

        // skip whitespaces
        $cur_pos = $this->ElementParser->whitespaceEndPos( $tpl, $text, $cur_pos, $text_len );

        // parse sequence variable
        $seqVar = $this->ElementParser->parseVariableTag( $tpl, $relatedTemplateName, $text, $cur_pos, $cur_pos, $text_len, $rootNamespace );
        if ( !$seqVar )
        {
            $this->showParseErrorMessage( $tpl, $text, $text_len, $cur_pos, $relatedTemplateName, $startLine, $startColumn,
                                          $funcName, "Sequence variable name cannot be empty" );
            unset( $args['sequence_array'] );
            return false;
        }
        $args['sequence_var'] = $seqVar;

        return true;
    }
974578
public boolean parseNext(ByteBuffer buffer) {
        if (DEBUG)
            LOG.debug("parseNext s={} {}", _state, BufferUtils.toDetailString(buffer));
        try {
            // Start a request/response
            if (_state == State.START) {
                _version = null;
                _method = null;
                _methodString = null;
                _endOfContent = EndOfContent.UNKNOWN_CONTENT;
                _header = null;
                if (quickStart(buffer))
                    return true;
            }

            // Request/response line
            if (_state.ordinal() >= State.START.ordinal() && _state.ordinal() < State.HEADER.ordinal()) {
                if (parseLine(buffer))
                    return true;
            }

            // parse headers
            if (_state == State.HEADER) {
                if (parseFields(buffer))
                    return true;
            }

            // parse content
            if (_state.ordinal() >= State.CONTENT.ordinal() && _state.ordinal() < State.TRAILER.ordinal()) {
                // Handle HEAD response
                if (_responseStatus > 0 && _headResponse) {
                    setState(State.END);
                    return handleContentMessage();
                } else {
                    if (parseContent(buffer))
                        return true;
                }
            }

            // parse headers
            if (_state == State.TRAILER) {
                if (parseFields(buffer))
                    return true;
            }

            // handle end states
            if (_state == State.END) {
                // eat white space
                while (buffer.remaining() > 0 && buffer.get(buffer.position()) <= HttpTokens.SPACE)
                    buffer.get();
            } else if (isClose() || isClosed()) {
                BufferUtils.clear(buffer);
            }

            // Handle EOF
            if (_eof && !buffer.hasRemaining()) {
                switch (_state) {
                    case CLOSED:
                        break;

                    case START:
                        setState(State.CLOSED);
                        _handler.earlyEOF();
                        break;

                    case END:
                    case CLOSE:
                        setState(State.CLOSED);
                        break;

                    case EOF_CONTENT:
                    case TRAILER:
                        if (_fieldState == FieldState.FIELD) {
                            // Be forgiving of missing last CRLF
                            setState(State.CLOSED);
                            return handleContentMessage();
                        }
                        setState(State.CLOSED);
                        _handler.earlyEOF();
                        break;

                    case CONTENT:
                    case CHUNKED_CONTENT:
                    case CHUNK_SIZE:
                    case CHUNK_PARAMS:
                    case CHUNK:
                        setState(State.CLOSED);
                        _handler.earlyEOF();
                        break;

                    default:
                        if (DEBUG)
                            LOG.debug("{} EOF in {}", this, _state);
                        setState(State.CLOSED);
                        _handler.badMessage(new BadMessageException(HttpStatus.BAD_REQUEST_400));
                        break;
                }
            }
        } catch (BadMessageException x) {
            BufferUtils.clear(buffer);
            badMessage(x);
        } catch (Throwable x) {
            BufferUtils.clear(buffer);
            badMessage(new BadMessageException(HttpStatus.BAD_REQUEST_400, _requestHandler != null ? "Bad Request" : "Bad Response", x));
        }
        return false;
    }
867988
def parse_fragment(lexer: Lexer) -> Union[FragmentSpreadNode, InlineFragmentNode]:
    
    start = lexer.token
    expect_token(lexer, TokenKind.SPREAD)

    has_type_condition = expect_optional_keyword(lexer, "on")
    if not has_type_condition and peek(lexer, TokenKind.NAME):
        return FragmentSpreadNode(
            name=parse_fragment_name(lexer),
            directives=parse_directives(lexer, False),
            loc=loc(lexer, start),
        )
    return InlineFragmentNode(
        type_condition=parse_named_type(lexer) if has_type_condition else None,
        directives=parse_directives(lexer, False),
        selection_set=parse_selection_set(lexer),
        loc=loc(lexer, start),
    )
266347
def parse(handle, seqtype=None, robust=False):
    ''''''
    if seqtype is None:
        seqtype = _get_seqtype_from_ext(handle)

    if seqtype.startswith('gz-'):
        handle = _unzip_handle(handle)
        seqtype = seqtype[3:]

    # False positive from pylint, both handles are fileobj-like
    # pylint: disable=redefined-variable-type
    if robust:
        if seqtype == "embl":
            handle = sanity_check_embl(handle)
        elif seqtype == "genbank":
            handle = sanity_check_genbank(handle)
        elif seqtype == "fasta":
            handle = sanity_check_fasta(handle)
    # pylint: enable=redefined-variable-type

    return SeqIO.parse(handle, seqtype)
269359
function parse(content, relative, filep) {
    relative = relative || '';
    CONTENT = '';
    JS_Files = [];
    CSS_Files = [];
    content = css(content, relative, filep);
    content = js(content, relative, filep);
    return {
        // content:insertScript(recall(content)),
        content: recall(content),
        js: distinct(JS_Files),
        css: distinct(CSS_Files)
    };
}
902561
private void parseContent() throws Exception {
        char c;

        while (true) {
            // consume characters (or ignorable whitspace) until delimiter
            parseCharData();

            // Handle delimiters
            c = readCh();
            switch (c) {
                case '&': // Found "&"
                    c = readCh();
                    if (c == '#') {
                        parseCharRef();
                    } else {
                        unread(c);
                        parseEntityRef(true);
                    }
                    isDirtyCurrentElement = true;
                    break;

                case '<': // Found "<"
                    dataBufferFlush();
                    c = readCh();
                    switch (c) {
                        case '!': // Found "<!"
                            c = readCh();
                            switch (c) {
                                case '-': // Found "<!-"
                                    require('-');
                                    isDirtyCurrentElement = false;
                                    parseComment();
                                    break;
                                case '[': // Found "<!["
                                    isDirtyCurrentElement = false;
                                    require("CDATA[");
                                    handler.startCDATA();
                                    inCDATA = true;
                                    parseCDSect();
                                    inCDATA = false;
                                    handler.endCDATA();
                                    break;
                                default:
                                    fatal("expected comment or CDATA section",
                                            c, null);
                                    break;
                            }
                            break;

                        case '?': // Found "<?"
                            isDirtyCurrentElement = false;
                            parsePI();
                            break;

                        case '/': // Found "</"
                            isDirtyCurrentElement = false;
                            parseETag();
                            return;

                        default: // Found "<" followed by something else
                            isDirtyCurrentElement = false;
                            unread(c);
                            parseElement(false);
                            break;
                    }
            }
        }
    }
1132696
def parse_headers(content_disposition, location=None, relaxed=False):
    

    LOGGER.debug(
        'Content-Disposition %r, Location %r', content_disposition, location)

    if content_disposition is None:
        return ContentDisposition(location=location)

    # Both alternatives seem valid.
    if False:
        # Require content_disposition to be ascii bytes (0-127),
        # or characters in the ascii range
        content_disposition = ensure_charset(content_disposition, 'ascii')
    else:
        # We allow non-ascii here (it will only be parsed inside of
        # qdtext, and rejected by the grammar if it appears in
        # other places), although parsing it can be ambiguous.
        # Parsing it ensures that a non-ambiguous filename* value
        # won't get dismissed because of an unrelated ambiguity
        # in the filename parameter. But it does mean we occasionally
        # give less-than-certain values for some legacy senders.
        content_disposition = ensure_charset(content_disposition, 'iso-8859-1')

    # Check the caller already did LWS-folding (normally done
    # when separating header names and values; RFC 2616 section 2.2
    # says it should be done before interpretation at any rate).
    # Hopefully space still means what it should in iso-8859-1.
    # This check is a bit stronger that LWS folding, it will
    # remove CR and LF even if they aren't part of a CRLF.
    # However http doesn't allow isolated CR and LF in headers outside
    # of LWS.

    if relaxed:
        # Relaxed has two effects (so far):
        # the grammar allows a final ';' in the header;
        # we do LWS-folding, and possibly normalise other broken
        # whitespace, instead of rejecting non-lws-safe text.
        # XXX Would prefer to accept only the quoted whitespace
        # case, rather than normalising everything.
        content_disposition = normalize_ws(content_disposition)
        parser = content_disposition_value_relaxed
    else:
        # Turns out this is occasionally broken: two spaces inside
        # a quoted_string's qdtext. Firefox and Chrome save the two spaces.
        if not is_lws_safe(content_disposition):
            raise ValueError(
                content_disposition, 'Contains nonstandard whitespace')

        parser = content_disposition_value

    try:
        parsed = parser.parse(content_disposition)
    except FullFirstMatchException:
        return ContentDisposition(location=location)
    return ContentDisposition(
        disposition=parsed[0], assocs=parsed[1:], location=location)
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
376259
def _parse_content(self, text):
        ''''''
        try:
            return super(OrphanHALNavigator, self)._parse_content(text)
        except exc.UnexpectedlyNotJSON:
            return {}
1102711
function parse_PtgAttrSemi(blob, length, opts) {
	var bitSemi = (blob[blob.l+1] & 0xFF) ? 1 : 0;
	blob.l += opts && opts.biff == 2 ? 3 : 4;
	return [bitSemi];
}
6943
function parse (string) {
  if (!string || typeof string !== 'string') {
    throw new TypeError('argument string is required')
  }

  var match = DISPOSITION_TYPE_REGEXP.exec(string)

  if (!match) {
    throw new TypeError('invalid type format')
  }

  // normalize type
  var index = match[0].length
  var type = match[1].toLowerCase()

  var key
  var names = []
  var params = {}
  var value

  // calculate index to start at
  index = PARAM_REGEXP.lastIndex = match[0].substr(-1) === ';'
    ? index - 1
    : index

  // match parameters
  while ((match = PARAM_REGEXP.exec(string))) {
    if (match.index !== index) {
      throw new TypeError('invalid parameter format')
    }

    index += match[0].length
    key = match[1].toLowerCase()
    value = match[2]

    if (names.indexOf(key) !== -1) {
      throw new TypeError('invalid duplicate parameter')
    }

    names.push(key)

    if (key.indexOf('*') + 1 === key.length) {
      // decode extended value
      key = key.slice(0, -1)
      value = decodefield(value)

      // overwrite existing value
      params[key] = value
      continue
    }

    if (typeof params[key] === 'string') {
      continue
    }

    if (value[0] === '"') {
      // remove quotes and escapes
      value = value
        .substr(1, value.length - 2)
        .replace(QESC_REGEXP, '$1')
    }

    params[key] = value
  }

  if (index !== -1 && index !== string.length) {
    throw new TypeError('invalid parameter format')
  }

  return new ContentDisposition(type, params)
}