language-c99 0.1.2 → 0.1.3
raw patch · 3 files changed
+57/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +6/−0
- language-c99.cabal +1/−1
- src/Language/C99/Pretty.hs +50/−4
ChangeLog.md view
@@ -1,5 +1,11 @@ # Revision history for language-c99 +## 0.1.3 -- 2021-09-13++* Fixed a bug where I and J where swapped in the pretty printer. (Thanks to+ Benjamin Selfridge)+* Extended the prettyprinter. (Thanks to Alexander Vieth)+ ## 0.1.2 -- 2019-11-30 * Added newline to the end of translation units.
language-c99.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: language-c99-version: 0.1.2+version: 0.1.3 synopsis: An implementation of the C99 AST that strictly follows the standard. description:
src/Language/C99/Pretty.hs view
@@ -39,8 +39,8 @@ NDf -> char 'f' ; NDF -> char 'F' NDg -> char 'g' ; NDG -> char 'G' NDh -> char 'h' ; NDH -> char 'H'- NDi -> char 'i' ; NDI -> char 'J'- NDj -> char 'j' ; NDJ -> char 'I'+ NDi -> char 'i' ; NDI -> char 'I'+ NDj -> char 'j' ; NDJ -> char 'J' NDk -> char 'k' ; NDK -> char 'K' NDl -> char 'l' ; NDL -> char 'L' NDm -> char 'm' ; NDM -> char 'M'@@ -106,8 +106,11 @@ pretty (OcCons oc od) = pretty oc <> pretty od instance Pretty HexConst where+ pretty (HexBase prefix digit) = pretty prefix <> pretty digit+ pretty (HexCons hexes digit) = pretty hexes <> pretty digit instance Pretty HexPrefix where+ pretty OX = text "0x" instance Pretty NonZeroDigit where pretty d = case d of@@ -122,8 +125,33 @@ NZNine -> int 9 instance Pretty OcDigit where+ pretty d = case d of+ OcZero -> text "0"+ OcOne -> text "1"+ OcTwo -> text "2"+ OcThree -> text "3"+ OcFour -> text "4"+ OcFive -> text "5"+ OcSix -> text "6"+ OcSeven -> text "7" instance Pretty HexDigit where+ pretty HexZero = text "0"+ pretty HexOne = text "1"+ pretty HexTwo = text "2"+ pretty HexThree = text "3"+ pretty HexFour = text "4"+ pretty HexFive = text "5"+ pretty HexSix = text "6"+ pretty HexSeven = text "7"+ pretty HexEight = text "8"+ pretty HexNine = text "9"+ pretty HexA = text "A"+ pretty HexB = text "B"+ pretty HexC = text "C"+ pretty HexD = text "D"+ pretty HexE = text "E"+ pretty HexF = text "F" instance Pretty IntSuffix where pretty (IntSuffixUnsignedLong u ml) = pretty u <> pretty ml@@ -191,10 +219,16 @@ {- 6.4.4.4 -} instance Pretty CharConst where+ pretty (Char charSeq) = quotes (pretty charSeq)+ pretty (CharL charSeq) = char 'L' <> quotes (pretty charSeq) instance Pretty CCharSeq where+ pretty (CCharBase cchar) = pretty cchar+ pretty (CCharCons cseq cchar) = pretty cseq <> pretty cchar instance Pretty CChar where+ pretty (CChar ch) = char ch+ pretty (CCharEsc escSeq) = pretty escSeq instance Pretty EscSeq where pretty (EscSimple se) = pretty se@@ -214,9 +248,13 @@ SEv -> text "\\v" instance Pretty OcEscSeq where+ pretty (OcEsc1 od) = char '\\' <> pretty od+ pretty (OcEsc2 od1 od2) = char '\\' <> pretty od1 <> pretty od2+ pretty (OcEsc3 od1 od2 od3) = char '\\' <> pretty od1 <> pretty od2 <> pretty od3 instance Pretty HexEscSeq where-+ pretty (HexEscBase hd) = text "\\x" <> pretty hd+ pretty (HexEscCons hs hd) = pretty hs <> pretty hd {- STRING LITERALS -} {- 6.4.5 -}@@ -449,10 +487,16 @@ {- 6.7.2.2 -} instance Pretty EnumSpec where+ pretty (EnumSpec mident enumrlist) = text "enum" <+> pretty mident <+> braces (pretty enumrlist)+ pretty (EnumSpecForw ident) = text "enum" <+> pretty ident instance Pretty EnumrList where+ pretty (EnumrBase enumr) = pretty enumr+ pretty (EnumrCons el enumr) = pretty el <+> char ',' <+> pretty enumr instance Pretty Enumr where+ pretty (Enumr (Enum ident)) = pretty ident+ pretty (EnumrInit (Enum ident) expr) = pretty ident <+> char '=' <+> pretty expr {- 6.7.3 -} instance Pretty TypeQual where@@ -500,6 +544,8 @@ pretty (ParamDeclnAbstract ds mdad) = pretty ds <+> pretty mdad instance Pretty IdentList where+ pretty (IdentListBase ident) = pretty ident+ pretty (IdentListCons idl ident) = pretty idl <> comma <+> pretty ident {- 6.7.6 -} instance Pretty TypeName where@@ -548,7 +594,7 @@ {- 6.8 -} instance Pretty Stmt where pretty (StmtLabeled ls) = pretty ls- pretty (StmtCompound cs) = nest 2 $ pretty cs+ pretty (StmtCompound cs) = nest 2 $ braces (pretty cs) pretty (StmtExpr es) = pretty es pretty (StmtSelect ss) = pretty ss pretty (StmtIter is) = pretty is