Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDog3112 authored May 11, 2024
2 parents 170ce0c + 1eb1187 commit d59e580
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ data class CastingImage private constructor(
*/
fun withOverriddenUsedOps(count: Long) = this.copy(opsConsumed = count)

/**
* Returns a copy of this with escape/paren-related fields cleared.
*/
fun withResetEscape() = this.copy(parenCount = 0, parenthesized = listOf(), escapeNext = false)

fun serializeToNbt() = NBTBuilder {
TAG_STACK %= stack.serializeToNBT()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class CastingVM(var image: CastingImage, val env: CastingEnvironment) {
val newParenCount = this.image.parenCount + if (last == null || last.escaped || last.iota !is PatternIota) 0 else when (last.iota.pattern) {
SpecialPatterns.INTROSPECTION -> -1
SpecialPatterns.RETROSPECTION -> 1
else -> -1
else -> 0
}
this.image.copy(parenthesized = newParens, parenCount = newParenCount) to if (last == null) ResolvedPatternType.ERRORED else ResolvedPatternType.UNDONE
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ data class FrameForEach(
return CastResult(
ListIota(code),
newCont,
newImage.copy(stack = tStack),
// reset escapes so they don't carry over to other iterations or out of thoth
newImage.withResetEscape().copy(stack = tStack),
listOf(),
ResolvedPatternType.EVALUATED,
HexEvalSounds.THOTH,
Expand Down

0 comments on commit d59e580

Please sign in to comment.