Skip to content

EXC_BAD_ACCESS combining OneOf, .case, .memberwise #298

Answered by mbrandonw
tikitu asked this question in Q&A
Discussion options

You must be logged in to vote

I can't say I know why the parser is crashing, but I do know a fix. I think Swift has a hard time dealing with large, complex types held in variables, double so for file-scope variables, and triply so when mixed with some P types. I converted a single one of your parsers to the more modern body style of parsing:

struct DoubleQuoteString: ParserPrinter {
  var body: some ParserPrinter<Substring, Substring> {
    ParsePrint {
      "\""
      PrefixUpTo("\"")
      "\""
    }
  }
}

And then updated all instances of doubleQuoteString with DoubleQuoteString() and it started working. Well, the parser is failing, but at least it isn't crashing.

I would recommend updating all of your parsers to …

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@tikitu
Comment options

@mbrandonw
Comment options

@tikitu
Comment options

Answer selected by tikitu
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #297 on May 18, 2023 19:56.