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.env.ICompilationUnit;
import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
public class Scanner implements IScanner, ITerminalSymbols {
public static final boolean TRACE = false;
+ public ICompilationUnit compilationUnit = null;
/**
* Determines if the specified character is permissible as the first character in a PHP identifier
*/
public final char[] getCurrentStringLiteralSource() {
// Return the token REAL source (aka unicodes are precomputed)
+ if (startPosition + 1 >= currentPosition) {
+ return new char[0];
+ }
char[] result;
int length;
System.arraycopy(source, startPosition + 1, result = new char[length = currentPosition - startPosition - 2], 0, length);
return result;
}
+ public final char[] getCurrentStringLiteralSource(int startPos) {
+ // Return the token REAL source (aka unicodes are precomputed)
+ char[] result;
+ int length;
+ System.arraycopy(source, startPos + 1, result = new char[length = currentPosition - startPos - 2], 0, length);
+ // }
+ return result;
+ }
/*
* Search the source position corresponding to the end of a given line number
*
case '#':
case '/': {
char startChar = currentCharacter;
- if (getNextChar('=')) {
+ if (getNextChar('=') && startChar=='/') {
return TokenNameDIVIDE_EQUAL;
}
int test;
}
public final void setSource(char[] source) {
+ setSource(null, source);
+ }
+
+ public final void setSource(ICompilationUnit compilationUnit, char[] source) {
//the source-buffer is set to sourceString
+ this.compilationUnit = compilationUnit;
if (source == null) {
this.source = new char[0];
} else {