Skip to content

Commit 34b92dc

Browse files
committed
String validation edit
1 parent 9bcecee commit 34b92dc

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/main/java/SemanticOperations/VariableAssignment.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class VariableAssignment {
2020
private ConditionalCheck conditions;
2121
private JTextArea console;
2222
private Utilities tool;
23+
private int rowStringError;
2324

2425
public VariableAssignment(JTextArea console, ArrayList<Token> tokenList) {
2526
this.tokenList = tokenList;
@@ -171,7 +172,7 @@ private void evalExpressions() {
171172
for (Variable variable : variables) {
172173
if (variable.getType() == TokenType.CADENA) {
173174
ArrayList<String> row = splitExpression(variable.getValue());
174-
175+
rowStringError = variable.getRow();
175176
for (String item : row) {
176177
if (item.equals("+")) {
177178
} else if (item.equals("-") || item.equals("*") || item.equals("/")) {
@@ -209,6 +210,13 @@ private void assignDataTypes(int row, int contInt, int contDec, int contBool, in
209210
}
210211

211212
if (type == TokenType.NONE) {
213+
for (Variable var : variables) {
214+
if (var.getRow() == row) {
215+
var.setType(TokenType.NONE);
216+
var.setState(State.INDEFINIDO);
217+
break;
218+
}
219+
}
212220
showError("[SEMANTICO] Asignacion incorrecta", row);
213221
}
214222
}
146 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)