blob: 185edda8a8d50b2ccf5b30c0394f68614a99bc0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package com.jantuomi.interpreter.main.core.parser.ast;
import com.jantuomi.interpreter.main.core.parser.datatype.DataContainer;
import com.jantuomi.interpreter.main.core.parser.datatype.StringDataContainer;
import com.jantuomi.interpreter.main.core.runtime.State;
import com.jantuomi.interpreter.main.core.tokenizer.token.Token;
import java.util.Arrays;
import java.util.List;
/**
* Created by jan on 20.6.2016.
*/
public class VariableDeclareNode extends ASTNode {
private SymbolNode variable;
public VariableDeclareNode(Token source, SymbolNode variable) {
super(source);
this.variable = variable;
}
@Override
public DataContainer evaluate() {
State.getInstance().addSymbolToScope(variable.getName());
return new StringDataContainer(variable.getName());
}
@Override
List<ASTNode> getChildren() {
return Arrays.asList();
}
}
|