/// <summary> /// Verifica se existe o token (id) dentro da tabela de simbolos, se não existir irá ser adicionado. /// </summary> /// <param name="token">Token que será validado.</param> public static void ExisteLexemaTabela(Token token) { if (TableOfSymbols.ReturnToken(token.Lexema) == null && token.EnumToken.ToString() == "ID") { TableOfSymbols.Add(token.Lexema.ToUpper(), token); } }
/// <summary> /// Busca e depois exibe todos os token que foram encontrados na leitura do arquivo. /// </summary> private void ImprimeToken() { Token token; Message.Print("TOKENS ENCONTRADOS: "); // Enquanto não houver erros ou não for fim de arquivo. do { token = ProxToken(); // Imprime token if (token != null) { Message.ShowToken(token, n_line, n_column); // Verificar se existe o lexema na tabela de símbolos if (TableOfSymbols.ReturnToken(token.Lexema) == null && token.EnumToken.ToString() == "ID") { TableOfSymbols.Add(token.Lexema.ToUpper(), token); } } } while (token != null && token.EnumToken != TokenEnum.EOF); if (ErrorMessage.errorFound != null) { ErrorMessage.ShowErrorFound(); } TableOfSymbols.ShowAllTableSymbols(); }