From 72fb2bb03d0969eeda7c8fff1d68c01795ec0917 Mon Sep 17 00:00:00 2001
From: khartlage <khartlage>
Date: Thu, 20 Mar 2003 20:48:53 +0000
Subject: [PATCH 1/1] php formatter based on the JDT java formatter (very early version)

---
 .../phpdt/internal/compiler/parser/Scanner.java    |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java
index 83f8e87..0dacb72 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java
@@ -719,9 +719,8 @@ public class Scanner implements IScanner, ITerminalSymbols {
   }
 
   public int getNextToken() throws InvalidInputException {
-
+    int htmlPosition = currentPosition;
     try {
-      int htmlPosition = currentPosition;
       while (!phpMode) {
         currentCharacter = source[currentPosition++];
         if (currentCharacter == '<') {
@@ -773,6 +772,11 @@ public class Scanner implements IScanner, ITerminalSymbols {
       }
     } //-----------------end switch while try--------------------
     catch (IndexOutOfBoundsException e) {
+      if (tokenizeWhiteSpace) {
+        // && (whiteStart != currentPosition - 1)) {
+        // reposition scanner in case we are interested by spaces as tokens
+        startPosition = htmlPosition;
+      }
       return TokenNameEOF;
     }
 
-- 
1.7.1