Improved aml scanner for this bug
authoraxelcl <axelcl>
Sun, 15 May 2005 23:09:09 +0000 (23:09 +0000)
committeraxelcl <axelcl>
Sun, 15 May 2005 23:09:09 +0000 (23:09 +0000)
See: http://garv.in/serendipity/archives/653-PHP-Eclipse-Bug.html

net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLPartitionScanner.java

index 4434faa..1064ca3 100644 (file)
@@ -8,7 +8,7 @@
  * Contributors:
  *     Igor Malinin - initial contribution
  *
- * $Id: XMLPartitionScanner.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
+ * $Id: XMLPartitionScanner.java,v 1.2 2005-05-15 23:09:09 axelcl Exp $
  */
 
 package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -100,8 +100,10 @@ public class XMLPartitionScanner implements IPartitionTokenScanner {
                                                state = STATE_DEFAULT;
                                                return getToken(XML_TAG);
 
-                                       case '?': // <?  <?PI
-                                               return nextPIToken();
+                                       case '?': // <?  <?PI 
+                                           unread();
+                                           break;
+//                                             return nextPIToken(); 
 
                                        case '!': // <!  <!DEFINITION or <![CDATA[ or <!--COMMENT
                                                switch (read()) {
@@ -147,6 +149,9 @@ public class XMLPartitionScanner implements IPartitionTokenScanner {
                                        length = 0;
                                        return nextToken();
                                }
+                               break;
+                   default:
+                       unread();
                }
 
 loop:
@@ -222,6 +227,8 @@ loop:
                                                        return getToken(XML_ATTRIBUTE);
                                        }
                                }
+                       default:
+                         unread();
                }
 
                while (true) {
@@ -490,28 +497,48 @@ loop:
                this.position = offset;
                this.length = 0;
 
-               this.state = STATE_DEFAULT;
+               this.state = STATE_DEFAULT;
        }
 
        /*
+          * @see org.eclipse.jface.text.rules.IPartitionTokenScanner
+          */
+//       public void setPartialRange(IDocument document, int offset, int length, String contentType, int partitionOffset) {
+//         state = STATE_DEFAULT;
+//         if (partitionOffset > -1) {
+//           int delta = offset - partitionOffset;
+//           if (delta > 0) {
+//             setRange(document, partitionOffset, length + delta);
+//             return;
+//           }
+//         }
+//         setRange(document, partitionOffset, length);
+//       }
+       /*
         * @see org.eclipse.jface.text.rules.IPartitionTokenScanner
         */
        public void setPartialRange(
                IDocument document, int offset, int length,
                String contentType, int partitionOffset
        ) {
+//       boolean flag = false;
                this.document = document;
                this.end = offset + length;
 
                // NB! Undocumented value: -1
                if (partitionOffset >= 0) {
                        offset = partitionOffset;
+//                     flag = true;
                }
 
                this.offset = offset;
                this.position = offset;
                this.length = 0;
 
+//             if (flag) {
+//               state = STATE_DEFAULT;
+//               return;
+//             }
                if (contentType == XML_ATTRIBUTE) {
                        state = STATE_TAG;
                        return;