1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.parser;
14 * Internal statement structure for parsing recovery
16 import org.eclipse.jdt.internal.compiler.ast.ASTNode;
17 import org.eclipse.jdt.internal.compiler.ast.Statement;
19 public class RecoveredStatement extends RecoveredElement {
21 public Statement statement;
22 public RecoveredStatement(Statement statement, RecoveredElement parent, int bracketBalance){
23 super(parent, bracketBalance);
24 this.statement = statement;
27 * Answer the associated parsed structure
29 public ASTNode parseTree(){
33 * Answer the very source end of the corresponding parse node
35 public int sourceEnd(){
36 return this.statement.sourceEnd;
38 public String toString(int tab){
39 return tabString(tab) + "Recovered statement:\n" + statement.print(tab + 1, new StringBuffer(10)); //$NON-NLS-1$
41 public Statement updatedStatement(){
44 public void updateParseTree(){
45 this.updatedStatement();
48 * Update the declarationSourceEnd of the corresponding parse node
50 public void updateSourceEndIfNecessary(int bodyStart, int bodyEnd){
51 if (this.statement.sourceEnd == 0)
52 this.statement.sourceEnd = bodyEnd;