packages feed

language-vhdl 0.1.2.4 → 0.1.2.6

raw patch · 3 files changed

+89/−42 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Language.VHDL.Pretty: instance Language.VHDL.Pretty.Pretty Language.VHDL.Syntax.Base
- Language.VHDL.Pretty: instance Language.VHDL.Pretty.Pretty Language.VHDL.Syntax.BasedInteger
- Language.VHDL.Syntax: AbstractLiteral :: AbstractLiteral
- Language.VHDL.Syntax: Base :: Base
- Language.VHDL.Syntax: BasedInteger :: BasedInteger
- Language.VHDL.Syntax: Exponent :: Exponent
- Language.VHDL.Syntax: data Base
- Language.VHDL.Syntax: data BasedInteger
- Language.VHDL.Syntax: instance GHC.Classes.Eq Language.VHDL.Syntax.Base
- Language.VHDL.Syntax: instance GHC.Classes.Eq Language.VHDL.Syntax.BasedInteger
- Language.VHDL.Syntax: instance GHC.Show.Show Language.VHDL.Syntax.Base
- Language.VHDL.Syntax: instance GHC.Show.Show Language.VHDL.Syntax.BasedInteger
+ Language.VHDL.Syntax: ALitBased :: BasedLiteral -> AbstractLiteral
+ Language.VHDL.Syntax: ALitDecimal :: DecimalLiteral -> AbstractLiteral
+ Language.VHDL.Syntax: ExponentNeg :: Integer -> Exponent
+ Language.VHDL.Syntax: ExponentPos :: Integer -> Exponent
+ Language.VHDL.Syntax: [based_lit_base] :: BasedLiteral -> Base
+ Language.VHDL.Syntax: [based_lit_based_fractional_part] :: BasedLiteral -> Maybe BasedInteger
+ Language.VHDL.Syntax: [based_lit_based_integral_part] :: BasedLiteral -> BasedInteger
+ Language.VHDL.Syntax: [based_lit_exponent] :: BasedLiteral -> Maybe Exponent
+ Language.VHDL.Syntax: [decimal_exponent] :: DecimalLiteral -> Maybe Exponent
+ Language.VHDL.Syntax: [decimal_fractional_part] :: DecimalLiteral -> Maybe Integer
+ Language.VHDL.Syntax: [decimal_integral_part] :: DecimalLiteral -> Integer
+ Language.VHDL.Syntax: type Base = Integer
+ Language.VHDL.Syntax: type BasedInteger = Integer
- Language.VHDL.Syntax: BasedLiteral :: BasedLiteral
+ Language.VHDL.Syntax: BasedLiteral :: Base -> BasedInteger -> Maybe BasedInteger -> Maybe Exponent -> BasedLiteral
- Language.VHDL.Syntax: DecimalLiteral :: DecimalLiteral
+ Language.VHDL.Syntax: DecimalLiteral :: Integer -> Maybe Integer -> Maybe Exponent -> DecimalLiteral

Files

