forked from ground/ground
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			81d6e21a00
			...
			diamondnet
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 945f70d756 | 
@@ -2,7 +2,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## What is Ground?
 | 
					## What is Ground?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Ground is an interpreter which processes and interprets Ground instructions. It is quite fast, and the syntax is simple.
 | 
					Ground is a sigma interpreter which processes and interprets Ground instructions. It is quite fast, and the syntax is simple.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## What are the main features of Ground?
 | 
					## What are the main features of Ground?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,6 +44,12 @@ and jump to that (setting labels will be discussed below):
 | 
				
			|||||||
  jump %myLabel
 | 
					  jump %myLabel
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Reference a list (a list reference) with an asterisk:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					  setlist *myList $value1 $value2 # and so on
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Add comments with a `#`:
 | 
					Add comments with a `#`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
@@ -122,31 +128,31 @@ Note: You can also replace &var1 with a list or line reference to check if it al
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Allows you to initialize a list.
 | 
					Allows you to initialize a list.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Usage: `setlist &list $value1 $value2 $value3...`
 | 
					Usage: `setlist *list $value1 $value2 $value3...`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### setlistat
 | 
					#### setlistat
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Sets a list item at an index. The item at the index must already exist. Lists are index 0.
 | 
					Sets a list item at an index. The item at the index must already exist. Lists are index 0.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Usage: `setlistat &list $intvalue $value`
 | 
					Usage: `setlistat *list $intvalue $value`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### getlistat
 | 
					#### getlistat
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Gets a list item at an index, and puts it in the variable provided. The item at the index must already exist. Lists are index 0.
 | 
					Gets a list item at an index, and puts it in the variable provided. The item at the index must already exist. Lists are index 0.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Usage: `getlistat &list $intvalue &var`
 | 
					Usage: `getlistat *list $intvalue &var`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### getlistsize
 | 
					#### getlistsize
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Gets the size of a list and puts it in the variable provided.
 | 
					Gets the size of a list and puts it in the variable provided.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Usage: `getlistsize &list &var`
 | 
					Usage: `getlistsize *list &var`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### listappend
 | 
					#### listappend
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Appends an item to a list.
 | 
					Appends an item to a list.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Usage: `listappend &list $var`
 | 
					Usage: `listappend *list $var`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### String Operations
 | 
					### String Operations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
 Submodule libraries updated: 5e7de482e7...52e95e987f
									
								
							
							
								
								
									
										127
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										127
									
								
								src/main.cpp
									
									
									
									
									
								
							@@ -735,12 +735,6 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                        case Types::Bool:
 | 
					                        case Types::Bool:
 | 
				
			||||||
                            newVal.val = false;
 | 
					                            newVal.val = false;
 | 
				
			||||||
                            break;
 | 
					                            break;
 | 
				
			||||||
                        case Types::List:
 | 
					 | 
				
			||||||
                            {
 | 
					 | 
				
			||||||
                                List newList;
 | 
					 | 
				
			||||||
                                newVal.val = newList;
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                            break;
 | 
					 | 
				
			||||||
                        default:
 | 
					                        default:
 | 
				
			||||||
                            return error("You dingus you werent supposed to get here");
 | 
					                            return error("You dingus you werent supposed to get here");
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@@ -833,8 +827,12 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                    else if (holds_alternative<char>(get<Literal>(l.args[0]).val)) {
 | 
					                    else if (holds_alternative<char>(get<Literal>(l.args[0]).val)) {
 | 
				
			||||||
                        cout << get<char>(get<Literal>(l.args[0]).val);
 | 
					                        cout << get<char>(get<Literal>(l.args[0]).val);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    else if (holds_alternative<List>(get<Literal>(l.args[0]).val)) {
 | 
					                    else {
 | 
				
			||||||
                        List list = get<List>(get<Literal>(l.args[0]).val);
 | 
					                        return error("Couldn't print that", "printError");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                } else if (holds_alternative<ListRef>(l.args[0])) {
 | 
				
			||||||
 | 
					                    if (variables.find(get<ListRef>(l.args[0]).listName) != variables.end()) {
 | 
				
			||||||
 | 
					                        List list = get<List>(variables[get<ListRef>(l.args[0]).listName].val);
 | 
				
			||||||
                        cout << "[";
 | 
					                        cout << "[";
 | 
				
			||||||
                        for (int l = 0; l < list.val.size(); l++) {
 | 
					                        for (int l = 0; l < list.val.size(); l++) {
 | 
				
			||||||
                            if (holds_alternative<string>(list.val[l].val)) {
 | 
					                            if (holds_alternative<string>(list.val[l].val)) {
 | 
				
			||||||
@@ -863,10 +861,9 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                                cout << ", ";
 | 
					                                cout << ", ";
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        cout << "]" << endl;
 | 
					                        cout << "]";
 | 
				
			||||||
                    }
 | 
					                    } else {
 | 
				
			||||||
                    else {
 | 
					                        return error("Couldn't find list named " + get<ListRef>(l.args[0]).listName);
 | 
				
			||||||
                        return error("Couldn't print that", "printError");
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    return error("Argument of stdlnout must be a value (literal or a value reference)");
 | 
					                    return error("Argument of stdlnout must be a value (literal or a value reference)");
 | 
				
			||||||
@@ -901,8 +898,12 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                    else if (holds_alternative<char>(get<Literal>(l.args[0]).val)) {
 | 
					                    else if (holds_alternative<char>(get<Literal>(l.args[0]).val)) {
 | 
				
			||||||
                        cout << get<char>(get<Literal>(l.args[0]).val) << endl;
 | 
					                        cout << get<char>(get<Literal>(l.args[0]).val) << endl;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    else if (holds_alternative<List>(get<Literal>(l.args[0]).val)) {
 | 
					                    else {
 | 
				
			||||||
                        List list = get<List>(get<Literal>(l.args[0]).val);
 | 
					                        return error("Couldn't print that", "printError");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                } else if (holds_alternative<ListRef>(l.args[0])) {
 | 
				
			||||||
 | 
					                    if (variables.find(get<ListRef>(l.args[0]).listName) != variables.end()) {
 | 
				
			||||||
 | 
					                        List list = get<List>(variables[get<ListRef>(l.args[0]).listName].val);
 | 
				
			||||||
                        cout << "[";
 | 
					                        cout << "[";
 | 
				
			||||||
                        for (int l = 0; l < list.val.size(); l++) {
 | 
					                        for (int l = 0; l < list.val.size(); l++) {
 | 
				
			||||||
                            if (holds_alternative<string>(list.val[l].val)) {
 | 
					                            if (holds_alternative<string>(list.val[l].val)) {
 | 
				
			||||||
@@ -932,9 +933,8 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        cout << "]" << endl;
 | 
					                        cout << "]" << endl;
 | 
				
			||||||
                    }
 | 
					                    } else {
 | 
				
			||||||
                    else {
 | 
					                        return error("Couldn't find list named " + get<ListRef>(l.args[0]).listName);
 | 
				
			||||||
                        return error("Couldn't print that", "printError");
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    return error("Argument of stdlnout must be a value (literal or a value reference) or a list reference");
 | 
					                    return error("Argument of stdlnout must be a value (literal or a value reference) or a list reference");
 | 
				
			||||||
@@ -1064,12 +1064,6 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                            case Types::Bool:
 | 
					                            case Types::Bool:
 | 
				
			||||||
                                newVal.val = false;
 | 
					                                newVal.val = false;
 | 
				
			||||||
                                break;
 | 
					                                break;
 | 
				
			||||||
                            case Types::List:
 | 
					 | 
				
			||||||
                                {
 | 
					 | 
				
			||||||
                                    List newList;
 | 
					 | 
				
			||||||
                                    newVal.val = newList;
 | 
					 | 
				
			||||||
                                }
 | 
					 | 
				
			||||||
                                break;
 | 
					 | 
				
			||||||
                            default:
 | 
					                            default:
 | 
				
			||||||
                                return error("You dingus you werent supposed to get here");
 | 
					                                return error("You dingus you werent supposed to get here");
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
@@ -1090,8 +1084,8 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                    string listName;
 | 
					                    string listName;
 | 
				
			||||||
                    List listContents;
 | 
					                    List listContents;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (holds_alternative<Direct>(l.args[0])) {
 | 
					                    if (holds_alternative<ListRef>(l.args[0])) {
 | 
				
			||||||
                        listName = get<Direct>(l.args[0]).varName;
 | 
					                        listName = get<ListRef>(l.args[0]).listName;
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        return error("First argument of setlist must be a list reference");
 | 
					                        return error("First argument of setlist must be a list reference");
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@@ -1120,12 +1114,12 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                    return error("Could not find all arguments required for Getlistat inbuilt");
 | 
					                    return error("Could not find all arguments required for Getlistat inbuilt");
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    string listref;
 | 
					                    ListRef listref;
 | 
				
			||||||
                    int ref;
 | 
					                    int ref;
 | 
				
			||||||
                    Direct var;
 | 
					                    Direct var;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (holds_alternative<Direct>(l.args[0])) {
 | 
					                    if (holds_alternative<ListRef>(l.args[0])) {
 | 
				
			||||||
                        listref = get<Direct>(l.args[0]).varName;
 | 
					                        listref = get<ListRef>(l.args[0]);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        return error("First argument of getlistat must be a list reference");
 | 
					                        return error("First argument of getlistat must be a list reference");
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@@ -1146,19 +1140,19 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                        return error("Third argument of getlistat must be a direct reference");
 | 
					                        return error("Third argument of getlistat must be a direct reference");
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (variables.find(listref) != variables.end()) {
 | 
					                    if (variables.find(listref.listName) != variables.end()) {
 | 
				
			||||||
                        if (holds_alternative<List>(variables[listref].val)) {
 | 
					                        if (holds_alternative<List>(variables[listref.listName].val)) {
 | 
				
			||||||
                            if (get<List>(variables[listref].val).val.size() > ref) {
 | 
					                            if (get<List>(variables[listref.listName].val).val.size() > ref) {
 | 
				
			||||||
                                bool existed = variables.count(var.varName) > 0;
 | 
					                                bool existed = variables.count(var.varName) > 0;
 | 
				
			||||||
                                setVal(var.varName, get<List>(variables[listref].val).val[ref]);
 | 
					                                setVal(var.varName, get<List>(variables[listref.listName].val).val[ref]);
 | 
				
			||||||
                            } else {
 | 
					                            } else {
 | 
				
			||||||
                                return error("Index " + to_string(ref) + " out of range of list " + listref, "rangeError");
 | 
					                                return error("Index " + to_string(ref) + " out of range of list " + listref.listName, "rangeError");
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        } else {
 | 
					                        } else {
 | 
				
			||||||
                            return error("Variable " + listref + " is not a list");
 | 
					                            return error("Found a normal variable in place of a list");
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        return error("Unknown list: " + listref);
 | 
					                        return error("Unknown list: " + listref.listName);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
@@ -1221,12 +1215,12 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                    return error("Could not find all arguments required for Setlistat inbuilt");
 | 
					                    return error("Could not find all arguments required for Setlistat inbuilt");
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    string listref;
 | 
					                    ListRef listref;
 | 
				
			||||||
                    int ref;
 | 
					                    int ref;
 | 
				
			||||||
                    Literal value;
 | 
					                    Literal value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (holds_alternative<Direct>(l.args[0])) {
 | 
					                    if (holds_alternative<ListRef>(l.args[0])) {
 | 
				
			||||||
                        listref = get<Direct>(l.args[0]).varName;
 | 
					                        listref = get<ListRef>(l.args[0]);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        return error("First argument of setlistat must be a list reference");
 | 
					                        return error("First argument of setlistat must be a list reference");
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@@ -1246,22 +1240,20 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        return error("Third argument of setlistat must be a direct reference");
 | 
					                        return error("Third argument of setlistat must be a direct reference");
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    if (variables.find(listref) != variables.end()) {
 | 
					                    if (variables.find(listref.listName) != variables.end()) {
 | 
				
			||||||
                        if (holds_alternative<List>(variables[listref].val)) {
 | 
					                        if (holds_alternative<List>(variables[listref.listName].val)) {
 | 
				
			||||||
                            if (get<List>(variables[listref].val).val.size() > ref) {
 | 
					                            if (get<List>(variables[listref.listName].val).val.size() > ref) {
 | 
				
			||||||
                                List tmpList = get<List>(variables[listref].val);
 | 
					                                List tmpList = get<List>(variables[listref.listName].val);
 | 
				
			||||||
                                tmpList.val[ref] = value;
 | 
					                                tmpList.val[ref] = value;
 | 
				
			||||||
                                Literal tmpLit;
 | 
					                                Literal tmpLit;
 | 
				
			||||||
                                tmpLit.val = tmpList;
 | 
					                                tmpLit.val = tmpList;
 | 
				
			||||||
                                setVal(listref, tmpLit);
 | 
					                                setVal(listref.listName, tmpLit);
 | 
				
			||||||
                            } else {
 | 
					                            } else {
 | 
				
			||||||
                                return error("Index " + to_string(ref) + " out of range of list " + listref, "rangeError");
 | 
					                                return error("Index " + to_string(ref) + " out of range of list " + listref.listName, "rangeError");
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        } else {
 | 
					 | 
				
			||||||
                            return error("Variable " + listref + " is not a list");
 | 
					 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        return error("Unknown list: " + listref);
 | 
					                        return error("Unknown list: " + listref.listName);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
@@ -1274,11 +1266,11 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                    return error("Could not find all arguments required for Listappend inbuilt");
 | 
					                    return error("Could not find all arguments required for Listappend inbuilt");
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    string listref;
 | 
					                    ListRef listref;
 | 
				
			||||||
                    Literal value;
 | 
					                    Literal value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (holds_alternative<Direct>(l.args[0])) {
 | 
					                    if (holds_alternative<ListRef>(l.args[0])) {
 | 
				
			||||||
                        listref = get<Direct>(l.args[0]).varName;
 | 
					                        listref = get<ListRef>(l.args[0]);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        return error("First argument of listappend must be a list reference");
 | 
					                        return error("First argument of listappend must be a list reference");
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@@ -1289,17 +1281,17 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                        return error("Second argument of listappend must be a direct reference");
 | 
					                        return error("Second argument of listappend must be a direct reference");
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (variables.find(listref) != variables.end()) {
 | 
					                    if (variables.find(listref.listName) != variables.end()) {
 | 
				
			||||||
                        if (!holds_alternative<List>(variables[listref].val)) {
 | 
					                        if (!holds_alternative<List>(variables[listref.listName].val)) {
 | 
				
			||||||
                            return error("Variable " + listref + "is not a list");
 | 
					                            return error("Variable " + listref.listName + "is not a list");
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        List tmpList = get<List>(variables[listref].val);
 | 
					                        List tmpList = get<List>(variables[listref.listName].val);
 | 
				
			||||||
                        tmpList.val.push_back(value);
 | 
					                        tmpList.val.push_back(value);
 | 
				
			||||||
                        Literal tmpLit;
 | 
					                        Literal tmpLit;
 | 
				
			||||||
                        tmpLit.val = tmpList;
 | 
					                        tmpLit.val = tmpList;
 | 
				
			||||||
                        setVal(listref, tmpLit);
 | 
					                        setVal(listref.listName, tmpLit);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        return error("Unknown list: " + listref);
 | 
					                        return error("Unknown list: " + listref.listName);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
@@ -1312,11 +1304,11 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                    return error("Could not find all arguments required for Getlistsize inbuilt");
 | 
					                    return error("Could not find all arguments required for Getlistsize inbuilt");
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    string ref;
 | 
					                    ListRef ref;
 | 
				
			||||||
                    Direct var;
 | 
					                    Direct var;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (holds_alternative<Direct>(l.args[0])) {
 | 
					                    if (holds_alternative<ListRef>(l.args[0])) {
 | 
				
			||||||
                        ref = get<Direct>(l.args[0]).varName;
 | 
					                        ref = get<ListRef>(l.args[0]);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        return error("First argument of getlistsize must be a list reference");
 | 
					                        return error("First argument of getlistsize must be a list reference");
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@@ -1328,12 +1320,12 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    Literal newLit;
 | 
					                    Literal newLit;
 | 
				
			||||||
                    if (variables.find(ref) != variables.end()) {
 | 
					                    if (variables.find(ref.listName) != variables.end()) {
 | 
				
			||||||
                        newLit.val = int(get<List>(variables[ref].val).val.size());
 | 
					                        newLit.val = int(get<List>(variables[ref.listName].val).val.size());
 | 
				
			||||||
                        bool existed = variables.count(var.varName) > 0;
 | 
					                        bool existed = variables.count(var.varName) > 0;
 | 
				
			||||||
                        setVal(var.varName, newLit);
 | 
					                        setVal(var.varName, newLit);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        return error("Couldn't find the list " + ref);
 | 
					                        return error("Couldn't find the list " + ref.listName);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
@@ -2121,6 +2113,10 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                        if (variables.find(get<Direct>(l.args[0]).varName) != variables.end()) {
 | 
					                        if (variables.find(get<Direct>(l.args[0]).varName) != variables.end()) {
 | 
				
			||||||
                            exists = true;
 | 
					                            exists = true;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 | 
					                    } else if (holds_alternative<ListRef>(l.args[0])) {
 | 
				
			||||||
 | 
					                        if (variables.find(get<ListRef>(l.args[0]).listName) != variables.end() && holds_alternative<List>(variables[get<ListRef>(l.args[0]).listName].val)) {
 | 
				
			||||||
 | 
					                            exists = true;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                    } else if (holds_alternative<Line>(l.args[0])) {
 | 
					                    } else if (holds_alternative<Line>(l.args[0])) {
 | 
				
			||||||
                        Line line = get<Line>(l.args[0]);
 | 
					                        Line line = get<Line>(l.args[0]);
 | 
				
			||||||
                        if (line.isLabel) {
 | 
					                        if (line.isLabel) {
 | 
				
			||||||
@@ -2228,6 +2224,8 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                if (holds_alternative<Literal>(l.args[0])) {
 | 
					                if (holds_alternative<Literal>(l.args[0])) {
 | 
				
			||||||
                    return get<Literal>(l.args[0]);
 | 
					                    return get<Literal>(l.args[0]);
 | 
				
			||||||
 | 
					                } else if (holds_alternative<ListRef>(l.args[0])) {
 | 
				
			||||||
 | 
					                    return variables[get<ListRef>(l.args[0]).listName];
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    return error("First argument of return must be a literal value/value reference");
 | 
					                    return error("First argument of return must be a literal value/value reference");
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -2851,9 +2849,8 @@ vector<Instruction> parser(vector<vector<string>> in) {
 | 
				
			|||||||
                        break;
 | 
					                        break;
 | 
				
			||||||
                    case Types::ListRef:
 | 
					                    case Types::ListRef:
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            cout << "Note: List References are no longer supported and will be removed in future. Please reference lists using a direct reference (&) instead. Converting to a Direct reference." << endl;
 | 
					                            ListRef newLR;
 | 
				
			||||||
                            Direct newLR;
 | 
					                            newLR.listName = i.substr(1);
 | 
				
			||||||
                            newLR.varName = i.substr(1);
 | 
					 | 
				
			||||||
                            newInst.args.push_back(newLR);
 | 
					                            newInst.args.push_back(newLR);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        break;
 | 
					                        break;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
# A cool list
 | 
					# A cool list
 | 
				
			||||||
setlist *favWords "hello" "there" "general" "kenobi"
 | 
					setlist *favWords "hello" "there" "general" "kenobi"
 | 
				
			||||||
stdlnout $favWords
 | 
					stdlnout *favWords
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set &count 0
 | 
					set &count 0
 | 
				
			||||||
set &passedThrough true
 | 
					set &passedThrough true
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user