1) Moved net.sourceforge.phpeclipse.ui\src\net\sourceforge\phpdt back to net.sourcefo...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / parser / AbstractCommentParser.java
index 08636d5..0bf383c 100644 (file)
@@ -15,6 +15,7 @@ import java.util.List;
 
 import net.sourceforge.phpdt.core.compiler.CharOperation;
 import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
+import net.sourceforge.phpdt.core.compiler.ITerminalSymbols.TokenName;
 import net.sourceforge.phpdt.core.compiler.InvalidInputException;
 
 /**
@@ -87,7 +88,7 @@ public abstract class AbstractCommentParser {
        protected int[] lineEnds;
 
        // Private fields
-       private int currentTokenType = -1;
+       private TokenName currentTokenType = ITerminalSymbols.TokenName.NONE;
 
        // Line pointers
        private int linePtr, lastLinePtr;
@@ -151,7 +152,7 @@ public abstract class AbstractCommentParser {
                        // Init local variables
                        this.astLengthPtr = -1;
                        this.astPtr = -1;
-                       this.currentTokenType = -1;
+                       this.currentTokenType = ITerminalSymbols.TokenName.NONE;
                        this.inlineTagStarted = false;
                        this.inlineTagStart = -1;
                        this.lineStarted = false;
@@ -179,16 +180,16 @@ public abstract class AbstractCommentParser {
                                }
 
                                // Read next char only if token was consumed
-                               if (this.currentTokenType < 0) {
+                               if (this.currentTokenType.compareTo (ITerminalSymbols.TokenName.NONE) <= 0) {
                                        nextCharacter = readChar(); // consider unicodes
                                } else {
                                        previousPosition = this.scanner
                                                        .getCurrentTokenStartPosition();
                                        switch (this.currentTokenType) {
-                                       case ITerminalSymbols.TokenNameRBRACE:
+                                       case RBRACE:
                                                nextCharacter = '}';
                                                break;
-                                       case ITerminalSymbols.TokenNameMULTIPLY:
+                                       case MULTIPLY:
                                                nextCharacter = '*';
                                                break;
                                        default:
@@ -241,10 +242,10 @@ public abstract class AbstractCommentParser {
                                                        pushText(this.textStart, invalidTagLineEnd);
                                                }
                                                this.scanner.resetTo(this.index, this.endComment);
-                                               this.currentTokenType = -1; // flush token cache at line
+                                               this.currentTokenType = ITerminalSymbols.TokenName.NONE; // flush token cache at line
                                                                                                        // begin
                                                try {
-                                                       int token = readTokenAndConsume();
+                                                       TokenName token = readTokenAndConsume();
                                                        this.tagSourceStart = this.scanner
                                                                        .getCurrentTokenStartPosition();
                                                        this.tagSourceEnd = this.scanner
@@ -261,10 +262,10 @@ public abstract class AbstractCommentParser {
                                                                // than java identifier
                                                                // (see bug
                                                                // https://bugs.eclipse.org/bugs/show_bug.cgi?id=51660)
-                                                               int tk = token;
+                                                               TokenName tk = token;
                                                                int le = this.lineEnd;
                                                                char pc = peekChar();
-                                                               tagNameToken: while (tk != ITerminalSymbols.TokenNameEOF) {
+                                                               tagNameToken: while (tk != ITerminalSymbols.TokenName.EOF) {
                                                                        this.tagSourceEnd = this.scanner
                                                                                        .getCurrentTokenEndPosition();
                                                                        token = tk;
@@ -306,7 +307,7 @@ public abstract class AbstractCommentParser {
                                                                this.lineEnd = le;
                                                        }
                                                        switch (token) {
-                                                       case ITerminalSymbols.TokenNameIdentifier:
+                                                       case IDENTIFIER:
                                                                if (CharOperation.equals(tag, TAG_DEPRECATED)) {
                                                                        this.deprecated = true;
                                                                        if (this.kind == DOM_PARSER) {
@@ -381,7 +382,7 @@ public abstract class AbstractCommentParser {
                                                                        valid = parseTag();
                                                                }
                                                                break;
-                                                       case ITerminalSymbols.TokenNamereturn:
+                                                       case RETURN:
                                                                valid = parseReturn();
                                                                // verify characters after return tag (we're
                                                                // expecting text description)
@@ -397,70 +398,70 @@ public abstract class AbstractCommentParser {
                                                                        }
                                                                }
                                                                break;
-                                                       // case ITerminalSymbols.TokenNamethrows :
+                                                       // case ITerminalSymbols.TokenName.throws :
                                                        // valid = parseThrows(true);
                                                        // break;
                                                        default:
                                                                if (this.kind == DOM_PARSER) {
                                                                        switch (token) {
-                                                                       case ITerminalSymbols.TokenNameabstract:
+                                                                       case ABSTRACT:
                                                                                // case
-                                                                               // ITerminalSymbols.TokenNameassert:
+                                                                               // ITerminalSymbols.TokenName.assert:
                                                                                // case
-                                                                               // ITerminalSymbols.TokenNameboolean:
-                                                                       case ITerminalSymbols.TokenNamebreak:
-                                                                               // case ITerminalSymbols.TokenNamebyte:
-                                                                       case ITerminalSymbols.TokenNamecase:
-                                                                       case ITerminalSymbols.TokenNamecatch:
-                                                                               // case ITerminalSymbols.TokenNamechar:
-                                                                       case ITerminalSymbols.TokenNameclass:
-                                                                       case ITerminalSymbols.TokenNamecontinue:
-                                                                       case ITerminalSymbols.TokenNamedefault:
-                                                                       case ITerminalSymbols.TokenNamedo:
+                                                                               // ITerminalSymbols.TokenName.boolean:
+                                                                       case BREAK:
+                                                                               // case byte:
+                                                                       case CASE:
+                                                                       case CATCH:
+                                                                               // case char:
+                                                                       case CLASS:
+                                                                       case CONTINUE:
+                                                                       case DEFAULT:
+                                                                       case DO:
                                                                                // case
-                                                                               // ITerminalSymbols.TokenNamedouble:
-                                                                       case ITerminalSymbols.TokenNameelse:
-                                                                       case ITerminalSymbols.TokenNameextends:
-                                                                               // case ITerminalSymbols.TokenNamefalse:
-                                                                       case ITerminalSymbols.TokenNamefinal:
-                                                                       case ITerminalSymbols.TokenNamefinally:
-                                                                               // case ITerminalSymbols.TokenNamefloat:
-                                                                       case ITerminalSymbols.TokenNamefor:
-                                                                       case ITerminalSymbols.TokenNameif:
-                                                                       case ITerminalSymbols.TokenNameimplements:
+                                                                               // double:
+                                                                       case ELSE:
+                                                                       case EXTENDS:
+                                                                               // case false:
+                                                                       case FINAL:
+                                                                       case FINALLY:
+                                                                               // case float:
+                                                                       case FOR:
+                                                                       case IF:
+                                                                       case IMPLEMENTS:
                                                                                // case
-                                                                               // ITerminalSymbols.TokenNameimport:
-                                                                       case ITerminalSymbols.TokenNameinstanceof:
-                                                                               // case ITerminalSymbols.TokenNameint:
-                                                                       case ITerminalSymbols.TokenNameinterface:
-                                                                               // case ITerminalSymbols.TokenNamelong:
+                                                                               // import:
+                                                                       case INSTANCEOF:
+                                                                               // case int:
+                                                                       case INTERFACE:
+                                                                               // case long:
                                                                                // case
-                                                                               // ITerminalSymbols.TokenNamenative:
-                                                                       case ITerminalSymbols.TokenNamenew:
-                                                                               // case ITerminalSymbols.TokenNamenull:
+                                                                               // native:
+                                                                       case NEW:
+                                                                               // case null:
                                                                                // case
-                                                                               // ITerminalSymbols.TokenNamepackage:
-                                                                       case ITerminalSymbols.TokenNameprivate:
-                                                                       case ITerminalSymbols.TokenNameprotected:
-                                                                       case ITerminalSymbols.TokenNamepublic:
-                                                                               // case ITerminalSymbols.TokenNameshort:
-                                                                       case ITerminalSymbols.TokenNamestatic:
+                                                                               // package:
+                                                                       case PRIVATE:
+                                                                       case PROTECTED:
+                                                                       case PUBLIC:
+                                                                               // case short:
+                                                                       case STATIC:
                                                                                // case
-                                                                               // ITerminalSymbols.TokenNamestrictfp:
-                                                                       case ITerminalSymbols.TokenNamesuper:
-                                                                       case ITerminalSymbols.TokenNameswitch:
+                                                                               // strictfp:
+                                                                       case SUPER:
+                                                                       case SWITCH:
                                                                                // case
-                                                                               // ITerminalSymbols.TokenNamesynchronized:
-                                                                               // case ITerminalSymbols.TokenNamethis:
-                                                                       case ITerminalSymbols.TokenNamethrow:
+                                                                               // synchronized:
+                                                                               // case this:
+                                                                       case THROW:
                                                                                // case
-                                                                               // ITerminalSymbols.TokenNametransient:
-                                                                               // case ITerminalSymbols.TokenNametrue:
-                                                                       case ITerminalSymbols.TokenNametry:
-                                                                               // case ITerminalSymbols.TokenNamevoid:
+                                                                               // transient:
+                                                                               // case true:
+                                                                       case TRY:
+                                                                               // case void:
                                                                                // case
-                                                                               // ITerminalSymbols.TokenNamevolatile:
-                                                                       case ITerminalSymbols.TokenNamewhile:
+                                                                               // volatile:
+                                                                       case WHILE:
                                                                                valid = parseTag();
                                                                                break;
                                                                        }
@@ -585,7 +586,7 @@ public abstract class AbstractCommentParser {
        }
 
        private void consumeToken() {
-               this.currentTokenType = -1; // flush token cache
+               this.currentTokenType = ITerminalSymbols.TokenName.NONE; // flush token cache
                updateLineEnd();
        }
 
@@ -699,7 +700,7 @@ public abstract class AbstractCommentParser {
                        }
                        if (typeRef == null) {
                                if (firstArg
-                                               && this.currentTokenType == ITerminalSymbols.TokenNameRPAREN) {
+                                               && this.currentTokenType == ITerminalSymbols.TokenName.RPAREN) {
                                        // verify characters after arguments declaration (expecting
                                        // white space or end comment)
                                        if (!verifySpaceOrEndComment()) {
@@ -723,11 +724,11 @@ public abstract class AbstractCommentParser {
                        int dim = 0;
                        long[] dimPositions = new long[20]; // assume that there won't be
                                                                                                // more than 20 dimensions...
-                       if (readToken() == ITerminalSymbols.TokenNameLBRACKET) {
+                       if (readToken() == ITerminalSymbols.TokenName.LBRACKET) {
                                int dimStart = this.scanner.getCurrentTokenStartPosition();
-                               while (readToken() == ITerminalSymbols.TokenNameLBRACKET) {
+                               while (readToken() == ITerminalSymbols.TokenName.LBRACKET) {
                                        consumeToken();
-                                       if (readToken() != ITerminalSymbols.TokenNameRBRACKET) {
+                                       if (readToken() != ITerminalSymbols.TokenName.RBRACKET) {
                                                break nextArg;
                                        }
                                        consumeToken();
@@ -738,7 +739,7 @@ public abstract class AbstractCommentParser {
 
                        // Read argument name
                        long argNamePos = -1;
-                       if (readToken() == ITerminalSymbols.TokenNameIdentifier) {
+                       if (readToken() == ITerminalSymbols.TokenName.IDENTIFIER) {
                                consumeToken();
                                if (firstArg) { // verify position
                                        if (iToken != 1)
@@ -772,16 +773,16 @@ public abstract class AbstractCommentParser {
                        }
 
                        // Read separator or end arguments declaration
-                       int token = readToken();
+                       TokenName token = readToken();
                        char[] name = argName == null ? new char[0] : argName;
-                       if (token == ITerminalSymbols.TokenNameCOMMA) {
+                       if (token == ITerminalSymbols.TokenName.COMMA) {
                                // Create new argument
                                Object argument = createArgumentReference(name, dim, typeRef,
                                                dimPositions, argNamePos);
                                arguments.add(argument);
                                consumeToken();
                                iToken++;
-                       } else if (token == ITerminalSymbols.TokenNameRPAREN) {
+                       } else if (token == ITerminalSymbols.TokenName.RPAREN) {
                                // verify characters after arguments declaration (expecting
                                // white space or end comment)
                                if (!verifySpaceOrEndComment()) {
@@ -818,37 +819,37 @@ public abstract class AbstractCommentParser {
                int start = this.scanner.getCurrentTokenStartPosition();
                if (Character.toLowerCase(readChar()) == 'a') {
                        this.scanner.currentPosition = this.index;
-                       if (readToken() == ITerminalSymbols.TokenNameIdentifier) {
-                               this.currentTokenType = -1; // do not update line end
+                       if (readToken() == ITerminalSymbols.TokenName.IDENTIFIER) {
+                               this.currentTokenType = ITerminalSymbols.TokenName.NONE; // do not update line end
                                try {
                                        if (CharOperation.equals(this.scanner
                                                        .getCurrentIdentifierSource(), new char[] { 'h',
                                                        'r', 'e', 'f' }, false)
-                                                       && readToken() == ITerminalSymbols.TokenNameEQUAL) {
-                                               this.currentTokenType = -1; // do not update line end
-                                               if (readToken() == ITerminalSymbols.TokenNameStringDoubleQuote
-                                                               || readToken() == ITerminalSymbols.TokenNameStringSingleQuote) {
-                                                       this.currentTokenType = -1; // do not update line
+                                                       && readToken() == ITerminalSymbols.TokenName.EQUAL) {
+                                               this.currentTokenType = ITerminalSymbols.TokenName.NONE; // do not update line end
+                                               if (readToken() == ITerminalSymbols.TokenName.STRINGDOUBLEQUOTE
+                                                               || readToken() == ITerminalSymbols.TokenName.STRINGSINGLEQUOTE) {
+                                                       this.currentTokenType = ITerminalSymbols.TokenName.NONE; // do not update line
                                                                                                                // end
                                                        // Skip all characters after string literal until
                                                        // closing '>' (see bug 68726)
                                                        while (this.index <= this.lineEnd
-                                                                       && readToken() != ITerminalSymbols.TokenNameGREATER) {
-                                                               this.currentTokenType = -1; // do not update
+                                                                       && readToken() != ITerminalSymbols.TokenName.GREATER) {
+                                                               this.currentTokenType = ITerminalSymbols.TokenName.NONE; // do not update
                                                                                                                        // line end
                                                        }
-                                                       if (this.currentTokenType == ITerminalSymbols.TokenNameGREATER) {
+                                                       if (this.currentTokenType == ITerminalSymbols.TokenName.GREATER) {
                                                                consumeToken(); // update line end as new lines
                                                                                                // are allowed in URL
                                                                                                // description
-                                                               while (readToken() != ITerminalSymbols.TokenNameLESS) {
+                                                               while (readToken() != ITerminalSymbols.TokenName.LESS) {
                                                                        if (this.scanner.currentPosition >= this.scanner.eofPosition
                                                                                        || this.scanner.currentCharacter == '@') {
                                                                                // Reset position: we want to rescan
                                                                                // last token
                                                                                this.index = this.tokenPreviousPosition;
                                                                                this.scanner.currentPosition = this.tokenPreviousPosition;
-                                                                               this.currentTokenType = -1;
+                                                                               this.currentTokenType = ITerminalSymbols.TokenName.NONE;
                                                                                // Signal syntax error
                                                                                if (this.sourceParser != null)
                                                                                        this.sourceParser
@@ -859,7 +860,7 @@ public abstract class AbstractCommentParser {
                                                                        }
                                                                        consumeToken();
                                                                }
-                                                               this.currentTokenType = -1; // do not update
+                                                               this.currentTokenType = ITerminalSymbols.TokenName.NONE; // do not update
                                                                                                                        // line end
                                                                if (readChar() == '/') {
                                                                        if (Character.toLowerCase(readChar()) == 'a') {
@@ -880,7 +881,7 @@ public abstract class AbstractCommentParser {
                // Reset position: we want to rescan last token
                this.index = this.tokenPreviousPosition;
                this.scanner.currentPosition = this.tokenPreviousPosition;
-               this.currentTokenType = -1;
+               this.currentTokenType = ITerminalSymbols.TokenName.NONE;
                // Signal syntax error
                if (this.sourceParser != null)
                        this.sourceParser.problemReporter().javadocInvalidSeeUrlReference(
@@ -901,13 +902,13 @@ public abstract class AbstractCommentParser {
                this.memberStart = start;
 
                // Get member identifier
-               if (readToken() == ITerminalSymbols.TokenNameIdentifier) {
+               if (readToken() == ITerminalSymbols.TokenName.IDENTIFIER) {
                        consumeToken();
                        pushIdentifier(true);
                        // Look for next token to know whether it's a field or method
                        // reference
                        int previousPosition = this.index;
-                       if (readToken() == ITerminalSymbols.TokenNameLPAREN) {
+                       if (readToken() == ITerminalSymbols.TokenName.LPAREN) {
                                consumeToken();
                                start = this.scanner.getCurrentTokenStartPosition();
                                try {
@@ -927,7 +928,7 @@ public abstract class AbstractCommentParser {
                        // Reset position: we want to rescan last token
                        this.index = previousPosition;
                        this.scanner.currentPosition = previousPosition;
-                       this.currentTokenType = -1;
+                       this.currentTokenType = ITerminalSymbols.TokenName.NONE;
 
                        // Verify character(s) after identifier (expecting space or end
                        // comment)
@@ -951,7 +952,7 @@ public abstract class AbstractCommentParser {
                // Reset position: we want to rescan last token
                this.index = this.tokenPreviousPosition;
                this.scanner.currentPosition = this.tokenPreviousPosition;
-               this.currentTokenType = -1;
+               this.currentTokenType = ITerminalSymbols.TokenName.NONE;
                return null;
        }
 
@@ -966,12 +967,12 @@ public abstract class AbstractCommentParser {
 
                try {
                        // Push identifier next
-                       int token = readToken();
+                       TokenName token = readToken();
                        switch (token) {
-                       case ITerminalSymbols.TokenNameIdentifier:
+                       case IDENTIFIER:
                                consumeToken();
                                return pushParamName();
-                       case ITerminalSymbols.TokenNameEOF:
+                       case EOF:
                                break;
                        default:
                                start = this.scanner.getCurrentTokenStartPosition();
@@ -987,7 +988,7 @@ public abstract class AbstractCommentParser {
                // Reset position to avoid missing tokens when new line was encountered
                this.index = this.tokenPreviousPosition;
                this.scanner.currentPosition = this.tokenPreviousPosition;
-               this.currentTokenType = -1;
+               this.currentTokenType = ITerminalSymbols.TokenName.NONE;
 
                // Report problem
                if (this.sourceParser != null)
@@ -1011,9 +1012,9 @@ public abstract class AbstractCommentParser {
                // Scan tokens
                int primitiveToken = -1;
                nextToken: for (int iToken = 0;; iToken++) {
-                       int token = readToken();
+                       TokenName token = readToken();
                        switch (token) {
-                       case ITerminalSymbols.TokenNameIdentifier:
+                       case IDENTIFIER:
                                if (((iToken % 2) > 0)) { // identifiers must be odd tokens
                                        break nextToken;
                                }
@@ -1021,22 +1022,22 @@ public abstract class AbstractCommentParser {
                                consumeToken();
                                break;
 
-                       case ITerminalSymbols.TokenNameDOT:
+                       case DOT:
                                if ((iToken % 2) == 0) { // dots must be even tokens
                                        throw new InvalidInputException();
                                }
                                consumeToken();
                                break;
 
-                       // case ITerminalSymbols.TokenNamevoid :
-                       // case ITerminalSymbols.TokenNameboolean :
-                       // case ITerminalSymbols.TokenNamebyte :
-                       // case ITerminalSymbols.TokenNamechar :
-                       // case ITerminalSymbols.TokenNamedouble :
-                       // case ITerminalSymbols.TokenNamefloat :
-                       // case ITerminalSymbols.TokenNameint :
-                       // case ITerminalSymbols.TokenNamelong :
-                       // case ITerminalSymbols.TokenNameshort :
+                       // case ITerminalSymbols.TokenName.void :
+                       // case ITerminalSymbols.TokenName.boolean :
+                       // case ITerminalSymbols.TokenName.byte :
+                       // case ITerminalSymbols.TokenName.char :
+                       // case ITerminalSymbols.TokenName.double :
+                       // case ITerminalSymbols.TokenName.float :
+                       // case ITerminalSymbols.TokenName.int :
+                       // case ITerminalSymbols.TokenName.long :
+                       // case ITerminalSymbols.TokenName.short :
                        // if (iToken > 0) {
                        // throw new InvalidInputException();
                        // }
@@ -1051,10 +1052,10 @@ public abstract class AbstractCommentParser {
                                }
                                if ((iToken % 2) == 0) { // cannot leave on a dot
                                        // Reset position: we want to rescan last token
-                                       if (this.kind == DOM_PARSER && this.currentTokenType != -1) {
+                                       if (this.kind == DOM_PARSER && this.currentTokenType.compareTo (ITerminalSymbols.TokenName.NONE) > 0) {
                                                this.index = this.tokenPreviousPosition;
                                                this.scanner.currentPosition = this.tokenPreviousPosition;
-                                               this.currentTokenType = -1;
+                                               this.currentTokenType = ITerminalSymbols.TokenName.NONE;
                                        }
                                        throw new InvalidInputException();
                                }
@@ -1062,10 +1063,10 @@ public abstract class AbstractCommentParser {
                        }
                }
                // Reset position: we want to rescan last token
-               if (this.currentTokenType != -1) {
+               if (this.currentTokenType.compareTo (ITerminalSymbols.TokenName.NONE) > 0) {
                        this.index = this.tokenPreviousPosition;
                        this.scanner.currentPosition = this.tokenPreviousPosition;
-                       this.currentTokenType = -1;
+                       this.currentTokenType = ITerminalSymbols.TokenName.NONE;
                }
                this.lastIdentifierEndPosition = (int) this.identifierPositionStack[this.identifierPtr];
                return createTypeReference(primitiveToken);
@@ -1084,10 +1085,10 @@ public abstract class AbstractCommentParser {
                int typeRefStartPosition = -1;
                nextToken: while (this.index < this.scanner.eofPosition) {
                        previousPosition = this.index;
-                       int token = readToken();
+                       TokenName token = readToken();
                        switch (token) {
-                       case ITerminalSymbols.TokenNameStringDoubleQuote: // @see "string"
-                       case ITerminalSymbols.TokenNameStringSingleQuote:
+                       case STRINGDOUBLEQUOTE: // @see "string"
+                       case STRINGSINGLEQUOTE:
                                int start = this.scanner.getCurrentTokenStartPosition();
                                consumeToken();
                                // If typeRef != null we may raise a warning here to let user
@@ -1107,8 +1108,7 @@ public abstract class AbstractCommentParser {
                                        this.sourceParser.problemReporter()
                                                        .javadocInvalidSeeReference(start, this.lineEnd);
                                return false;
-                       case ITerminalSymbols.TokenNameLESS: // @see "<a
-                                                                                                       // href="URL#Value">label</a>
+                       case LESS: // @see "<a href="URL#Value">label</a>
                                consumeToken();
                                start = this.scanner.getCurrentTokenStartPosition();
                                if (parseHref()) {
@@ -1132,7 +1132,7 @@ public abstract class AbstractCommentParser {
                                                                .javadocInvalidSeeReference(start, this.lineEnd);
                                }
                                return false;
-                       case ITerminalSymbols.TokenNameERROR:
+                       case ERROR:
                                if (this.scanner.currentCharacter == '#') { // @see ...#member
                                        consumeToken();
                                        reference = parseMember(typeRef);
@@ -1142,7 +1142,7 @@ public abstract class AbstractCommentParser {
                                        return false;
                                }
                                break nextToken;
-                       case ITerminalSymbols.TokenNameIdentifier:
+                       case IDENTIFIER:
                                if (typeRef == null) {
                                        typeRefStartPosition = this.scanner
                                                        .getCurrentTokenStartPosition();
@@ -1161,7 +1161,7 @@ public abstract class AbstractCommentParser {
                if (reference == null) {
                        this.index = this.tokenPreviousPosition;
                        this.scanner.currentPosition = this.tokenPreviousPosition;
-                       this.currentTokenType = -1;
+                       this.currentTokenType = ITerminalSymbols.TokenName.NONE;
                        if (this.sourceParser != null)
                                this.sourceParser.problemReporter().javadocMissingSeeReference(
                                                this.tagSourceStart, this.tagSourceEnd);
@@ -1171,7 +1171,7 @@ public abstract class AbstractCommentParser {
                // Reset position at the end of type reference
                this.index = this.lastIdentifierEndPosition + 1;
                this.scanner.currentPosition = this.index;
-               this.currentTokenType = -1;
+               this.currentTokenType = ITerminalSymbols.TokenName.NONE;
 
                // Verify that line end does not start with an open parenthese (which
                // could be a constructor reference wrongly written...)
@@ -1188,7 +1188,7 @@ public abstract class AbstractCommentParser {
                if (!verifySpaceOrEndComment()) {
                        this.index = this.tokenPreviousPosition;
                        this.scanner.currentPosition = this.tokenPreviousPosition;
-                       this.currentTokenType = -1;
+                       this.currentTokenType = ITerminalSymbols.TokenName.NONE;
                        int end = this.starPosition == -1 ? this.lineEnd
                                        : this.starPosition;
                        if (this.source[end] == '\n')
@@ -1226,7 +1226,7 @@ public abstract class AbstractCommentParser {
                // Reset position to avoid missing tokens when new line was encountered
                this.index = this.tokenPreviousPosition;
                this.scanner.currentPosition = this.tokenPreviousPosition;
-               this.currentTokenType = -1;
+               this.currentTokenType = ITerminalSymbols.TokenName.NONE;
                return false;
        }
 
@@ -1398,8 +1398,8 @@ public abstract class AbstractCommentParser {
        /*
         * Read token only if previous was consumed
         */
