@@ -208,29 +208,41 @@ private boolean isDelimiter(String lexeme) {
208208 */
209209 private boolean isIdentifier (String lexeme , int tknIndex ) {
210210 boolean val = false ;
211+
212+ // Verifica si el token anterior es una excepción
211213 if (tknIndex >= 1 && tokenList .get (tknIndex - 1 ).getToken () == TokenType .EXCEPT ) {
212214 tokenType = TokenType .IDENTIFICADOR_EXCEPCION ;
213215 val = !val ;
214216 }
217+
218+ // Verifica si el siguiente token es '=' y si hay un valor válido después
215219 if (tknIndex < tokenList .size () - 1 && tokenList .get (tknIndex + 1 ).getLexeme ().equals ("=" )) {
216- if (tknIndex < tokenList .size () - 2 && tokenList .get (tknIndex + 2 ).getLexeme ().equals ("{" )) {
217- tokenType = TokenType .IDENTIFICADOR_CONJUNTO ;
218- } else if (tknIndex < tokenList .size () - 2 && tokenList .get (tknIndex + 2 ).getLexeme ().equals ("(" )) {
219- // tokenType = TokenType.IDENTIFICADOR_TUPLA;
220- tokenType = TokenType .IDENTIFICADOR ;
221- } else if (tknIndex < tokenList .size () - 2 && tokenList .get (tknIndex + 2 ).getLexeme ().equals ("[" )) {
222- tokenType = TokenType .IDENTIFICADOR_LISTA ;
220+ if (tknIndex < tokenList .size () - 2 ) {
221+ String nextLexeme = tokenList .get (tknIndex + 2 ).getLexeme ();
222+ if (nextLexeme .equals ("{" )) {
223+ tokenType = TokenType .IDENTIFICADOR_CONJUNTO ;
224+ } else if (nextLexeme .equals ("(" )) {
225+ tokenType = TokenType .IDENTIFICADOR ;
226+ } else if (nextLexeme .equals ("[" )) {
227+ tokenType = TokenType .IDENTIFICADOR_LISTA ;
228+ } else if (tokenList .get (tknIndex + 2 ).getRow () == tokenList .get (tknIndex + 1 ).getRow ()) { // Verifica que haya un valor válido después del '='
229+ tokenType = TokenType .IDENTIFICADOR ;
230+ } else {
231+ tokenType = TokenType .DESCONOCIDO ; // No hay valor después del '='
232+ }
233+ variableNames .add (lexeme );
234+ val = !val ;
223235 } else {
224- tokenType = TokenType .IDENTIFICADOR ;
236+ tokenType = TokenType .DESCONOCIDO ; // No hay tokens después del '='
225237 }
226- variableNames .add (lexeme );
227- val = !val ;
228238 } else if (variableNames .contains (lexeme )) {
229239 tokenType = TokenType .IDENTIFICADOR ;
230240 val = !val ;
231241 }
242+
232243 return val ;
233244 }
245+
234246
235247 /**
236248 * Este método compara los valores anteriores o posteriores de un token en
0 commit comments