Skip to content

Commit

Permalink
Fix stack popping logic in Raku lexer
Browse files Browse the repository at this point in the history
This fixes an array index bounds error.

Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
  • Loading branch information
donaldh committed May 22, 2024
1 parent 1e983e7 commit d649b87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lexers/raku.go
Original file line number Diff line number Diff line change
Expand Up @@ -1366,11 +1366,11 @@ func popRule(rule ruleReplacingConfig) MutatorFunc {

if ok && len(stack) > 0 {
// Pop from stack
stack = stack[:len(stack)-1]
lastRule := stack[len(stack)-1]
lastRule.pushState = false
lastRule.popState = false
lastRule.pop = true
stack = stack[:len(stack)-1]
state.Set(stackName, stack)

// Call replaceRule to use the last rule
Expand Down

0 comments on commit d649b87

Please sign in to comment.