Does the actual parsing. Perform this immediately
after creating the parser object.
177927
private void go(Reader r) throws IOException {
        BufferedReader reader;
        if (r instanceof BufferedReader)
            reader = (BufferedReader)r;
        else
            reader = new BufferedReader(r);
        doc.startDocument();
        while(true) {
			// read a new character
			if (previousCharacter == -1) {
				character = reader.read();
			}
			// or re-examine the previous character
			else {
				character = previousCharacter;
				previousCharacter = -1;
			}
			
			// the end of the file was reached
			if (character == -1) {
				if (html) {
					if (html && state == TEXT)
						flush();
					doc.endDocument();
				} else {
					throwException("Missing end tag");
				}
				return;
			}
            
			// dealing with  \n and \r
			if (character == '\n' && eol) {
				eol = false;
				continue;
			} else if (eol) {
				eol = false;
			} else if (character == '\n') {
				lines++;
				columns = 0;
			} else if (character == '\r') {
				eol = true;
				character = '\n';
				lines++;
				columns = 0;
			} else {
				columns++;
			}
            
			switch(state) {
            // we are in an unknown state before there's actual content
			case UNKNOWN:
                if(character == '<') {
                    saveState(TEXT);
                    state = TAG_ENCOUNTERED;
                }
                break;
            // we can encounter any content
			case TEXT:
                if(character == '<') {
                    flush();
                    saveState(state);
                    state = TAG_ENCOUNTERED;
                } else if(character == '&') {
                    saveState(state);
                    entity.setLength(0);
                    state = ENTITY;
                    nowhite = true;
                } else if (Character.isWhitespace((char)character)) {
                	if (nowhite)
                		text.append((char)character);
                	nowhite = false;
                } else {
                    text.append((char)character);
                    nowhite = true;
                }
                break;
            // we have just seen a < and are wondering what we are looking at
            // <foo>, </foo>, <!-- ... --->, etc.
			case TAG_ENCOUNTERED:
                initTag();
                if(character == '/') {
                    state = IN_CLOSETAG;
                } else if (character == '?') {
                    restoreState();
                    state = PI;
                } else {
                    text.append((char)character);
                    state = EXAMIN_TAG;
                }
                break;
            // we are processing something like this <foo ... >.
            // It could still be a <!-- ... --> or something.
			case EXAMIN_TAG:
                if(character == '>') {
                    doTag();
                    processTag(true);
                    initTag();
                    state = restoreState();
                } else if(character == '/') {
                    state = SINGLE_TAG;
                } else if(character == '-' && text.toString().equals("!-")) {
                    flush();
                    state = COMMENT;
                } else if(character == '[' && text.toString().equals("![CDATA")) {
                    flush();
                    state = CDATA;
                } else if(character == 'E' && text.toString().equals("!DOCTYP")) {
                    flush();
                    state = PI;
                } else if(Character.isWhitespace((char)character)) {
                    doTag();
                    state = TAG_EXAMINED;
                } else {
                    text.append((char)character);
                }
                break;
            // we know the name of the tag now.
			case TAG_EXAMINED:
                if(character == '>') {
                    processTag(true);
                    initTag();
                    state = restoreState();
                } else if(character == '/') {
                    state = SINGLE_TAG;
                } else if(Character.isWhitespace((char)character)) {
                    // empty
                } else {
                    text.append((char)character);
                    state = ATTRIBUTE_KEY;
                }
                break;
                
                // we are processing a closing tag: e.g. </foo>
			case IN_CLOSETAG:
                if(character == '>') {
                    doTag();
                    processTag(false);
                    if(!html && nested==0) return;
                    state = restoreState();
                } else {
                    if (!Character.isWhitespace((char)character))
                        text.append((char)character);
                }
                break;
                
            // we have just seen something like this: <foo a="b"/
            // and are looking for the final >.
			case SINGLE_TAG:
                if(character != '>')
                    throwException("Expected > for tag: <"+tag+"/>");
				doTag();
                processTag(true);
                processTag(false);
                initTag();
                if(!html && nested==0) {
                    doc.endDocument();
                    return;
                }
                state = restoreState();
                break;
                
            // we are processing CDATA
			case CDATA:
                if(character == '>'
                && text.toString().endsWith("]]")) {
                    text.setLength(text.length()-2);
                    flush();
                    state = restoreState();
                } else
                    text.append((char)character);
                break;
                
            // we are processing a comment.  We are inside
            // the <!-- .... --> looking for the -->.
			case COMMENT:
                if(character == '>'
                && text.toString().endsWith("--")) {
                    text.setLength(text.length() - 2);
                    flush();
                    state = restoreState();
                } else
                    text.append((char)character);
                break;
                
            // We are inside one of these <? ... ?> or one of these <!DOCTYPE ... >
			case PI:
                if(character == '>') {
                    state = restoreState();
                    if(state == TEXT) state = UNKNOWN;
                }
                break;
                
            // we are processing an entity, e.g. &lt;, &#187;, etc.
			case ENTITY:
                if(character == ';') {
                    state = restoreState();
                    String cent = entity.toString();
                    entity.setLength(0);
                    char ce = EntitiesToUnicode.decodeEntity(cent);
                    if (ce == '\0')
                    	text.append('&').append(cent).append(';');
                    else
                    	text.append(ce);
                } else if ((character != '#' && (character < '0' || character > '9') && (character < 'a' || character > 'z')
                    && (character < 'A' || character > 'Z')) || entity.length() >= 7) {
                    state = restoreState();
                    previousCharacter = character;
                    text.append('&').append(entity.toString());
                    entity.setLength(0);
                }
                else {
                    entity.append((char)character);
                }
                break;
            // We are processing the quoted right-hand side of an element's attribute.
			case QUOTE:
                if (html && quoteCharacter == ' ' && character == '>') {
                    flush();
                    processTag(true);
                    initTag();
                    state = restoreState();
                }
                else if (html && quoteCharacter == ' ' && Character.isWhitespace((char)character)) {
                	flush();
                    state = TAG_EXAMINED;
                }
                else if (html && quoteCharacter == ' ') {
                    text.append((char)character);
                }
                else if(character == quoteCharacter) {
                	flush();
                    state = TAG_EXAMINED;
                } else if(" \r\n\u0009".indexOf(character)>=0) {
                    text.append(' ');
                } else if(character == '&') {
                    saveState(state);
                    state = ENTITY;
                    entity.setLength(0);
                } else {
                    text.append((char)character);
                }
                break;
                
			case ATTRIBUTE_KEY:
                if(Character.isWhitespace((char)character)) {
                    flush();
                    state = ATTRIBUTE_EQUAL;
                } else if(character == '=') {
                	flush();
                    state = ATTRIBUTE_VALUE;
                } else if (html && character == '>') {
                    text.setLength(0);
                    processTag(true);
                    initTag();
                    state = restoreState();
                } else {
                    text.append((char)character);
                }
                break;
                
			case ATTRIBUTE_EQUAL:
                if(character == '=') {
                    state = ATTRIBUTE_VALUE;
                } else if(Character.isWhitespace((char)character)) {
                    // empty
                } else if (html && character == '>') {
                    text.setLength(0);
                    processTag(true);
                    initTag();
                    state = restoreState();
                } else if (html && character == '/') {
                    flush();
                    state = SINGLE_TAG;
                } else if (html) {
                    flush();
                    text.append((char)character);
                    state = ATTRIBUTE_KEY;
                } else {
                    throwException("Error in attribute processing.");
                }
                break;
                
			case ATTRIBUTE_VALUE:
                if(character == '"' || character == '\'') {
                    quoteCharacter = character;
                    state = QUOTE;
                } else if(Character.isWhitespace((char)character)) {
                    // empty
                } else if (html && character == '>') {
                    flush();
                    processTag(true);
                    initTag();
                    state = restoreState();
                } else if (html) {
                    text.append((char)character);
                    quoteCharacter = ' ';
                    state = QUOTE;
                } else {
                    throwException("Error in attribute processing");
                }
                break;
            }
        }
    }
