aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/main.cpp b/main.cpp
index ce93d37..a4c8714 100644
--- a/main.cpp
+++ b/main.cpp
@@ -63,8 +63,13 @@ void lowercase(string &str){
Argument parseArgument(const string &str,const unordered_map<string,Location> &labels,Location ip){
if(str[0]=='#'||str[0]=='%'){
bool remote=str[0]=='%';
- if(isdigit(str[1]))return {arg_t::var,remote,atoi(str.data()+1),{}};
- else return {arg_t::name,remote,0,str.substr(1)};
+ if(isdigit(str[1])){
+ int num=atoi(str.data()+1);
+ assert(num>=1&&num<=20);
+ return {arg_t::var,remote,num,{}};
+ } else {
+ return {arg_t::name,remote,0,str.substr(1)};
+ }
} else if(str[0]=='@'){
if(labels.find(str.substr(1))==labels.end()){
return {arg_t::undeflabel,false,0,str.substr(1)};
@@ -220,6 +225,7 @@ int main(int argc,char **argv){
Robot &r=world.create(&t,2,t.banks.size(),false);
for(int i=0;i<(int)t.banks.size();i++){
r.load(i,t.banks[i]);
+ r.active=1;
}
}