Refactored packagename to net.sourceforge.phpdt.internal.compiler.ast
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / parser / Scanner.java
index 0b12fc7..e4ed1ce 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others. All rights reserved. This program and the
  * accompanying materials are made available under the terms of the Common Public License v0.5 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/cpl-v05.html
- * 
+ *
  * Contributors: IBM Corporation - initial API and implementation
  **********************************************************************************************************************************/
 package net.sourceforge.phpdt.internal.compiler.parser;
@@ -15,8 +15,8 @@ import net.sourceforge.phpdt.core.compiler.CharOperation;
 import net.sourceforge.phpdt.core.compiler.IScanner;
 import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
 import net.sourceforge.phpdt.core.compiler.InvalidInputException;
+import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
 import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
-import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
 
 public class Scanner implements IScanner, ITerminalSymbols {
        /*
@@ -144,7 +144,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
        static final int[] ObviousIdentCharNatures = new int[MAX_OBVIOUS];
 
        public final static int C_DOLLAR = 8;
-       
+
        public final static int C_LETTER = 4;
 
        public final static int C_DIGIT = 3;
@@ -165,7 +165,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
                        ObviousIdentCharNatures[i] = C_LETTER;
 
                ObviousIdentCharNatures['$'] = C_DOLLAR;
-               
+
                ObviousIdentCharNatures[10] = C_SPACE; // \ u000a: LINE FEED
                ObviousIdentCharNatures[12] = C_SPACE; // \ u000c: FORM FEED
                ObviousIdentCharNatures[13] = C_SPACE; // \ u000d: CARRIAGE RETURN
@@ -278,10 +278,10 @@ public class Scanner implements IScanner, ITerminalSymbols {
        /**
         * Determines if the specified character is permissible as the first character
         * in a PHP identifier or variable
-        * 
+        *
         * The '$' character for PHP variables is regarded as a correct first
         * character !
-        * 
+        *
         */
        public static boolean isPHPIdentOrVarStart(char ch) {
                if (ch < MAX_OBVIOUS) {
@@ -294,7 +294,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
        /**
         * Determines if the specified character is permissible as the first character
         * in a PHP identifier.
-        * 
+        *
         * The '$' character for PHP variables isn't regarded as the first character !
         */
        public static boolean isPHPIdentifierStart(char ch) {
@@ -323,7 +323,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
                }
                return false;
        }
-       
+
        public final boolean atEnd() {
                // This code is not relevant if source is
                // Only a part of the real stream input
@@ -430,6 +430,11 @@ public class Scanner implements IScanner, ITerminalSymbols {
                return this.startPosition;
        }
 
+       public final String getCurrentStringLiteral() {
+               char[] result = getCurrentStringLiteralSource();
+               return new String(result);
+       }
+
        public final char[] getCurrentStringLiteralSource() {
                // Return the token REAL source (aka unicodes are precomputed)
                if (startPosition + 1 >= currentPosition) {
@@ -453,10 +458,10 @@ public class Scanner implements IScanner, ITerminalSymbols {
 
        /*
         * Search the source position corresponding to the end of a given line number
-        * 
+        *
         * Line numbers are 1-based, and relative to the scanner initialPosition.
         * Character positions are 0-based.
-        * 
+        *
         * In case the given line number is inconsistent, answers -1.
         */
        public final int getLineEnd(int lineNumber) {
@@ -475,12 +480,12 @@ public class Scanner implements IScanner, ITerminalSymbols {
        /**
         * Search the source position corresponding to the beginning of a given line
         * number
-        * 
+        *
         * Line numbers are 1-based, and relative to the scanner initialPosition.
         * Character positions are 0-based.
-        * 
+        *
         * e.g. getLineStart(1) --> 0 i.e. first line starts at character 0.
-        * 
+        *
         * In case the given line number is inconsistent, answers -1.
         */
        public final int getLineStart(int lineNumber) {
@@ -3760,7 +3765,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
 
        /**
         * Search the line number corresponding to a specific position
-        * 
+        *
         */
        public final int getLineNumber(int position) {
                if (lineEnds == null)
@@ -3967,7 +3972,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
                case TokenNameStringInterpolated:
                        return "StringInterpolated(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
                case TokenNameEncapsedString0:
-                       return "`"; //$NON-NLS-1$  
+                       return "`"; //$NON-NLS-1$
                        // case TokenNameEncapsedString1:
                        // return "\'"; //$NON-NLS-1$
                        // case TokenNameEncapsedString2: