Skip to content

Commit

Permalink
Fix the calculation of inverse bracket expressions
Browse files Browse the repository at this point in the history
Close #7
  • Loading branch information
nihei9 committed Apr 19, 2022
1 parent ec2233e commit bff52b5
Show file tree
Hide file tree
Showing 2 changed files with 402 additions and 10 deletions.
4 changes: 2 additions & 2 deletions compiler/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,9 @@ func exclude(symbol, base CPTree) CPTree {
newRangeSymbolNode(bFrom, sFrom-1),
newRangeSymbolNode(sTo+1, bTo),
)
case sFrom <= bFrom && sTo > bFrom && sTo < bTo:
case sFrom <= bFrom && sTo >= bFrom && sTo < bTo:
return newRangeSymbolNode(sTo+1, bTo)
case sFrom < bFrom && sFrom < bTo && sTo >= bTo:
case sFrom > bFrom && sFrom <= bTo && sTo >= bTo:
return newRangeSymbolNode(bFrom, sFrom-1)
case sFrom <= bFrom && sTo >= bTo:
return nil
Expand Down
Loading

0 comments on commit bff52b5

Please sign in to comment.