language-vhdl.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                language-vhdl-version:             0.1.2.4+version:             0.1.2.6 synopsis:            VHDL AST and pretty printer in Haskell. -- description:          license:             BSD3
src/Language/VHDL/Pretty.hs view
@@ -25,7 +25,9 @@ -------------------------------------------------------------------------------- -- ** Pretty printing instances -instance Pretty AbstractLiteral where pp = error "missing: AbstractLiteral" -- todo+instance Pretty AbstractLiteral where+  pp (ALitDecimal d) = pp d+  pp (ALitBased   b) = pp b  instance Pretty AccessTypeDefinition where   pp (AccessTypeDefinition s) = text "ACCESS" <+> pp s@@ -119,15 +121,12 @@     <+> text "OF" <+> pp s     <+> text "IS" <+> pp e <+> semi -instance Pretty Base where pp = error "missing: Base" -- todo- instance Pretty BaseSpecifier where pp = error "missing: BaseSpecifier" -- todo  instance Pretty BaseUnitDeclaration where pp = error "missing: BaseUnitDeclaration" -- todo -instance Pretty BasedInteger where pp = error "missing: BasedInteger" -- todo--instance Pretty BasedLiteral where pp = error "missing: BasedLiteral" -- todo+instance Pretty BasedLiteral where+  pp (BasedLiteral b i f e) = pp b <+> char '#' <+> pp i <+> condL (char '.') f <+> char '#' <+> cond id e  instance Pretty BasicCharacter where pp = error "missing: BasicCharacter" -- todo @@ -324,7 +323,8 @@   pp (ContextLibrary l) = pp l   pp (ContextUse u)     = pp u -instance Pretty DecimalLiteral where pp = error "missing: DecimalLiteral" -- todo+instance Pretty DecimalLiteral where+  pp (DecimalLiteral i f e) = pp i <+> condL (char '.') f <+> cond id e  instance Pretty Declaration where   pp (DType t)          = pp t@@ -467,9 +467,11 @@  instance Pretty ExitStatement where   pp (ExitStatement l b c) =-    label l <+> text "NEXT" <+> cond id b <+> condL (text "WHEN") c <+> semi+    label l <+> text "EXIT" <+> cond id b <+> condL (text "WHEN") c <+> semi -instance Pretty Exponent where pp = error "missing: Exponent" -- todo+instance Pretty Exponent where+  pp (ExponentPos i) = char 'E' <+> pp i+  pp (ExponentNeg i) = char 'E' <+> char '-' <+> pp i  instance Pretty Expression where   pp (EAnd rs)    = textSep "AND"  $ map pp rs@@ -613,18 +615,18 @@  instance Pretty InterfaceDeclaration where   pp (InterfaceConstantDeclaration is s e) =-    text "CONSTANT" <+> pp is <+> colon <+> text "IN" <+> pp s <+> condL (text ":=") e+    text "CONSTANT" <+> commaSep (fmap pp is) <+> colon <+> text "IN" <+> pp s <+> condL (text ":=") e   pp (InterfaceSignalDeclaration is m s b e) =-    {-text "SIGNAL" <+> -}pp is <+> colon <+> cond id m <+> pp s <+> when b (text "BUS") <+> condL (text ":=") e+    commaSep (fmap pp is) <+> colon <+> cond id m <+> pp s <+> when b (text "BUS") <+> condL (text ":=") e   pp (InterfaceVariableDeclaration is m s e) =-    text "VARIABLE" <+> pp is <+> colon <+> cond id m <+> pp s <+> condL (text ":=") e+    text "VARIABLE" <+> commaSep (fmap pp is) <+> colon <+> cond id m <+> pp s <+> condL (text ":=") e   pp (InterfaceFileDeclaration is s) =-    text "FILE" <+> pp is <+> colon <+> pp s+    text "FILE" <+> commaSep (fmap pp is) <+> colon <+> pp s  --instance Pretty InterfaceElement where pp = undefined  instance Pretty InterfaceList where-  pp (InterfaceList es) = foldr ($+$) empty $ punctuate semi $ map pp es+  pp (InterfaceList es) = vcat $ punctuate semi $ map pp es  instance Pretty IterationScheme where   pp (IterWhile c) = text "WHILE" <+> pp c@@ -664,8 +666,8 @@ instance Pretty LoopStatement where   pp (LoopStatement l i ss) =     labels l $ vcat-      [ cond id i <+> text "LOOP"-      , indent $ pp ss+      [ (cond id i <+> text "LOOP")+        `hangs` vpp ss       , text "END LOOP" <+> cond id l <+> semi       ] 
src/Language/VHDL/Syntax.hs view
@@ -1737,22 +1737,22 @@     miscellaneous_operator ::= ** | ABS | NOT -} -data LogicalOperator  = And | Or | Nand | Nor | Xor | Xnor+data LogicalOperator       = And | Or | Nand | Nor | Xor | Xnor   deriving (Eq, Show) -data RelationalOperator = Eq | Neq | Lt | Lte | Gt | Gte+data RelationalOperator    = Eq | Neq | Lt | Lte | Gt | Gte   deriving (Eq, Show) -data ShiftOperator    = Sll | Srl | Sla | Sra | Rol | Ror+data ShiftOperator         = Sll | Srl | Sla | Sra | Rol | Ror   deriving (Eq, Show) -data AddingOperator   = Plus | Minus | Concat+data AddingOperator        = Plus | Minus | Concat   deriving (Eq, Show) -data Sign             = Identity | Negation+data Sign                  = Identity | Negation   deriving (Eq, Show) -data MultiplyingOperator = Times | Div | Mod | Rem+data MultiplyingOperator   = Times | Div | Mod | Rem   deriving (Eq, Show)  data MiscellaneousOperator = Exp | Abs | Not@@ -2726,10 +2726,73 @@ -- -------------------------------------------------------------------------------- --- ...+--------------------------------------------------------------------------------+-- ** 13.4 +{-+    abstract_literal ::= decimal_literal | based_literal+-}++data AbstractLiteral  =+      ALitDecimal DecimalLiteral+    | ALitBased   BasedLiteral+  deriving (Eq, Show)+ --------------------------------------------------------------------------------+-- *** 13.4.1 --+-- I use Haskell's Integer to represent integers in VHDL. Its syntax seems to be+-- slightly different though (the underline part).++{-+    decimal_literal ::= integer [ . integer ] [ exponent ]+    +    integer ::= digit { [ underline ] digit }++    exponent ::= E [ + ] integer | E – integer+-}++data DecimalLiteral = DecimalLiteral {+    decimal_integral_part   :: Integer+  , decimal_fractional_part :: Maybe Integer+  , decimal_exponent        :: Maybe Exponent+  }+  deriving (Eq, Show)++data Exponent =+    ExponentPos Integer+  | ExponentNeg Integer+  deriving (Eq, Show)++--------------------------------------------------------------------------------+-- *** 13.4.2++{-+    based_literal ::=+      base # based_integer [ . based_integer ] # [ exponent ]++    base ::= integer++    based_integer ::=+      extended_digit { [ underline ] extended_digit }++    extended_digit ::= digit | letter+-}++data BasedLiteral = BasedLiteral {+    based_lit_base                  :: Base+  , based_lit_based_integral_part   :: BasedInteger+  , based_lit_based_fractional_part :: Maybe BasedInteger+  , based_lit_exponent              :: Maybe Exponent+  }+  deriving (Eq, Show)++type Base = Integer++type BasedInteger = Integer++--------------------------------------------------------------------------------+-- --                                  - ToDo - -- --------------------------------------------------------------------------------@@ -2743,26 +2806,14 @@ data StringLiteral    = SLit String   deriving (Eq, Show) -data AbstractLiteral  = AbstractLiteral-  deriving (Eq, Show)- -------------------------------------------------------------------------------- -data Base = Base-  deriving (Eq, Show)- data BaseSpecifier = BaseSpecifier   deriving (Eq, Show)  data BaseUnitDeclaration = BaseUnitDeclaration   deriving (Eq, Show) -data BasedInteger = BasedInteger-  deriving (Eq, Show)--data BasedLiteral = BasedLiteral-  deriving (Eq, Show)- data BasicCharacter = BasicCharacter   deriving (Eq, Show) @@ -2776,12 +2827,6 @@   deriving (Eq, Show)  data BitValue = BitValue-  deriving (Eq, Show)--data DecimalLiteral = DecimalLiteral-  deriving (Eq, Show)--data Exponent = Exponent   deriving (Eq, Show)  data ExtendedDigit = ExtendedDigit