Skip to content

Commit b97e7ec

Browse files
committed
2 parents 54ba1a3 + c32dd72 commit b97e7ec

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

spwn-lang/libraries/std/counter.spwn

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl @counter {
4040
item: id
4141
}
4242
} else {
43-
error "Can not make counter from this type"
43+
throw "Can not make counter from this type"
4444
}
4545

4646
},
@@ -182,7 +182,7 @@ impl @counter {
182182
temp.add_to([self.item], speed)
183183

184184
} else {
185-
error "Cannot multiply counter by " + factor.type as @string
185+
throw "Cannot multiply counter by " + factor.type as @string
186186
}
187187
},
188188

@@ -228,7 +228,7 @@ impl @counter {
228228
}
229229
div!
230230
} else if divisor.type == @counter {
231-
//error "Dividing a counter by another counter is currently not supported"
231+
//throw "Dividing a counter by another counter is currently not supported"
232232
result = @counter::new(0, false)
233233
remainder.reset(speed)
234234
delay = @epsilon::{}
@@ -289,7 +289,7 @@ impl @counter {
289289

290290

291291
} else {
292-
error "Cannot divide counter by " + divisor.type as @string
292+
throw "Cannot divide counter by " + divisor.type as @string
293293
}
294294

295295

@@ -399,7 +399,7 @@ impl @counter {
399399
other.clone().add_to([new_counter.item])
400400
-> return new_counter
401401
} else {
402-
error "Cannot add counter with " + num.type as @string
402+
throw "Cannot add counter with " + num.type as @string
403403
}
404404
},
405405

@@ -409,7 +409,7 @@ impl @counter {
409409
new_counter.add(-other)
410410
-> return new_counter
411411
} else {
412-
error "Cannot subtract counter with " + num.type as @string
412+
throw "Cannot subtract counter with " + num.type as @string
413413
}
414414
},
415415

@@ -457,7 +457,7 @@ impl @counter {
457457
cmp = self_clone.compare(other_clone)
458458
-> return cmp == 1
459459
} else {
460-
error "Cannot compare counter with " + other.type as @string
460+
throw "Cannot compare counter with " + other.type as @string
461461
}
462462
},
463463

@@ -478,7 +478,7 @@ impl @counter {
478478
cmp = self_clone.compare(other_clone)
479479
-> return cmp == -1
480480
} else {
481-
error "Cannot compare counter with " + other.type as @string
481+
throw "Cannot compare counter with " + other.type as @string
482482
}
483483
},
484484

@@ -499,7 +499,7 @@ impl @counter {
499499
cmp = self_clone.compare(other_clone)
500500
-> return cmp == 1 || cmp == 0
501501
} else {
502-
error "Cannot compare counter with " + other.type as @string
502+
throw "Cannot compare counter with " + other.type as @string
503503
}
504504
},
505505

@@ -520,7 +520,7 @@ impl @counter {
520520
cmp = self_clone.compare(other_clone)
521521
-> return cmp == -1 || cmp == 0
522522
} else {
523-
error "Cannot compare counter with " + other.type as @string
523+
throw "Cannot compare counter with " + other.type as @string
524524
}
525525
},
526526

@@ -543,7 +543,7 @@ impl @counter {
543543
cmp = self_clone.compare(other_clone)
544544
-> return cmp == 0
545545
} else {
546-
error "Cannot compare counter with " + other.type as @string
546+
throw "Cannot compare counter with " + other.type as @string
547547
}
548548
},
549549

@@ -563,7 +563,7 @@ impl @counter {
563563
} else if num.type == @counter {
564564
num.clone().add_to([self])
565565
} else {
566-
error "Cannot add " + num.type as @string + " to counter"
566+
throw "Cannot add " + num.type as @string + " to counter"
567567
}
568568
},
569569

@@ -575,7 +575,7 @@ impl @counter {
575575
} else if num.type == @counter {
576576
num.clone().subtract_from([self])
577577
} else {
578-
error "Cannot subtract " + num.type as @string + " from counter"
578+
throw "Cannot subtract " + num.type as @string + " from counter"
579579
}
580580
},
581581

@@ -586,7 +586,7 @@ impl @counter {
586586
} else if num.type == @counter {
587587
self.multiply(num)
588588
} else {
589-
error "Cannot multiply counter by " + num.type as @string
589+
throw "Cannot multiply counter by " + num.type as @string
590590
}
591591
},
592592

@@ -596,7 +596,7 @@ impl @counter {
596596
} else if num.type == @counter {
597597
self.divide(num)
598598
} else {
599-
error "Cannot divide counter by " + num.type as @string
599+
throw "Cannot divide counter by " + num.type as @string
600600
}
601601
},
602602

@@ -609,7 +609,7 @@ impl @counter {
609609
} else if num.type == @counter {
610610
num.copy_to([self])
611611
} else {
612-
error "Cannot assign" + num.type as @string + " to counter"
612+
throw "Cannot assign" + num.type as @string + " to counter"
613613
}
614614
},
615615

@@ -623,7 +623,7 @@ impl @counter {
623623
wait()
624624
swap_tmp.copy_to([self]);
625625
} else {
626-
error "Cannot swap counter with " + num.type as @string
626+
throw "Cannot swap counter with " + num.type as @string
627627
}
628628
},
629629

@@ -656,7 +656,7 @@ impl @counter {
656656
if _type == @bool {
657657
-> return self != 0
658658
} else {
659-
error "Cannot convert counter to " + _type as @string + " (counter can convert to a number using the counter.to_const macro)"
659+
throw "Cannot convert counter to " + _type as @string + " (counter can convert to a number using the counter.to_const macro)"
660660
}
661661
}
662662
}

spwn-lang/libraries/std/fileio.spwn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl @file {
1414
},
1515
seek: (self, s: @number) {
1616
if s < 0 {
17-
error "Negative seek position " + s as @string;
17+
throw "Negative seek position " + s as @string;
1818
}
1919
self.fseek = s;
2020
},

spwn-lang/src/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ pub enum Token {
276276
#[token("in")]
277277
In,
278278

279-
#[token("error")]
279+
#[token("throw")]
280280
ErrorStatement,
281281

282282
#[token("if")]

0 commit comments

Comments
 (0)