packages feed

cimple 0.0.14 → 0.0.15

raw patch · 7 files changed

+45/−28 lines, 7 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Language.Cimple: CompoundLiteral :: a -> a -> NodeF lexeme a

Files

cimple.cabal view
@@ -1,5 +1,5 @@ name:                 cimple-version:              0.0.14+version:              0.0.15 synopsis:             Simple C-like programming language homepage:             https://toktok.github.io/ license:              GPL-3
src/Language/Cimple/Ast.hs view
@@ -76,7 +76,8 @@     | AssignExpr a AssignOp a     | ParenExpr a     | CastExpr a a-    | CompoundExpr a a+    | CompoundExpr a a -- DEPRECATED+    | CompoundLiteral a a     | SizeofExpr a     | SizeofType a     | LiteralExpr LiteralType lexeme
src/Language/Cimple/MapAst.hs view
@@ -196,8 +196,10 @@             Fix <$> (ParenExpr <$> recurse expr)         CastExpr ty expr ->             Fix <$> (CastExpr <$> recurse ty <*> recurse expr)-        CompoundExpr ty expr ->+        CompoundExpr ty expr -> -- DEPRECATED             Fix <$> (CompoundExpr <$> recurse ty <*> recurse expr)+        CompoundLiteral ty expr ->+            Fix <$> (CompoundLiteral <$> recurse ty <*> recurse expr)         SizeofExpr expr ->             Fix <$> (SizeofExpr <$> recurse expr)         SizeofType ty ->
src/Language/Cimple/Parser.y view
@@ -499,13 +499,22 @@ :	LhsExpr							{ $1 } |	ExprStmt						{ $1 } |	FunctionCall						{ $1 }-|	CompoundExpr						{ $1 }+|	CompoundLiteral						{ $1 } |	PureExpr(Expr)						{ $1 }  -- Allow `(Type){0}` to set struct values to all-zero.-CompoundExpr :: { StringNode }-CompoundExpr-:	'(' QualType ')' '{' Expr '}'				{ Fix $ CompoundExpr $2 $5 }+CompoundLiteral :: { StringNode }+CompoundLiteral+:	'(' QualType ')' '{' ZeroInitExpr '}'			{ Fix $ CompoundLiteral $2 $5 }++ZeroInitExpr :: { StringNode }+ZeroInitExpr+:	ID_VAR							{ Fix $ VarExpr $1 }+|	LIT_CHAR						{ Fix $ LiteralExpr Char $1 }+|	LIT_INTEGER						{ Fix $ LiteralExpr Int $1 }+|	LIT_FALSE						{ Fix $ LiteralExpr Bool $1 }+|	ID_CONST						{ Fix $ LiteralExpr ConstId $1 }+|	'{' ZeroInitExpr '}'					{ Fix $ InitialiserList [$2] }  AssignExpr :: { StringNode } AssignExpr
src/Language/Cimple/Pretty.hs view
@@ -238,25 +238,26 @@     Commented c d ->         c <$> d -    VarExpr var       -> ppLexeme var-    LiteralExpr _ l   -> dullred $ ppLexeme l-    SizeofExpr arg    -> kwSizeof <> parens arg-    SizeofType arg    -> kwSizeof <> parens arg-    BinaryExpr  l o r -> l <+> ppBinaryOp o <+> r-    AssignExpr  l o r -> l <+> ppAssignOp o <+> r-    TernaryExpr c t e -> ppTernaryExpr c t e-    UnaryExpr o e     -> ppUnaryOp o <> e-    ParenExpr e       -> parens e-    FunctionCall c  a -> ppFunctionCall c a-    ArrayAccess  e  i -> e <> char '[' <> i <> char ']'-    CastExpr     ty e -> parens ty <> e-    CompoundExpr ty e -> parens ty <+> lbrace <> e <> rbrace-    PreprocDefined  n -> text "defined(" <> ppLexeme n <> char ')'-    InitialiserList l -> ppInitialiserList l-    PointerAccess e m -> e <> text "->" <> ppLexeme m-    MemberAccess  e m -> e <> text "." <> ppLexeme m-    CommentExpr   c e -> c <+> e-    Ellipsis          -> text "..."+    VarExpr var          -> ppLexeme var+    LiteralExpr _ l      -> dullred $ ppLexeme l+    SizeofExpr arg       -> kwSizeof <> parens arg+    SizeofType arg       -> kwSizeof <> parens arg+    BinaryExpr  l o r    -> l <+> ppBinaryOp o <+> r+    AssignExpr  l o r    -> l <+> ppAssignOp o <+> r+    TernaryExpr c t e    -> ppTernaryExpr c t e+    UnaryExpr o e        -> ppUnaryOp o <> e+    ParenExpr e          -> parens e+    FunctionCall c  a    -> ppFunctionCall c a+    ArrayAccess  e  i    -> e <> char '[' <> i <> char ']'+    CastExpr     ty e    -> parens ty <> e+    CompoundExpr    ty e -> parens ty <+> lbrace <> e <> rbrace  -- DEPRECATED+    CompoundLiteral ty e -> parens ty <+> lbrace <> e <> rbrace+    PreprocDefined  n    -> text "defined(" <> ppLexeme n <> char ')'+    InitialiserList l    -> ppInitialiserList l+    PointerAccess e m    -> e <> text "->" <> ppLexeme m+    MemberAccess  e m    -> e <> text "." <> ppLexeme m+    CommentExpr   c e    -> c <+> e+    Ellipsis             -> text "..."      VarDecl ty name arrs      -> ty <+> ppLexeme name <> hcat arrs     DeclSpecArray Nothing     -> text "[]"
src/Language/Cimple/TraverseAst.hs view
@@ -245,7 +245,11 @@             _ <- recurse ty             _ <- recurse expr             pure ()-        CompoundExpr ty expr -> do+        CompoundExpr ty expr -> do -- DEPRECATED+            _ <- recurse ty+            _ <- recurse expr+            pure ()+        CompoundLiteral ty expr -> do             _ <- recurse ty             _ <- recurse expr             pure ()
src/Language/Cimple/TreeParser.y view
@@ -84,7 +84,7 @@     assignExpr		{ Fix (AssignExpr{}) }     parenExpr		{ Fix (ParenExpr{}) }     castExpr		{ Fix (CastExpr{}) }-    compoundExpr	{ Fix (CompoundExpr{}) }+    compoundLiteral	{ Fix (CompoundLiteral{}) }     sizeofExpr		{ Fix (SizeofExpr{}) }     sizeofType		{ Fix (SizeofType{}) }     literalExpr		{ Fix (LiteralExpr{}) }