-       private int readToken() throws InvalidInputException {
-               if (this.currentTokenType < 0) {
+       private TokenName readToken() throws InvalidInputException {
+               if (this.currentTokenType.compareTo (ITerminalSymbols.TokenName.NONE) <= 0) {
                        this.tokenPreviousPosition = this.scanner.currentPosition;
                        this.currentTokenType = this.scanner.getNextToken();
                        if (this.scanner.currentPosition > (this.lineEnd + 1)) { // be
@@ -1416,7 +1416,7 @@ public abstract class AbstractCommentParser {
                                                                                                                                                // same
                                                                                                                                                // line)
                                this.lineStarted = false;
-                               while (this.currentTokenType == ITerminalSymbols.TokenNameMULTIPLY) {
+                               while (this.currentTokenType == ITerminalSymbols.TokenName.MULTIPLY) {
                                        this.currentTokenType = this.scanner.getNextToken();
                                }
                        }
@@ -1427,8 +1427,8 @@ public abstract class AbstractCommentParser {
                return this.currentTokenType;
        }
 
-       private int readTokenAndConsume() throws InvalidInputException {
-               int token = readToken();
+       private TokenName readTokenAndConsume() throws InvalidInputException {
+               TokenName token = readToken();
                consumeToken();
                return token;
        }