Need help with EXC_BAD_ACCESS (not sure if it's this library) #275
-
I've spent the last couple of evenings trying to figure out what's going on with no avail so I'm asking here just in case you folks see something obvious in my code. My code is a CLI that uses swift-parsing to get data from a text file. This PR alexito4/kindle-highlights#1 has a bunch of changes with updates on libraries and more parser. But it crashes, mostly on tests. The PR describes the scenarios that I've been able to make it crash. When I say crash I mean EXC_BAD_ACCESS, so there is some weird memory thing going on. In this other diff alexito4/kindle-highlights#2 you can see how I've removed pretty much all the code, leaving only What I'm doing is quite simple so there must be something basic I'm missing. Apologies for asking debugging help but any advice is appreciated. Cheers ❤️ |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hey @alexito4! According to my tests, it doesn't crash if I'm creating a new parser each time: var myClippingsParser: some Parser<Substring, [Highlight]> {
Many {
highlightParser
} separator: {
highlightSeparator
Whitespace(1, .vertical)
} terminator: {
highlightSeparator
Whitespace()
End()
}
} I also had to do the same trick to get the suite to pass globally: |
Beta Was this translation helpful? Give feedback.
Hey @alexito4! According to my tests, it doesn't crash if I'm creating a new parser each time:
I also had to do the same trick to get the suite to pass globally:
https://github.com/alexito4/kindle-highlights/compare/update-title-author...tgrapperon:kindle-highlights:update-title-author?expand=1
My long-shot guess is that this is related to top-level declarations, and that it would probably work if stored in some struct value (statically or not). I'…