KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > compiler > parser > RecoveredStatement


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.compiler.parser;
12
13 /**
14  * Internal statement structure for parsing recovery
15  */

16 import org.eclipse.jdt.internal.compiler.ast.ASTNode;
17 import org.eclipse.jdt.internal.compiler.ast.Statement;
18
19 public class RecoveredStatement extends RecoveredElement {
20
21     public Statement statement;
22 public RecoveredStatement(Statement statement, RecoveredElement parent, int bracketBalance){
23     super(parent, bracketBalance);
24     this.statement = statement;
25 }
26 /*
27  * Answer the associated parsed structure
28  */

29 public ASTNode parseTree(){
30     return statement;
31 }
32 /*
33  * Answer the very source end of the corresponding parse node
34  */

35 public int sourceEnd(){
36     return this.statement.sourceEnd;
37 }
38 public String JavaDoc toString(int tab){
39     return tabString(tab) + "Recovered statement:\n" + statement.print(tab + 1, new StringBuffer JavaDoc(10)); //$NON-NLS-1$
40
}
41 public Statement updatedStatement(){
42     return statement;
43 }
44 public void updateParseTree(){
45     this.updatedStatement();
46 }
47 /*
48  * Update the declarationSourceEnd of the corresponding parse node
49  */

50 public void updateSourceEndIfNecessary(int bodyStart, int bodyEnd){
51     if (this.statement.sourceEnd == 0)
52         this.statement.sourceEnd = bodyEnd;
53 }
54 }
55
Popular Tags