    {-# OPTIONS_GHC -Wno-unused-do-bind #-}
    module Data.Aeson.JSONPath.Parser.Name
      ( pSingleQuotted
      , pDoubleQuotted
      )
      where

    import qualified Text.ParserCombinators.Parsec  as P

    import Data.Functor                  (($>))
    import Data.Char                     (ord, chr)
    import Text.ParserCombinators.Parsec ((<|>))

    import Prelude

    pSingleQuotted :: P.Parser String
    pSingleQuotted :: Parser String
    pSingleQuotted = Char -> ParsecT String () Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    '\'' ParsecT String () Identity Char -> Parser String -> Parser String
    forall a b.
    ParsecT String () Identity a
    -> ParsecT String () Identity b -> ParsecT String () Identity b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> ParsecT String () Identity Char -> Parser String
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    P.many ParsecT String () Identity Char
    inQuote Parser String -> ParsecT String () Identity Char -> Parser String
    forall a b.
    ParsecT String () Identity a
    -> ParsecT String () Identity b -> ParsecT String () Identity a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Char -> ParsecT String () Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    '\''
      where
        inQuote :: ParsecT String () Identity Char
    inQuote = ParsecT String () Identity Char -> ParsecT String () Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try ParsecT String () Identity Char
    pUnescaped
               ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String () Identity Char -> ParsecT String () Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try (Char -> ParsecT String () Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    '\"')
               ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String () Identity Char -> ParsecT String () Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try (String -> Parser String
    forall s (m :: * -> *) u.
    Stream s m Char =>
    String -> ParsecT s u m String
    P.string String
    "\\\'" Parser String -> Char -> ParsecT String () Identity Char
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Char
    '\'')
               ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String () Identity Char -> ParsecT String () Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try ParsecT String () Identity Char
    pEscaped

    pDoubleQuotted :: P.Parser String
    pDoubleQuotted :: Parser String
    pDoubleQuotted = Char -> ParsecT String () Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    '\"' ParsecT String () Identity Char -> Parser String -> Parser String
    forall a b.
    ParsecT String () Identity a
    -> ParsecT String () Identity b -> ParsecT String () Identity b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> ParsecT String () Identity Char -> Parser String
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    P.many ParsecT String () Identity Char
    inQuote Parser String -> ParsecT String () Identity Char -> Parser String
    forall a b.
    ParsecT String () Identity a
    -> ParsecT String () Identity b -> ParsecT String () Identity a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Char -> ParsecT String () Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    '\"'
      where
        inQuote :: ParsecT String () Identity Char
    inQuote = ParsecT String () Identity Char -> ParsecT String () Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try ParsecT String () Identity Char
    pUnescaped
               ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String () Identity Char -> ParsecT String () Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try (Char -> ParsecT String () Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    '\'')
               ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String () Identity Char -> ParsecT String () Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try (String -> Parser String
    forall s (m :: * -> *) u.
    Stream s m Char =>
    String -> ParsecT s u m String
    P.string String
    "\\\"" Parser String -> Char -> ParsecT String () Identity Char
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Char
    '\"')
               ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String () Identity Char -> ParsecT String () Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try ParsecT String () Identity Char
    pEscaped

    pUnescaped :: P.Parser Char
    pUnescaped :: ParsecT String () Identity Char
    pUnescaped = (Char -> Bool) -> ParsecT String () Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    (Char -> Bool) -> ParsecT s u m Char
    P.satisfy Char -> Bool
    inRange
      where
        inRange :: Char -> Bool
    inRange Char
    c = let code :: Int
    code = Char -> Int
    ord Char
    c in
          (Int
    code Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    >= Int
    0x20 Bool -> Bool -> Bool
    && Int
    code Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Int
    0x21) Bool -> Bool -> Bool
    ||
          (Int
    code Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    >= Int
    0x23 Bool -> Bool -> Bool
    && Int
    code Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Int
    0x26) Bool -> Bool -> Bool
    ||
          (Int
    code Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    >= Int
    0x28 Bool -> Bool -> Bool
    && Int
    code Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Int
    0x5B) Bool -> Bool -> Bool
    ||
          (Int
    code Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    >= Int
    0x5D Bool -> Bool -> Bool
    && Int
    code Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Int
    0xD7FF) Bool -> Bool -> Bool
    ||
          (Int
    code Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    >= Int
    0xE000 Bool -> Bool -> Bool
    && Int
    code Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Int
    0x10FFFF)

    pEscaped :: P.Parser Char
    pEscaped :: ParsecT String () Identity Char
    pEscaped = do
      Char -> ParsecT String () Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    '\\'
      ParsecT String () Identity Char -> ParsecT String () Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try ParsecT String () Identity Char
    forall {u}. ParsecT String u Identity Char
    pEscapees ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String () Identity Char -> ParsecT String () Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try ParsecT String () Identity Char
    pHexUnicode
      where
        pEscapees :: ParsecT String u Identity Char
    pEscapees = ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try (Char -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    'b' ParsecT String u Identity Char
    -> Char -> ParsecT String u Identity Char
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Char
    '\b')
                ParsecT String u Identity Char
    -> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try (Char -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    'f' ParsecT String u Identity Char
    -> Char -> ParsecT String u Identity Char
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Char
    '\f')
                ParsecT String u Identity Char
    -> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try (Char -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    'n' ParsecT String u Identity Char
    -> Char -> ParsecT String u Identity Char
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Char
    '\n')
                ParsecT String u Identity Char
    -> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try (Char -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    'r' ParsecT String u Identity Char
    -> Char -> ParsecT String u Identity Char
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Char
    '\r')
                ParsecT String u Identity Char
    -> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try (Char -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    't' ParsecT String u Identity Char
    -> Char -> ParsecT String u Identity Char
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Char
    '\t')
                ParsecT String u Identity Char
    -> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try (Char -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    '/')
                ParsecT String u Identity Char
    -> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try (Char -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    '\\')

    pHexUnicode :: P.Parser Char
    pHexUnicode :: ParsecT String () Identity Char
    pHexUnicode = ParsecT String () Identity Char -> ParsecT String () Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try ParsecT String () Identity Char
    forall {u}. ParsecT String u Identity Char
    pNonSurrogate ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    -> ParsecT String () Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String () Identity Char -> ParsecT String () Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try ParsecT String () Identity Char
    forall {u}. ParsecT String u Identity Char
    pSurrogatePair
      where
        pNonSurrogate :: ParsecT String u Identity Char
    pNonSurrogate = ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try ParsecT String u Identity Char
    forall {u}. ParsecT String u Identity Char
    pNonSurrogateFirst ParsecT String u Identity Char
    -> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall tok st a. GenParser tok st a -> GenParser tok st a
    P.try ParsecT String u Identity Char
    forall {u}. ParsecT String u Identity Char
    pNonSurrogateSecond
          where
            pNonSurrogateFirst :: ParsecT String u Identity Char
    pNonSurrogateFirst = do
              Char -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    'u'
              c1 <- ParsecT String u Identity Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    P.digit ParsecT String u Identity Char
    -> ParsecT String u Identity Char -> ParsecT String u Identity Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> String -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    String -> ParsecT s u m Char
    P.oneOf String
    "AaBbCcEeFf"
              c2 <- P.hexDigit
              c3 <- P.hexDigit
              c4 <- P.hexDigit
              return $ chr (read ("0x" ++ [c1,c2,c3,c4]) :: Int)

            pNonSurrogateSecond :: ParsecT String u Identity Char
    pNonSurrogateSecond = do
              Char -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    'u'
              c1 <- String -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    String -> ParsecT s u m Char
    P.oneOf String
    "Dd"
              c2 <- P.oneOf "01234567"
              c3 <- P.hexDigit
              c4 <- P.hexDigit
              return $ chr (read ("0x" ++ [c1,c2,c3,c4]) :: Int)

        pSurrogatePair :: ParsecT String u Identity Char
    pSurrogatePair = do
          Char -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    P.char Char
    'u'
          high <- ParsecT String u Identity Int
    forall {u}. ParsecT String u Identity Int
    pHighSurrogate
          P.char '\\'
          P.char 'u'
          fromHighAndLow high <$> pLowSurrogate
          where
            pHighSurrogate :: ParsecT String u Identity Int
    pHighSurrogate = do
              c1 <- String -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    String -> ParsecT s u m Char
    P.oneOf String
    "Dd"
              c2 <- P.oneOf "89AaBb"
              c3 <- P.hexDigit
              c4 <- P.hexDigit
              return (read ("0x" ++ [c1,c2,c3,c4]) :: Int)

            pLowSurrogate :: ParsecT String u Identity Int
    pLowSurrogate = do
              c1 <- String -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    String -> ParsecT s u m Char
    P.oneOf String
    "Dd"
              c2 <- P.oneOf "CcDdEeFf"
              c3 <- P.hexDigit
              c4 <- P.hexDigit
              return (read ("0x" ++ [c1,c2,c3,c4]) :: Int)

            fromHighAndLow :: Int -> Int -> Char
    fromHighAndLow Int
    hi Int
    lo = Int -> Char
    chr (Int -> Char) -> Int -> Char
    forall a b. (a -> b) -> a -> b
    $ ((Int
    hi Int -> Int -> Int
    forall a. Num a => a -> a -> a
    - Int
    0xD800) Int -> Int -> Int
    forall a. Num a => a -> a -> a
    * Int
    0x400) Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + (Int
    lo Int -> Int -> Int
    forall a. Num a => a -> a -> a
    - Int
    0xDC00) Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    0x10000