> +-- | 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? > + , 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
