Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Spu7Nix/SPWN-language
Browse files Browse the repository at this point in the history
  • Loading branch information
Spu7Nix committed Jan 6, 2021
2 parents 54ba1a3 + c32dd72 commit b97e7ec
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
36 changes: 18 additions & 18 deletions spwn-lang/libraries/std/counter.spwn
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl @counter {
item: id
}
} else {
error "Can not make counter from this type"
throw "Can not make counter from this type"
}

},
Expand Down Expand Up @@ -182,7 +182,7 @@ impl @counter {
temp.add_to([self.item], speed)

} else {
error "Cannot multiply counter by " + factor.type as @string
throw "Cannot multiply counter by " + factor.type as @string
}
},

Expand Down Expand Up @@ -228,7 +228,7 @@ impl @counter {
}
div!
} else if divisor.type == @counter {
//error "Dividing a counter by another counter is currently not supported"
//throw "Dividing a counter by another counter is currently not supported"
result = @counter::new(0, false)
remainder.reset(speed)
delay = @epsilon::{}
Expand Down Expand Up @@ -289,7 +289,7 @@ impl @counter {


} else {
error "Cannot divide counter by " + divisor.type as @string
throw "Cannot divide counter by " + divisor.type as @string
}


Expand Down Expand Up @@ -399,7 +399,7 @@ impl @counter {
other.clone().add_to([new_counter.item])
-> return new_counter
} else {
error "Cannot add counter with " + num.type as @string
throw "Cannot add counter with " + num.type as @string
}
},

Expand All @@ -409,7 +409,7 @@ impl @counter {
new_counter.add(-other)
-> return new_counter
} else {
error "Cannot subtract counter with " + num.type as @string
throw "Cannot subtract counter with " + num.type as @string
}
},

Expand Down Expand Up @@ -457,7 +457,7 @@ impl @counter {
cmp = self_clone.compare(other_clone)
-> return cmp == 1
} else {
error "Cannot compare counter with " + other.type as @string
throw "Cannot compare counter with " + other.type as @string
}
},

Expand All @@ -478,7 +478,7 @@ impl @counter {
cmp = self_clone.compare(other_clone)
-> return cmp == -1
} else {
error "Cannot compare counter with " + other.type as @string
throw "Cannot compare counter with " + other.type as @string
}
},

Expand All @@ -499,7 +499,7 @@ impl @counter {
cmp = self_clone.compare(other_clone)
-> return cmp == 1 || cmp == 0
} else {
error "Cannot compare counter with " + other.type as @string
throw "Cannot compare counter with " + other.type as @string
}
},

Expand All @@ -520,7 +520,7 @@ impl @counter {
cmp = self_clone.compare(other_clone)
-> return cmp == -1 || cmp == 0
} else {
error "Cannot compare counter with " + other.type as @string
throw "Cannot compare counter with " + other.type as @string
}
},

Expand All @@ -543,7 +543,7 @@ impl @counter {
cmp = self_clone.compare(other_clone)
-> return cmp == 0
} else {
error "Cannot compare counter with " + other.type as @string
throw "Cannot compare counter with " + other.type as @string
}
},

Expand All @@ -563,7 +563,7 @@ impl @counter {
} else if num.type == @counter {
num.clone().add_to([self])
} else {
error "Cannot add " + num.type as @string + " to counter"
throw "Cannot add " + num.type as @string + " to counter"
}
},

Expand All @@ -575,7 +575,7 @@ impl @counter {
} else if num.type == @counter {
num.clone().subtract_from([self])
} else {
error "Cannot subtract " + num.type as @string + " from counter"
throw "Cannot subtract " + num.type as @string + " from counter"
}
},

Expand All @@ -586,7 +586,7 @@ impl @counter {
} else if num.type == @counter {
self.multiply(num)
} else {
error "Cannot multiply counter by " + num.type as @string
throw "Cannot multiply counter by " + num.type as @string
}
},

Expand All @@ -596,7 +596,7 @@ impl @counter {
} else if num.type == @counter {
self.divide(num)
} else {
error "Cannot divide counter by " + num.type as @string
throw "Cannot divide counter by " + num.type as @string
}
},

Expand All @@ -609,7 +609,7 @@ impl @counter {
} else if num.type == @counter {
num.copy_to([self])
} else {
error "Cannot assign" + num.type as @string + " to counter"
throw "Cannot assign" + num.type as @string + " to counter"
}
},

Expand All @@ -623,7 +623,7 @@ impl @counter {
wait()
swap_tmp.copy_to([self]);
} else {
error "Cannot swap counter with " + num.type as @string
throw "Cannot swap counter with " + num.type as @string
}
},

Expand Down Expand Up @@ -656,7 +656,7 @@ impl @counter {
if _type == @bool {
-> return self != 0
} else {
error "Cannot convert counter to " + _type as @string + " (counter can convert to a number using the counter.to_const macro)"
throw "Cannot convert counter to " + _type as @string + " (counter can convert to a number using the counter.to_const macro)"
}
}
}
2 changes: 1 addition & 1 deletion spwn-lang/libraries/std/fileio.spwn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl @file {
},
seek: (self, s: @number) {
if s < 0 {
error "Negative seek position " + s as @string;
throw "Negative seek position " + s as @string;
}
self.fseek = s;
},
Expand Down
2 changes: 1 addition & 1 deletion spwn-lang/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub enum Token {
#[token("in")]
In,

#[token("error")]
#[token("throw")]
ErrorStatement,

#[token("if")]
Expand Down

0 comments on commit b97e7ec

Please sign in to comment.