755571
private void setupParser ()
    {
    // catch an illegal "nonsense" state.
    if (!prefixes && !namespaces)
        throw new IllegalStateException ();

    nsSupport.reset();
    if (uris)
        nsSupport.setNamespaceDeclUris (true);

    if (entityResolver != null) {
        parser.setEntityResolver(entityResolver);
    }
    if (dtdHandler != null) {
        parser.setDTDHandler(dtdHandler);
    }
    if (errorHandler != null) {
        parser.setErrorHandler(errorHandler);
    }
    parser.setDocumentHandler(this);
    locator = null;
    }
235663
public function consumeOpeningParenthesisToken(): void
    {
        if ($this->currentAnnotation !== null && $this->openedStringToken === null) {
            // We are in an annotation but not in a string, lets do something.
            if ($this->currentAnnotationContent === null) {
                if ($this->currentAnnotation->getLine() === $this->currentLine) {
                    // Begin content parsing only if it is on the same line.
                    $this->currentAnnotationContent = '';
                    $this->openedParenthesis++;
                }
            } else {
                $this->openedParenthesis++;
            }
        }
    }
306002
private void addDefaultParsers() {
		parsers = new ArrayList<IParser>();
		parsers.add(new GeldKarteParser(this));
		parsers.add(new EmvParser(this));
	}
