1 /*******************************************************************************
2 * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v0.5
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v05.html
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.parser;
14 * Internal import structure for parsing recovery
16 import net.sourceforge.phpdt.internal.compiler.ast.AstNode;
17 import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
19 public class RecoveredImport extends RecoveredElement {
21 public ImportReference importReference;
22 public RecoveredImport(ImportReference importReference, RecoveredElement parent, int bracketBalance){
23 super(parent, bracketBalance);
24 this.importReference = importReference;
27 * Answer the associated parsed structure
29 public AstNode parseTree(){
30 return importReference;
33 * Answer the very source end of the corresponding parse node
35 public int sourceEnd(){
36 return this.importReference.declarationSourceEnd;
38 public String toString(int tab) {
39 return tabString(tab) + "Recovered import: " + importReference.toString(); //$NON-NLS-1$
41 public ImportReference updatedImportReference(){
43 return importReference;
45 public void updateParseTree(){
46 this.updatedImportReference();
49 * Update the declarationSourceEnd of the corresponding parse node
51 public void updateSourceEndIfNecessary(int sourceEnd){
52 if (this.importReference.declarationSourceEnd == 0) {
53 this.importReference.declarationSourceEnd = sourceEnd;
54 this.importReference.declarationEnd = sourceEnd;