Rename HTML editor to Smarty editor
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / parser / RecoveredElement.java
index 989e57a..169bebd 100644 (file)
@@ -1,27 +1,22 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials 
- * are made available under the terms of the Common Public License v0.5 
+ * are made available under the terms of the Common Public License v1.0
  * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
+ * http://www.eclipse.org/legal/cpl-v10.html
  * 
  * Contributors:
  *     IBM Corporation - initial API and implementation
- ******************************************************************************/
+ *******************************************************************************/
 package net.sourceforge.phpdt.internal.compiler.parser;
 
-/**
- * Internal structure for parsing recovery 
- */
-import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpdt.internal.compiler.ast.AstNode;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
 import net.sourceforge.phpdt.internal.compiler.ast.Block;
-import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
-import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
-import net.sourceforge.phpdt.internal.compiler.ast.LocalDeclaration;
 import net.sourceforge.phpdt.internal.compiler.ast.Statement;
-import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
 
+/**
+ * Internal structure for parsing recovery 
+ */
 public class RecoveredElement {
 
        public RecoveredElement parent;
@@ -39,16 +34,16 @@ public RecoveredElement(RecoveredElement parent, int bracketBalance, Parser pars
 /*
  *     Record a method declaration
  */
-public RecoveredElement add(AbstractMethodDeclaration methodDeclaration, int bracketBalance) {
-
-       /* default behavior is to delegate recording to parent if any */
-       if (parent == null) {
-               return this; // ignore
-       } else {
-               this.updateSourceEndIfNecessary(this.previousAvailableLineEnd(methodDeclaration.declarationSourceStart - 1));   
-               return this.parent.add(methodDeclaration, bracketBalance);
-       }
-}
+//public RecoveredElement add(AbstractMethodDeclaration methodDeclaration, int bracketBalance) {
+//
+//     /* default behavior is to delegate recording to parent if any */
+//     if (parent == null) {
+//             return this; // ignore
+//     } else {
+//             this.updateSourceEndIfNecessary(this.previousAvailableLineEnd(methodDeclaration.declarationSourceStart - 1));   
+//             return this.parent.add(methodDeclaration, bracketBalance);
+//     }
+//}
 /*
  * Record a nested block declaration
  */
@@ -65,42 +60,42 @@ public RecoveredElement add(Block nestedBlockDeclaration, int bracketBalance) {
 /*
  * Record a field declaration
  */
-public RecoveredElement add(FieldDeclaration fieldDeclaration, int bracketBalance) {
-
-       /* default behavior is to delegate recording to parent if any */
-       if (parent == null) {
-               return this; // ignore
-       } else {
-               this.updateSourceEndIfNecessary(this.previousAvailableLineEnd(fieldDeclaration.declarationSourceStart - 1));    
-               return this.parent.add(fieldDeclaration, bracketBalance);
-       }
-}
-/*
- *     Record an import reference
- */
-public RecoveredElement add(ImportReference importReference, int bracketBalance){
-
-       /* default behavior is to delegate recording to parent if any */
-       if (parent == null) {
-               return this; // ignore
-       } else {
-               this.updateSourceEndIfNecessary(this.previousAvailableLineEnd(importReference.declarationSourceStart - 1));     
-               return this.parent.add(importReference, bracketBalance);
-       }
-}
-/*
- * Record a local declaration
- */
-public RecoveredElement add(LocalDeclaration localDeclaration, int bracketBalance) {
-
-       /* default behavior is to delegate recording to parent if any */
-       if (parent == null) {
-               return this; // ignore
-       } else {
-               this.updateSourceEndIfNecessary(this.previousAvailableLineEnd(localDeclaration.declarationSourceStart - 1));    
-               return this.parent.add(localDeclaration, bracketBalance);
-       }
-}
+//public RecoveredElement add(FieldDeclaration fieldDeclaration, int bracketBalance) {
+//
+//     /* default behavior is to delegate recording to parent if any */
+//     if (parent == null) {
+//             return this; // ignore
+//     } else {
+//             this.updateSourceEndIfNecessary(this.previousAvailableLineEnd(fieldDeclaration.declarationSourceStart - 1));    
+//             return this.parent.add(fieldDeclaration, bracketBalance);
+//     }
+//}
+///*
+// *   Record an import reference
+// */
+//public RecoveredElement add(ImportReference importReference, int bracketBalance){
+//
+//     /* default behavior is to delegate recording to parent if any */
+//     if (parent == null) {
+//             return this; // ignore
+//     } else {
+//             this.updateSourceEndIfNecessary(this.previousAvailableLineEnd(importReference.declarationSourceStart - 1));     
+//             return this.parent.add(importReference, bracketBalance);
+//     }
+//}
+///*
+// * Record a local declaration
+// */
+//public RecoveredElement add(LocalDeclaration localDeclaration, int bracketBalance) {
+//
+//     /* default behavior is to delegate recording to parent if any */
+//     if (parent == null) {
+//             return this; // ignore
+//     } else {
+//             this.updateSourceEndIfNecessary(this.previousAvailableLineEnd(localDeclaration.declarationSourceStart - 1));    
+//             return this.parent.add(localDeclaration, bracketBalance);
+//     }
+//}
 /*
  * Record a statement
  */
@@ -117,16 +112,16 @@ public RecoveredElement add(Statement statement, int bracketBalance) {
 /*
  *     Record a type declaration
  */
-public RecoveredElement add(TypeDeclaration typeDeclaration, int bracketBalance){
-
-       /* default behavior is to delegate recording to parent if any */
-       if (parent == null) {
-               return this; // ignore
-       } else {
-               this.updateSourceEndIfNecessary(this.previousAvailableLineEnd(typeDeclaration.declarationSourceStart - 1));     
-               return this.parent.add(typeDeclaration, bracketBalance);
-       }
-}
+//public RecoveredElement add(TypeDeclaration typeDeclaration, int bracketBalance){
+//
+//     /* default behavior is to delegate recording to parent if any */
+//     if (parent == null) {
+//             return this; // ignore
+//     } else {
+//             this.updateSourceEndIfNecessary(this.previousAvailableLineEnd(typeDeclaration.declarationSourceStart - 1));     
+//             return this.parent.add(typeDeclaration, bracketBalance);
+//     }
+//}
 /*
  * Answer the depth of this element, considering the parent link.
  */
@@ -139,42 +134,42 @@ public int depth(){
 /*
  * Answer the enclosing method node, or null if none
  */
-public RecoveredInitializer enclosingInitializer(){
-       RecoveredElement current = this;
-       while (current != null){
-               if (current instanceof RecoveredInitializer){
-                       return (RecoveredInitializer) current;
-               }
-               current = current.parent;
-       }
-       return null;
-}
+//public RecoveredInitializer enclosingInitializer(){
+//     RecoveredElement current = this;
+//     while (current != null){
+//             if (current instanceof RecoveredInitializer){
+//                     return (RecoveredInitializer) current;
+//             }
+//             current = current.parent;
+//     }
+//     return null;
+//}
 /*
  * Answer the enclosing method node, or null if none
  */
-public RecoveredMethod enclosingMethod(){
-       RecoveredElement current = this;
-       while (current != null){
-               if (current instanceof RecoveredMethod){
-                       return (RecoveredMethod) current;
-               }
-               current = current.parent;
-       }
-       return null;
-}
+//public RecoveredMethod enclosingMethod(){
+//     RecoveredElement current = this;
+//     while (current != null){
+//             if (current instanceof RecoveredMethod){
+//                     return (RecoveredMethod) current;
+//             }
+//             current = current.parent;
+//     }
+//     return null;
+//}
 /*
  * Answer the enclosing type node, or null if none
  */
-public RecoveredType enclosingType(){
-       RecoveredElement current = this;
-       while (current != null){
-               if (current instanceof RecoveredType){
-                       return (RecoveredType) current;
-               }
-               current = current.parent;
-       }
-       return null;
-}
+//public RecoveredType enclosingType(){
+//     RecoveredElement current = this;
+//     while (current != null){
+//             if (current instanceof RecoveredType){
+//                     return (RecoveredType) current;
+//             }
+//             current = current.parent;
+//     }
+//     return null;
+//}
 /*
  * Answer the closest specified parser
  */
@@ -191,24 +186,24 @@ public Parser parser(){
 /* 
  * Answer the associated parsed structure
  */
-public AstNode parseTree(){
+public ASTNode parseTree(){
        return null;
 }
 /*
  * Iterate the enclosing blocks and tag them so as to preserve their content
  */
-public void preserveEnclosingBlocks(){
-       RecoveredElement current = this;
-       while (current != null){
-               if (current instanceof RecoveredBlock){
-                       ((RecoveredBlock)current).preserveContent = true;
-               }
-               if (current instanceof RecoveredType){ // for anonymous types
-                       ((RecoveredType)current).preserveContent = true;
-               }
-               current = current.parent;
-       }
-}
+//public void preserveEnclosingBlocks(){
+//     RecoveredElement current = this;
+//     while (current != null){
+//             if (current instanceof RecoveredBlock){
+//                     ((RecoveredBlock)current).preserveContent = true;
+//             }
+//             if (current instanceof RecoveredType){ // for anonymous types
+//                     ((RecoveredType)current).preserveContent = true;
+//             }
+//             current = current.parent;
+//     }
+//}
 /*
  * Answer the position of the previous line end if
  * there is nothing but spaces in between it and the
@@ -264,16 +259,16 @@ public String toString(int tab) {
 /*
  * Answer the enclosing type node, or null if none
  */
-public RecoveredType type(){
-       RecoveredElement current = this;
-       while (current != null){
-               if (current instanceof RecoveredType){
-                       return (RecoveredType) current;
-               }
-               current = current.parent;
-       }
-       return null;
-}
+//public RecoveredType type(){
+//     RecoveredElement current = this;
+//     while (current != null){
+//             if (current instanceof RecoveredType){
+//                     return (RecoveredType) current;
+//             }
+//             current = current.parent;
+//     }
+//     return null;
+//}
 /*
  * Update the bodyStart of the corresponding parse node
  */