364018
private void initializeParser(JsonParser parser) throws IOException {
    if (wrapperKeys.isEmpty()) {
      return;
    }
    boolean failed = true;
    try {
      String match = parser.skipToKey(wrapperKeys);
      Preconditions.checkArgument(
          match != null && parser.getCurrentToken() != JsonToken.END_OBJECT,
          "wrapper key(s) not found: %s",
          wrapperKeys);
      failed = false;
    } finally {
      if (failed) {
        parser.close();
      }
    }
  }
443919
public static void parse(Reader src, StatementHandler handler)
    throws IOException {
    new NTriplesParser(src, handler).parse();
  }
1074394
private void process(JsonParser jsonParser) throws IOException, ODataUnmarshallingException {
        if (jsonParser.getCurrentToken() == JsonToken.FIELD_NAME) {
            LOG.info("Starting to parse {} token", jsonParser.getCurrentName());
            String key = jsonParser.getCurrentName();
            jsonParser.nextToken();

            JsonToken token = jsonParser.getCurrentToken();
            if (token == JsonToken.START_ARRAY) {
                if (JsonConstants.VALUE.equals(key)) {
                    throw new ODataUnmarshallingException("Feed is not supported");
                }
                values.put(key, getCollectionValue(jsonParser));
            } else if (token == JsonToken.START_OBJECT) {
                values.put(key, getEmbeddedObject(jsonParser));
            } else {
                if (token.equals(JsonToken.VALUE_NULL)) {
                    values.put(key, null);
                } else {
                    values.put(key, jsonParser.getText());
                }
            }
        }
    }
1063058
function Parser(config) {
  if (!(this instanceof Parser)) return new Parser(config);

  this.config = config;

  this.config.on('read', function read(type) {
    this[type]();
  }.bind(this));
}
1209631
protected void applyParseHandlers() {
    sequenceFlows = new HashMap<String, SequenceFlow>();
    for (Process process : bpmnModel.getProcesses()) {
      currentProcess = process;
      if (process.isExecutable()) {
        bpmnParserHandlers.parseElement(this, process);
      }
    }
  }
301087
final protected function parseRow(): void
    {
        // only parse the next row if only one in buffer
        if (\count($this->bufferedRow) > 1) {
            return;
        }
        if (feof($this->file)) {
            $this->currentRow = null;

            return;
        }

        $this->currentRowEnded = false;
        // read file until row is ended
        while (!$this->currentRowEnded && !feof($this->file)) {
            $data = fread($this->file, 1024);
            xml_parse($this->parser, $data);
        }
    }
1184892
private void setupParse ()
    {
    if (parent == null) {
        throw new NullPointerException("No parent for filter");
    }
    parent.setEntityResolver(this);
    parent.setDTDHandler(this);
    parent.setContentHandler(this);
    parent.setErrorHandler(this);
    }
288586
public void parse() throws CompilationFailedException {
        if (this.phase > Phases.PARSING) {
            throw new GroovyBugError("parsing is already complete");
        }

        if (this.phase == Phases.INITIALIZATION) {
            nextPhase();
        }

        //
        // Create a reader on the source and run the parser.

        Reader reader = null;
        try {
            reader = source.getReader();

            // let's recreate the parser each time as it tends to keep around state
            parserPlugin = getConfiguration().getPluginFactory().createParserPlugin();

            cst = parserPlugin.parseCST(this, reader);

            reader.close();

        }
        catch (IOException e) {
            getErrorCollector().addFatalError(new SimpleMessage(e.getMessage(), this));
        }
        finally {
            if (reader != null) {
                try {
                    reader.close();
                }
                catch (IOException e) {
                    // Ignore
                }
            }
        }
    }
