From: khartlage Date: Sat, 1 Feb 2003 18:44:02 +0000 (+0000) Subject: optimized getIdentifier X-Git-Url: http://secure.phpeclipse.com optimized getIdentifier --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/phpparser/PHPParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/phpparser/PHPParser.java index ad5173d..7e87efa 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/phpparser/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/phpparser/PHPParser.java @@ -34,6 +34,7 @@ public class PHPParser extends PHPKeywords { public static final int ERROR = 2; public static final int WARNING = 1; public static final int INFO = 0; + private IFile fileToParse; private ArrayList phpList; @@ -1265,9 +1266,9 @@ public class PHPParser extends PHPKeywords { private void getIdentifier() { - StringBuffer ident = new StringBuffer(); - - ident.append(ch); + // StringBuffer ident = new StringBuffer(); + int startPosition = chIndx - 1; +// ident.append(ch); if (ch == '$') { getChar(); // attention recursive call: @@ -1280,12 +1281,15 @@ public class PHPParser extends PHPKeywords { getChar(); while ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || (ch == '_')) { - ident.append(ch); + // ident.append(ch); getChar(); } - identifier = ident.toString(); - chIndx--; + int endPosition = chIndx--; + int length = (--endPosition) - startPosition; + identifier = str.substring(startPosition, endPosition); + // System.out.println(identifier); + // determine if this identitfer is a keyword // @todo improve this in future version Integer i = (Integer) keywordMap.get(identifier.toLowerCase());