/// <summary> /// Retrieves the last token, that must be a name, and make it an alias instead /// </summary> void MakeLastTokenA(Token.TYPE _newType) { TokensCollection tokens = m_tokenCollections.Peek(); Token T = tokens.Last; if (T.m_type != Token.TYPE.NAME) { throw new Exception("Last token is not a name! Can't convert into an alias!"); } T.m_type = _newType; }
/// <summary> /// Adds a new token to the current collection /// </summary> /// <param name="T"></param> Token AddToken(Token.TYPE _type, object _value) { TokensCollection tokens = m_tokenCollections.Peek(); int streamIndex = m_stream.Index; if (_type == Token.TYPE.NAME && _value is Name) { streamIndex -= (_value as Name).ToString().Length; } Token T = new Token(streamIndex, _type, _value); tokens.Add(T); return(T); }
public void SetCurrentToken(Token.TYPE type) { currentToken = tokens[(int)type]; }