Here's the fix in a nutshell, the full patch follows in a minute:
On Mon, Aug 18, 2014 at 10:47 AM, Klaus Aehlig <[email protected]> wrote: > > +-- | Parse a path for a JSON structure. > > +pointerFromString :: String -> J.Result Pointer > > +pointerFromString s = > > + either J.Error J.Ok . P.parseOnly parser $ pack s > > + where > > + parser = do > > + tokens <- token `P.manyTill` P.endOfInput > > + return $ Pointer tokens > > + token = > > + P.char '/' *> P.many' (P.choice [ escaped > > Unfortunately, many' is not present in all versions of Attoparsec > where Ganeti is required to run on. Can you pelase find an alternative? > parser = do - tokens <- token `P.manyTill` P.endOfInput + _ <- P.char '/' + tokens <- token `P.sepBy1` P.char '/' return $ Pointer tokens token = - P.char '/' *> P.many' (P.choice [ escaped - , P.satisfy $ P.notInClass "~/"]) + P.choice [P.many1 (P.choice [ escaped + , P.satisfy $ P.notInClass "~/"]) + , P.endOfInput *> return ""] escaped = P.choice [escapedSlash, escapedTilde] escapedSlash = P.string (pack "~1") *> return '/' escapedTilde = P.string (pack "~0") *> return '~' > > > + , P.satisfy $ P.notInClass > "~/"]) > > + escaped = P.choice [escapedSlash, escapedTilde] > > + escapedSlash = P.string (pack "~1") *> return '/' > > + escapedTilde = P.string (pack "~0") *> return '~' > > Thanks, > Klaus > > -- > Klaus Aehlig > Google Germany GmbH, Dienerstr. 12, 80331 Muenchen > Registergericht und -nummer: Hamburg, HRB 86891 > Sitz der Gesellschaft: Hamburg > Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores >
