public void advance() throws HDLException {
        if (!hasMoreTokens())
            HDLError("Unexpected end of file");

        try {
            switch (parser.ttype) {
                case StreamTokenizer.TT_NUMBER:
                    tokenType = TYPE_INT_CONST;
                    intValue = (int)parser.nval;
                    currentToken = String.valueOf(intValue);
                    break;
                case StreamTokenizer.TT_WORD:
                    currentToken = parser.sval;
                    Integer keywordCode = (Integer)keywords.get(currentToken);
                    if (keywordCode != null) {
                        tokenType = TYPE_KEYWORD;
                        keyWordType = keywordCode.intValue();
                    }
                    else {
                        tokenType = TYPE_IDENTIFIER;
                        identifier = currentToken;
                    }
                    break;
                default:
                    tokenType = TYPE_SYMBOL;
                    symbol = (char)parser.ttype;
                    currentToken = String.valueOf(symbol);
                    break;
            }
            parser.nextToken();
        } catch (IOException ioe) {
            throw new HDLException("Error while reading HDL file");
        }
    }