cimple 0.0.26 → 0.0.27
raw patch · 4 files changed
+28/−11 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Language.Cimple: getLoc :: Node (Lexeme l) -> Lexeme l
Files
- cimple.cabal +1/−1
- src/Language/Cimple/DescribeAst.hs +9/−1
- src/Language/Cimple/Lexer.x +2/−1
- src/Language/Cimple/Parser.y +16/−8
cimple.cabal view
@@ -1,5 +1,5 @@ name: cimple-version: 0.0.26+version: 0.0.27 synopsis: Simple C-like programming language homepage: https://toktok.github.io/ license: GPL-3
src/Language/Cimple/DescribeAst.hs view
@@ -5,10 +5,11 @@ ( HasLocation (..) , describeLexeme , describeNode+ , getLoc , parseError ) where -import Data.Fix (Fix (..), foldFix)+import Data.Fix (Fix (..), foldFix, unFix) import Data.List (isPrefixOf, (\\)) import qualified Data.List as List import Data.Text (Text)@@ -31,6 +32,13 @@ case foldFix Flatten.lexemes n of [] -> Text.pack file <> ":0:0" l:_ -> sloc file l+++getLoc :: Node (Lexeme l) -> Lexeme l+getLoc n =+ case foldFix Flatten.lexemes n of+ [] -> error "getLoc: node has no lexemes"+ l:_ -> l describeNode :: Show a => Node a -> String
src/Language/Cimple/Lexer.x view
@@ -159,6 +159,7 @@ <0,ppSC> "tox_"?"bitwise" { mkL KwBitwise } <0,ppSC> "tox_"?"force" { mkL KwForce } <0,ppSC> "tox_"?"owner" { mkL KwOwner }+<0,ppSC> "_Owner" { mkL KwOwner } <0,ppSC> "break" { mkL KwBreak } <0,ppSC> "case" { mkL KwCase } <0,ppSC> "const" { mkL KwConst }@@ -312,7 +313,7 @@ instance Hashable AlexPosn data Lexeme text = L AlexPosn LexemeClass text- deriving (Eq, Show, Generic, Functor, Foldable, Traversable)+ deriving (Eq, Show, Generic, Functor, Foldable, Traversable, Ord) instance FromJSON text => FromJSON (Lexeme text) instance ToJSON text => ToJSON (Lexeme text)
src/Language/Cimple/Parser.y view
@@ -671,25 +671,33 @@ : bitwise ID_STD_TYPE { Fix (TyBitwise (Fix (TyStd $2))) } | force leafType { Fix (TyForce $2) } | leafType ConstQual { ($2 $1) }-| leafType ConstQual '*' Qual { $4 (tyPointer ($2 $1)) }-| leafType ConstQual '*' Qual '*' Qual { $6 (tyPointer ($4 (tyPointer ($2 $1)))) }+| leafType ConstQual '*' { (tyPointer ($2 $1)) }+| leafType ConstQual '*' QualList { $4 (tyPointer ($2 $1)) }+| leafType ConstQual '*' QualMaybe '*' QualMaybe { $6 (tyPointer ($4 (tyPointer ($2 $1)))) } | const leafType { (tyConst $2) }-| const leafType '*' Qual { $4 (tyPointer (tyConst $2)) }-| const leafType '*' Qual '*' Qual { $6 (tyPointer ($4 (tyPointer (tyConst $2)))) }+| const leafType '*' QualMaybe { $4 (tyPointer (tyConst $2)) }+| const leafType '*' QualMaybe '*' QualMaybe { $6 (tyPointer ($4 (tyPointer (tyConst $2)))) } ConstQual :: { NonTerm -> NonTerm } ConstQual : { id } | const { tyConst } +QualList :: { NonTerm -> NonTerm }+QualList+: Qual QualList { $1 . $2 }+| Qual { $1 }++QualMaybe :: { NonTerm -> NonTerm }+QualMaybe+: QualList { $1 }+| { id }+ Qual :: { NonTerm -> NonTerm } Qual-: { id }-| const { tyConst }+: const { tyConst } | nonnull { tyNonnull } | nullable { tyNullable }-| nonnull const { tyConst . tyNonnull }-| nullable const { tyConst . tyNullable } | owner { tyOwner } Nullability :: { Nullability }