/** * Adds expression token * Method is caleld by the tokenExpressionString() * while parsing string expression * * @param tokenStr the token string * @param keyWord the key word */ private void addToken(String tokenStr, KeyWord keyWord) { Token token = new Token(); initialTokens.Add(token); token.tokenStr = tokenStr; token.keyWord = keyWord.wordString; token.tokenId = keyWord.wordId; token.tokenTypeId = keyWord.wordTypeId; if (token.tokenTypeId == Argument.TYPE_ID) token.tokenValue = argumentsList[token.tokenId].argumentValue; else if (token.tokenTypeId == ParserSymbol.NUMBER_TYPE_ID) { token.tokenValue = Double.Parse(token.tokenStr, NumberStyles.Float, CultureInfo.InvariantCulture); token.keyWord = ParserSymbol.NUMBER_STR; } }
/** * Token cloning. */ public Token clone() { Token token = new Token(); token.keyWord = keyWord; token.tokenStr = tokenStr; token.tokenId = tokenId; token.tokenLevel = tokenLevel; token.tokenTypeId = tokenTypeId; token.tokenValue = tokenValue; return token; }