1257014
public synchronized final void parseDetails() {
        LOG.debug("parsing details of {}", this.getType());
        if (content != null) {
            ByteBuffer content = this.content;
            isParsed = true;
            content.rewind();
            _parseDetails(content);
            if (content.remaining() > 0) {
                deadBytes = content.slice();
            }
            this.content = null;
            assert verify(content);
        }
    }
1313000
def post_parse(self):
        """"""
        if self.cache and not self.cache_loaded:
            self.cache_writer_cls(self.file_name, self.wavefront).write()
831726
function() {
    var parser, source;
    source = this.source();
    if (source == null) {
      return;
    }
    parser = this.parser();
    if (parser != null) {
      return parser(source);
    } else {
      return source;
    }
  }
1210595
def init_parser():
    """"""

    usage = "Usage: %(prog)s <option(s)> <file(s)>"
    description = " Display information from object <file(s)>.\n"
    description += " At least one of the following switches must be given:"

    #
    # Create an argument parser and an exclusive group.
    #
    parser = ArgumentParser(
        usage=usage, description=description, add_help=False)

    group = parser.add_mutually_exclusive_group()

    #
    # Add objdump parameters.
    #
    group.add_argument("-a", "--archive-headers",
        action=DumpArchieveHeadersAction,
        type=FileType("r"), nargs="+",
        help="Display archive header information")

    group.add_argument("-f", "--file-headers",
        action=DumpFileHeadersAction,
        type=FileType("r"), nargs="+",
        help="Display the contents of the overall file header")

    #group.add_argument("-p", "--private-headers",    action="store", type=FileType("r"), nargs="+", help="Display object format specific file header contents")
    #group.add_argument("-P", "--private=OPT,OPT...", action="store", type=FileType("r"), nargs="+", help="Display object format specific contents")

    group.add_argument("-h", "--section-headers",
        action=DumpSectionHeadersAction,
        type=FileType("r"), nargs="+",
        help="Display the contents of the section headers")

    #group.add_argument("-x", "--all-headers",        action="store", type=FileType("r"), nargs="+", help="Display the contents of all headers")

    group.add_argument("-d", "--disassemble",
        action=DisassembleSectionAction,
        type=FileType("r"), nargs="+",
        help="Display assembler contents of executable sections")


    group.add_argument("-D", "--disassemble-all",
        action=DisassembleSectionsAction,
        type=FileType("r"), nargs="+",
        help="Display assembler contents of executable sections")

    #group.add_argument("-S", "--source",             action="store", type=FileType("r"), nargs="+", help="Intermix source code with disassembly")

    group.add_argument("-s", "--full-contents",
        action=DumpSectionContentAction,
        type=FileType("r"), nargs="+",
        help="Display the full contents of all sections requested")

    #group.add_argument("-g", "--debugging",          action="store", type=FileType("r"), nargs="+", help="Display debug information in object file")
    #group.add_argument("-e", "--debugging-tags",     action="store", type=FileType("r"), nargs="+", help="Display debug information using ctags style")
    #group.add_argument("-G", "--stabs",              action="store", type=FileType("r"), nargs="+", help="Display (in raw form) any STABS info in the file")

    #-W[lLiaprmfFsoRt] or")
    #--dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,")
    #      =frames-interp,=str,=loc,=Ranges,=pubtypes,")
    #      =gdb_index,=trace_info,=trace_abbrev,=trace_aranges]")
    #                       Display DWARF info in the file")

    group.add_argument("-t", "--syms",
        action=DumpFileSymbols,
        type=FileType("r"), nargs="+",
        help="Display the contents of the symbol table(s)")

    #-T, --dynamic-syms       Display the contents of the dynamic symbol table")
    #-r, --reloc              Display the relocation entries in the file")
    #-R, --dynamic-reloc      Display the dynamic relocation entries in the file")

    group.add_argument("-v", "--version", action="version",
        version="%%(prog)s %s (%s)" % (__version__, __description__),
        help="Display this program's version number")

    group.add_argument("-i", "--info",
        action=ListFormatAndArchitecturesInformationAction,
        nargs=REMAINDER,
        help="List object formats and architectures supported")

    group.add_argument("-H", "--help", action="store_true", default=False,
        help="Display this information")

    return parser
1123781
private void checkTimeout() throws ParserException {
	if (timeout > 0) {
	    if (System.currentTimeMillis() - startTime > timeout * 1000) {
		throw new ParserException("Timeout after " + timeout + " seconds near '"
			+ getTokenStream().getCodeSample(maxPosition) + "'!");
	    }
	}
    }