public CompilationUnitDeclaration parse(
	ICompilationUnit sourceUnit,
	CompilationResult compilationResult,
	int start,
	int end) {
	// parses a compilation unit and manages error handling (even bugs....)

	CompilationUnitDeclaration unit;
	try {
		/* automaton initialization */
		initialize(true);
		goForCompilationUnit();

		/* unit creation */
		this.referenceContext =
			this.compilationUnit =
				new CompilationUnitDeclaration(
					this.problemReporter,
					compilationResult,
					0);


//		initializeInferenceEngine(this.compilationUnit);

		/* scanners initialization */
		char[] contents;
		try {
			contents = sourceUnit.getContents();
		} catch(AbortCompilationUnit abortException) {
			this.problemReporter().cannotReadSource(this.compilationUnit, abortException, this.options.verbose);
			contents = CharOperation.NO_CHAR; // pretend empty from thereon
		}
		this.scanner.setSource(contents);
		this.compilationUnit.sourceEnd = this.scanner.source.length - 1;
		if (end != -1) this.scanner.resetTo(start, end);
//		if (this.javadocParser != null && this.javadocParser.checkDocComment) {
//			this.javadocParser.scanner.setSource(contents);
//			if (end != -1) {
//				this.javadocParser.scanner.resetTo(start, end);
//			}
//		}
		/* run automaton */
		BalanceUtil balance = preParse(); // EBAY MOD
		
		parse();
		
		// START EBAY MOD
		m_hasNonFakeTokenInsertionError = compilationResult.hasErrors();
		if (balance != null) {
			Map<Integer,List<Tuple>> insertedTuples = balance.getTuplesToBeInserted();
			if (!insertedTuples.isEmpty()){
				for (List<Tuple> tuples : insertedTuples.values()) {
					if (!tuples.isEmpty()) {
						Tuple t = tuples.get(0); //only report first error for incomplete "." or ":"
						char[] tokenSrc = BalanceUtil.getTokenSource(t.m_previousToken);
						problemReporter().parseErrorInsertAfterToken(
							t.m_location, t.m_location, t.m_previousToken,
							tokenSrc, new String(tokenSrc), IDENTIFIER);
					}
				}
			}
			Map<Integer,Tuple> ignoredTuples = balance.getTuplesToBeIgnored();
			if (!ignoredTuples.isEmpty()){
				for (Tuple t : ignoredTuples.values()) {
					char[] tokenSrc = BalanceUtil.getTokenSource(t.m_token);
					problemReporter().parseErrorInsertAfterToken(
						t.m_location, t.m_location, t.m_token,
						tokenSrc, new String(tokenSrc), IDENTIFIER);
				}
			}
		}
		// END EBAY MOD
//if (false)
//	System.out.println("parsing "+new String(sourceUnit.getFileName())); //$NON-NLS-1$
	//	parse();
	} finally {
		unit = this.compilationUnit;
		this.compilationUnit = null; // reset parser
		// tag unit has having read bodies
		if (!this.diet) unit.bits |= ASTNode.HasAllMethodBodies;
	}
	return unit;
}