1) Fixed issue #215: Escaping Strings
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / actions / IncludesScanner.java
index bb1c88f..f6ec655 100644 (file)
@@ -38,7 +38,7 @@ public class IncludesScanner implements ITerminalSymbols {
 
        /**
         * Add the information for a given IFile resource
-        * 
+        *
         */
        public void addFile(IFile fileToParse) {
 
@@ -75,8 +75,8 @@ public class IncludesScanner implements ITerminalSymbols {
        /**
         * Get the next token from input
         */
-       private int getNextToken(Scanner scanner) {
-               int token;
+       private TokenName getNextToken(Scanner scanner) {
+               TokenName token;
                try {
                        token = scanner.getNextToken();
                        if (Scanner.DEBUG) {
@@ -90,36 +90,33 @@ public class IncludesScanner implements ITerminalSymbols {
                        return token;
                } catch (InvalidInputException e) {
                }
-               return TokenNameERROR;
+               return TokenName.ERROR;
        }
 
        private void parseIdentifiers(char[] charArray) {
-               char[] ident;
                IFile file;
-               String identifier;
-               int counter = 0;
-
                Scanner scanner = new Scanner(false, false, false, false, true, null,
                                null, true /* taskCaseSensitive */);
                scanner.setSource(charArray);
                scanner.setPHPMode(false);
-               int token = getNextToken(scanner);
+               TokenName token = getNextToken(scanner);
                try {
-                       while (token != TokenNameEOF) { // && fToken != TokenNameERROR) {
-                               if (token == TokenNameinclude || token == TokenNameinclude_once
-                                               || token == TokenNamerequire
-                                               || token == TokenNamerequire_once) {
-                                       while (token != TokenNameEOF && token != TokenNameERROR
-                                                       && token != TokenNameSEMICOLON
-                                                       && token != TokenNameRPAREN
-                                                       && token != TokenNameLBRACE
-                                                       && token != TokenNameRBRACE) {
+                       while (token != TokenName.EOF) { // && fToken != TokenName.ERROR) {
+                               if (token == TokenName.INCLUDE || token == TokenName.INCLUDE_ONCE
+                                               || token == TokenName.REQUIRE
+                                               || token == TokenName.REQUIRE_ONCE) {
+                                       while (token != TokenName.EOF && token != TokenName.ERROR
+                                                       && token != TokenName.SEMICOLON
+                                                       && token != TokenName.RPAREN
+                                                       && token != TokenName.LBRACE
+                                                       && token != TokenName.RBRACE) {
                                                token = getNextToken(scanner);
-                                               if (token == TokenNameStringDoubleQuote
-                                                               || token == TokenNameStringSingleQuote) {
+                                               if (token == TokenName.STRINGDOUBLEQUOTE
+                                                               || token == TokenName.STRINGSINGLEQUOTE) {
                                                        char[] includeName = scanner
                                                                        .getCurrentStringLiteralSource();
                                                        try {
+                                                           System.out.println(includeName);
                                                                file = getIncludeFile(new String(includeName));
                                                                addFile(file);
                                                        } catch (Exception e) {
@@ -145,7 +142,6 @@ public class IncludesScanner implements ITerminalSymbols {
 
        public IFile getIncludeFile(String relativeFilename) {
                IContainer container = getWorkingLocation(fEditorInput);
-               String fullPath = fProject.getLocation().toString();
                IFile file = null;
                if (relativeFilename.startsWith("../")) {
                        Path path = new Path(relativeFilename);
@@ -169,7 +165,7 @@ public class IncludesScanner implements ITerminalSymbols {
 
        /**
         * Returns a list of includes
-        * 
+        *
         * @return the determined list of includes
         */
        public List getList() {
@@ -184,4 +180,4 @@ public class IncludesScanner implements ITerminalSymbols {
        public Set getSet() {
                return fSet;
        }
-}
\ No newline at end of file
+}