Refactoring datatypes start (unstable)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include "../datatypes/lists.h"
|
||||
#include "../datatypes/lists/lists.h"
|
||||
|
||||
InstructionType strToInstructionType(std::string in) {
|
||||
if (in == "println") return InstructionType::Println;
|
||||
@@ -45,8 +45,10 @@ Instruction::Instruction(std::vector<Value> toks) {
|
||||
// Check type of value in first token, then compute token
|
||||
if (toks[0].valtype == ValueType::Real) {
|
||||
instruction = strToInstructionType(toks[0].real);
|
||||
} else if (toks[0].valtype == ValueType::Variable) {
|
||||
instruction = InstructionType::Variable;
|
||||
} else {
|
||||
error("Instruction should be a real");
|
||||
error("Instruction should be a real or variable value");
|
||||
}
|
||||
if (instruction == InstructionType::Variable) {
|
||||
for (const auto& tok : toks) {
|
||||
@@ -202,7 +204,7 @@ std::vector<Value> split(std::string line) {
|
||||
if (bracket_type == '(') {
|
||||
splitvals.push_back(Value(Instruction(split(buf))));
|
||||
} else {
|
||||
splitvals.push_back(Value(parse_list_content(buf)));
|
||||
splitvals.push_back(Value(parseListContent(buf)));
|
||||
}
|
||||
buf = "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user