@@ -44,13 +44,9 @@ literals = mkPattern' match'
45 match :: (Emit gen) => AST -> StateT PrinterState Maybe gen
45 match :: (Emit gen) => AST -> StateT PrinterState Maybe gen
46 match (NumericLiteral _ n) = return $ emit $ T.pack $ either show show n
46 match (NumericLiteral _ n) = return $ emit $ T.pack $ either show show n
47− match (StringLiteral _ s)
47+ match (StringLiteral _ s) = return $ emit $ stringLiteral s
48− | Just s' <- decodeString s
49− , T.all isAscii s' = return $ emit $ stringLiteral s
50− match (StringLiteral _ s) = return $ emit $ "u8" <> stringLiteral s
51 match (BooleanLiteral _ True) = return $ emit "true"
48 match (BooleanLiteral _ True) = return $ emit "true"
52 match (BooleanLiteral _ False) = return $ emit "false"
49 match (BooleanLiteral _ False) = return $ emit "false"
53− -- match (ArrayLiteral _ []) = return $ emit "std::initializer_list<boxed>{}"
54 match (ArrayLiteral _ xs) = mconcat <$> sequence
50 match (ArrayLiteral _ xs) = mconcat <$> sequence
55 [ return $ emit "array_t{"
51 [ return $ emit "array_t{"
56 , intercalate (emit ", ") <$> forM xs prettyPrintCpp'
52 , intercalate (emit ", ") <$> forM xs prettyPrintCpp'
@@ -387,7 +383,10 @@ prettyPrintCpp1 :: AST -> Text
387prettyPrintCpp1 = maybe (internalError "Incomplete pattern") runPlainString . flip evalStateT (PrinterState 0) . prettyPrintCpp'
383prettyPrintCpp1 = maybe (internalError "Incomplete pattern") runPlainString . flip evalStateT (PrinterState 0) . prettyPrintCpp'
389stringLiteral :: PSString -> Text
385stringLiteral :: PSString -> Text
390−stringLiteral pss | Just s <- decodeString pss = stringLiteral' s
386+stringLiteral pss | Just s <- decodeString pss =
389+ else ("u8") <> stringLiteral' s
392 stringLiteral' :: Text -> Text
391 stringLiteral' :: Text -> Text
393 stringLiteral' s = "\"" <> T.concatMap encodeChar s <> "\""
392 stringLiteral' s = "\"" <> T.concatMap encodeChar s <> "\""