-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simple C-like programming language -- -- Parser and AST for Cimple, a simple C-like programming language. @package cimple @version 0.0.21 module Language.Cimple.MapAst mapAst :: (MapAst itext otext a, Applicative f, HasCallStack) => AstActions f itext otext -> a -> f (Mapped itext otext a) mapFileAst :: (MapAst itext otext a, Applicative f, HasCallStack) => AstActions f itext otext -> FilePath -> a -> f (Mapped itext otext a) doFiles :: AstActions f itext otext -> [(FilePath, [Node (Lexeme itext)])] -> f [(FilePath, [Node (Lexeme otext)])] -> f [(FilePath, [Node (Lexeme otext)])] doFile :: AstActions f itext otext -> (FilePath, [Node (Lexeme itext)]) -> f (FilePath, [Node (Lexeme otext)]) -> f (FilePath, [Node (Lexeme otext)]) doNodes :: AstActions f itext otext -> FilePath -> [Node (Lexeme itext)] -> f [Node (Lexeme otext)] -> f [Node (Lexeme otext)] doNode :: AstActions f itext otext -> FilePath -> Node (Lexeme itext) -> f (Node (Lexeme otext)) -> f (Node (Lexeme otext)) doComment :: AstActions f itext otext -> FilePath -> Comment (Lexeme itext) -> f (Comment (Lexeme otext)) -> f (Comment (Lexeme otext)) doComments :: AstActions f itext otext -> FilePath -> [Comment (Lexeme itext)] -> f [Comment (Lexeme otext)] -> f [Comment (Lexeme otext)] doLexemes :: AstActions f itext otext -> FilePath -> [Lexeme itext] -> f [Lexeme otext] -> f [Lexeme otext] doLexeme :: AstActions f itext otext -> FilePath -> Lexeme itext -> f (Lexeme otext) -> f (Lexeme otext) doText :: AstActions f itext otext -> FilePath -> itext -> f otext data AstActions f itext otext astActions :: Applicative f => (itext -> f otext) -> AstActions f itext otext type TextActions f itext otext = AstActions f itext otext textActions :: Applicative f => (itext -> f otext) -> TextActions f itext otext type IdentityActions f text = AstActions f text text identityActions :: Applicative f => AstActions f text text instance Language.Cimple.MapAst.MapAst itext otext a => Language.Cimple.MapAst.MapAst itext otext (GHC.Maybe.Maybe a) instance Language.Cimple.MapAst.MapAst itext otext (Language.Cimple.Lexer.Lexeme itext) instance Language.Cimple.MapAst.MapAst itext otext [Language.Cimple.Lexer.Lexeme itext] instance Language.Cimple.MapAst.MapAst itext otext (Language.Cimple.Ast.Comment (Language.Cimple.Lexer.Lexeme itext)) instance Language.Cimple.MapAst.MapAst itext otext [Language.Cimple.Ast.Comment (Language.Cimple.Lexer.Lexeme itext)] instance Language.Cimple.MapAst.MapAst itext otext (Language.Cimple.Ast.Node (Language.Cimple.Lexer.Lexeme itext)) instance Language.Cimple.MapAst.MapAst itext otext [Language.Cimple.Ast.Node (Language.Cimple.Lexer.Lexeme itext)] instance Language.Cimple.MapAst.MapAst itext otext (GHC.IO.FilePath, [Language.Cimple.Ast.Node (Language.Cimple.Lexer.Lexeme itext)]) instance Language.Cimple.MapAst.MapAst itext otext [(GHC.IO.FilePath, [Language.Cimple.Ast.Node (Language.Cimple.Lexer.Lexeme itext)])] module Language.Cimple.Diagnostics type Diagnostics a = DiagnosticsT [Text] a class HasDiagnostics a addDiagnostic :: HasDiagnostics a => Text -> a -> a warn :: (HasLocation at, HasDiagnostics diags) => FilePath -> at -> Text -> DiagnosticsT diags () sloc :: HasLocation a => FilePath -> a -> Text instance Language.Cimple.Diagnostics.HasDiagnostics [Data.Text.Internal.Text] module Language.Cimple data LexemeClass IdConst :: LexemeClass IdFuncType :: LexemeClass IdStdType :: LexemeClass IdSueType :: LexemeClass IdVar :: LexemeClass KwBitwise :: LexemeClass KwBreak :: LexemeClass KwCase :: LexemeClass KwConst :: LexemeClass KwContinue :: LexemeClass KwDefault :: LexemeClass KwDo :: LexemeClass KwElse :: LexemeClass KwEnum :: LexemeClass KwExtern :: LexemeClass KwFor :: LexemeClass KwForce :: LexemeClass KwGnuPrintf :: LexemeClass KwGoto :: LexemeClass KwIf :: LexemeClass KwNonNull :: LexemeClass KwNullable :: LexemeClass KwOwner :: LexemeClass KwReturn :: LexemeClass KwSizeof :: LexemeClass KwStatic :: LexemeClass KwStaticAssert :: LexemeClass KwStruct :: LexemeClass KwSwitch :: LexemeClass KwTypedef :: LexemeClass KwUnion :: LexemeClass KwVla :: LexemeClass KwVoid :: LexemeClass KwWhile :: LexemeClass LitFalse :: LexemeClass LitTrue :: LexemeClass LitChar :: LexemeClass LitInteger :: LexemeClass LitString :: LexemeClass LitSysInclude :: LexemeClass PctAmpersand :: LexemeClass PctAmpersandAmpersand :: LexemeClass PctAmpersandEq :: LexemeClass PctArrow :: LexemeClass PctAsterisk :: LexemeClass PctAsteriskEq :: LexemeClass PctCaret :: LexemeClass PctCaretEq :: LexemeClass PctColon :: LexemeClass PctComma :: LexemeClass PctEllipsis :: LexemeClass PctEMark :: LexemeClass PctEMarkEq :: LexemeClass PctEq :: LexemeClass PctEqEq :: LexemeClass PctGreater :: LexemeClass PctGreaterEq :: LexemeClass PctGreaterGreater :: LexemeClass PctGreaterGreaterEq :: LexemeClass PctLBrace :: LexemeClass PctLBrack :: LexemeClass PctLess :: LexemeClass PctLessEq :: LexemeClass PctLessLess :: LexemeClass PctLessLessEq :: LexemeClass PctLParen :: LexemeClass PctMinus :: LexemeClass PctMinusEq :: LexemeClass PctMinusMinus :: LexemeClass PctPeriod :: LexemeClass PctPercent :: LexemeClass PctPercentEq :: LexemeClass PctPipe :: LexemeClass PctPipeEq :: LexemeClass PctPipePipe :: LexemeClass PctPlus :: LexemeClass PctPlusEq :: LexemeClass PctPlusPlus :: LexemeClass PctQMark :: LexemeClass PctRBrace :: LexemeClass PctRBrack :: LexemeClass PctRParen :: LexemeClass PctSemicolon :: LexemeClass PctSlash :: LexemeClass PctSlashEq :: LexemeClass PctTilde :: LexemeClass PpDefine :: LexemeClass PpDefined :: LexemeClass PpElif :: LexemeClass PpElse :: LexemeClass PpEndif :: LexemeClass PpIf :: LexemeClass PpIfdef :: LexemeClass PpIfndef :: LexemeClass PpInclude :: LexemeClass PpNewline :: LexemeClass PpUndef :: LexemeClass CmtBlock :: LexemeClass CmtCommand :: LexemeClass CmtAttr :: LexemeClass CmtEndDocSection :: LexemeClass CmtIndent :: LexemeClass CmtStart :: LexemeClass CmtStartCode :: LexemeClass CmtStartBlock :: LexemeClass CmtStartDoc :: LexemeClass CmtStartDocSection :: LexemeClass CmtSpdxCopyright :: LexemeClass CmtSpdxLicense :: LexemeClass CmtCode :: LexemeClass CmtWord :: LexemeClass CmtRef :: LexemeClass CmtEnd :: LexemeClass IgnStart :: LexemeClass IgnBody :: LexemeClass IgnEnd :: LexemeClass ErrorToken :: LexemeClass Eof :: LexemeClass parseExpr :: Alex NonTerm parseStmt :: Alex NonTerm parseTranslationUnit :: Alex [NonTerm] source :: Maybe ByteString data Alex a data AlexPosn AlexPn :: !Int -> !Int -> !Int -> AlexPosn alexError :: String -> Alex a alexScanTokens :: ByteString -> Either String [Lexeme Text] alexMonadScan :: Alex (Lexeme Text) data Lexeme text L :: AlexPosn -> LexemeClass -> text -> Lexeme text lexemeClass :: Lexeme text -> LexemeClass lexemePosn :: Lexeme text -> AlexPosn lexemeText :: Lexeme text -> text lexemeLine :: Lexeme text -> Int runAlex :: ByteString -> Alex a -> Either String a data AssignOp AopEq :: AssignOp AopMul :: AssignOp AopDiv :: AssignOp AopPlus :: AssignOp AopMinus :: AssignOp AopBitAnd :: AssignOp AopBitOr :: AssignOp AopBitXor :: AssignOp AopMod :: AssignOp AopLsh :: AssignOp AopRsh :: AssignOp data BinaryOp BopNe :: BinaryOp BopEq :: BinaryOp BopOr :: BinaryOp BopBitXor :: BinaryOp BopBitOr :: BinaryOp BopAnd :: BinaryOp BopBitAnd :: BinaryOp BopDiv :: BinaryOp BopMul :: BinaryOp BopMod :: BinaryOp BopPlus :: BinaryOp BopMinus :: BinaryOp BopLt :: BinaryOp BopLe :: BinaryOp BopLsh :: BinaryOp BopGt :: BinaryOp BopGe :: BinaryOp BopRsh :: BinaryOp data UnaryOp UopNot :: UnaryOp UopNeg :: UnaryOp UopMinus :: UnaryOp UopAddress :: UnaryOp UopDeref :: UnaryOp UopIncr :: UnaryOp UopDecr :: UnaryOp data LiteralType Char :: LiteralType Int :: LiteralType Bool :: LiteralType String :: LiteralType ConstId :: LiteralType type Node lexeme = Fix (NodeF lexeme) data NodeF lexeme a PreprocInclude :: lexeme -> NodeF lexeme a PreprocDefine :: lexeme -> NodeF lexeme a PreprocDefineConst :: lexeme -> a -> NodeF lexeme a PreprocDefineMacro :: lexeme -> [a] -> a -> NodeF lexeme a PreprocIf :: a -> [a] -> a -> NodeF lexeme a PreprocIfdef :: lexeme -> [a] -> a -> NodeF lexeme a PreprocIfndef :: lexeme -> [a] -> a -> NodeF lexeme a PreprocElse :: [a] -> NodeF lexeme a PreprocElif :: a -> [a] -> a -> NodeF lexeme a PreprocUndef :: lexeme -> NodeF lexeme a PreprocDefined :: lexeme -> NodeF lexeme a PreprocScopedDefine :: a -> [a] -> a -> NodeF lexeme a MacroBodyStmt :: a -> NodeF lexeme a MacroBodyFunCall :: a -> NodeF lexeme a MacroParam :: lexeme -> NodeF lexeme a StaticAssert :: a -> lexeme -> NodeF lexeme a LicenseDecl :: lexeme -> [a] -> NodeF lexeme a CopyrightDecl :: lexeme -> Maybe lexeme -> [lexeme] -> NodeF lexeme a Comment :: CommentStyle -> lexeme -> [lexeme] -> lexeme -> NodeF lexeme a CommentSection :: a -> [a] -> a -> NodeF lexeme a CommentSectionEnd :: lexeme -> NodeF lexeme a Commented :: a -> a -> NodeF lexeme a CommentInfo :: Comment lexeme -> NodeF lexeme a ExternC :: [a] -> NodeF lexeme a Group :: [a] -> NodeF lexeme a CompoundStmt :: [a] -> NodeF lexeme a Break :: NodeF lexeme a Goto :: lexeme -> NodeF lexeme a Continue :: NodeF lexeme a Return :: Maybe a -> NodeF lexeme a SwitchStmt :: a -> [a] -> NodeF lexeme a IfStmt :: a -> a -> Maybe a -> NodeF lexeme a ForStmt :: a -> a -> a -> a -> NodeF lexeme a WhileStmt :: a -> a -> NodeF lexeme a DoWhileStmt :: a -> a -> NodeF lexeme a Case :: a -> a -> NodeF lexeme a Default :: a -> NodeF lexeme a Label :: lexeme -> a -> NodeF lexeme a ExprStmt :: a -> NodeF lexeme a VLA :: a -> lexeme -> a -> NodeF lexeme a VarDeclStmt :: a -> Maybe a -> NodeF lexeme a VarDecl :: a -> lexeme -> [a] -> NodeF lexeme a DeclSpecArray :: Maybe a -> NodeF lexeme a InitialiserList :: [a] -> NodeF lexeme a UnaryExpr :: UnaryOp -> a -> NodeF lexeme a BinaryExpr :: a -> BinaryOp -> a -> NodeF lexeme a TernaryExpr :: a -> a -> a -> NodeF lexeme a AssignExpr :: a -> AssignOp -> a -> NodeF lexeme a ParenExpr :: a -> NodeF lexeme a CastExpr :: a -> a -> NodeF lexeme a CompoundExpr :: a -> a -> NodeF lexeme a CompoundLiteral :: a -> a -> NodeF lexeme a SizeofExpr :: a -> NodeF lexeme a SizeofType :: a -> NodeF lexeme a LiteralExpr :: LiteralType -> lexeme -> NodeF lexeme a VarExpr :: lexeme -> NodeF lexeme a MemberAccess :: a -> lexeme -> NodeF lexeme a PointerAccess :: a -> lexeme -> NodeF lexeme a ArrayAccess :: a -> a -> NodeF lexeme a FunctionCall :: a -> [a] -> NodeF lexeme a CommentExpr :: a -> a -> NodeF lexeme a EnumConsts :: Maybe lexeme -> [a] -> NodeF lexeme a EnumDecl :: lexeme -> [a] -> lexeme -> NodeF lexeme a Enumerator :: lexeme -> Maybe a -> NodeF lexeme a AggregateDecl :: a -> NodeF lexeme a Typedef :: a -> lexeme -> NodeF lexeme a TypedefFunction :: a -> NodeF lexeme a Struct :: lexeme -> [a] -> NodeF lexeme a Union :: lexeme -> [a] -> NodeF lexeme a MemberDecl :: a -> Maybe lexeme -> NodeF lexeme a TyBitwise :: a -> NodeF lexeme a TyForce :: a -> NodeF lexeme a TyConst :: a -> NodeF lexeme a TyOwner :: a -> NodeF lexeme a TyPointer :: a -> NodeF lexeme a TyStruct :: lexeme -> NodeF lexeme a TyFunc :: lexeme -> NodeF lexeme a TyStd :: lexeme -> NodeF lexeme a TyUserDefined :: lexeme -> NodeF lexeme a AttrPrintf :: lexeme -> lexeme -> a -> NodeF lexeme a FunctionDecl :: Scope -> a -> NodeF lexeme a FunctionDefn :: Scope -> a -> a -> NodeF lexeme a FunctionPrototype :: a -> lexeme -> [a] -> NodeF lexeme a CallbackDecl :: lexeme -> lexeme -> NodeF lexeme a Ellipsis :: NodeF lexeme a NonNull :: [lexeme] -> [lexeme] -> a -> NodeF lexeme a ConstDecl :: a -> lexeme -> NodeF lexeme a ConstDefn :: Scope -> a -> lexeme -> a -> NodeF lexeme a data Scope Global :: Scope Static :: Scope data CommentStyle Regular :: CommentStyle Doxygen :: CommentStyle Section :: CommentStyle Block :: CommentStyle Ignore :: CommentStyle type Comment lexeme = Fix (CommentF lexeme) data CommentF lexeme a DocComment :: [a] -> CommentF lexeme a DocWord :: lexeme -> CommentF lexeme a DocSentence :: [a] -> lexeme -> CommentF lexeme a DocNewline :: CommentF lexeme a DocAttention :: [a] -> CommentF lexeme a DocBrief :: [a] -> CommentF lexeme a DocDeprecated :: [a] -> CommentF lexeme a DocExtends :: lexeme -> CommentF lexeme a DocImplements :: lexeme -> CommentF lexeme a DocParam :: Maybe lexeme -> lexeme -> [a] -> CommentF lexeme a DocReturn :: [a] -> CommentF lexeme a DocRetval :: lexeme -> [a] -> CommentF lexeme a DocSee :: lexeme -> [a] -> CommentF lexeme a DocPrivate :: CommentF lexeme a DocParagraph :: [a] -> CommentF lexeme a DocLine :: [a] -> CommentF lexeme a DocCode :: lexeme -> [a] -> lexeme -> CommentF lexeme a DocList :: [a] -> CommentF lexeme a DocULItem :: [a] -> [a] -> CommentF lexeme a DocOLItem :: lexeme -> [a] -> CommentF lexeme a DocColon :: lexeme -> CommentF lexeme a DocRef :: lexeme -> CommentF lexeme a DocP :: lexeme -> CommentF lexeme a DocLParen :: a -> CommentF lexeme a DocRParen :: a -> CommentF lexeme a DocAssignOp :: AssignOp -> a -> a -> CommentF lexeme a DocBinaryOp :: BinaryOp -> a -> a -> CommentF lexeme a data AnnotF attr a Annot :: attr -> a -> AnnotF attr a [attr] :: AnnotF attr a -> attr [unAnnot] :: AnnotF attr a -> a type AnnotNode lexeme = Fix (AnnotF () `Compose` NodeF lexeme) addAnnot :: Node lexeme -> AnnotNode lexeme removeAnnot :: AnnotNode lexeme -> Node lexeme type DefaultActions a = IdentityActions (State a) Text defaultActions :: DefaultActions state removeSloc :: Node (Lexeme Text) -> Node (Lexeme Text) module Language.Cimple.Pretty plain :: Doc -> Doc render :: Doc -> Text ppTranslationUnit :: [Node (Lexeme Text)] -> Doc showNode :: Node (Lexeme Text) -> Text module Language.Cimple.Program data Program text fromList :: [TranslationUnit Text] -> Either String (Program Text) toList :: Program a -> [TranslationUnit a] includeGraph :: Program a -> [(FilePath, FilePath)] module Language.Cimple.TraverseAst traverseAst :: (TraverseAst text a, Applicative f) => AstActions f text -> a -> f () doFiles :: AstActions f text -> [(FilePath, [Node (Lexeme text)])] -> f () -> f () doFile :: AstActions f text -> (FilePath, [Node (Lexeme text)]) -> f () -> f () doNodes :: AstActions f text -> FilePath -> [Node (Lexeme text)] -> f () -> f () doNode :: AstActions f text -> FilePath -> Node (Lexeme text) -> f () -> f () doComment :: AstActions f text -> FilePath -> Comment (Lexeme text) -> f () -> f () doComments :: AstActions f text -> FilePath -> [Comment (Lexeme text)] -> f () -> f () doLexemes :: AstActions f text -> FilePath -> [Lexeme text] -> f () -> f () doLexeme :: AstActions f text -> FilePath -> Lexeme text -> f () -> f () doText :: AstActions f text -> FilePath -> text -> f () astActions :: Applicative f => AstActions f text data AstActions f text instance Language.Cimple.TraverseAst.TraverseAst text a => Language.Cimple.TraverseAst.TraverseAst text (GHC.Maybe.Maybe a) instance Language.Cimple.TraverseAst.TraverseAst text (Language.Cimple.Lexer.Lexeme text) instance Language.Cimple.TraverseAst.TraverseAst text [Language.Cimple.Lexer.Lexeme text] instance Language.Cimple.TraverseAst.TraverseAst text (Language.Cimple.Ast.Comment (Language.Cimple.Lexer.Lexeme text)) instance Language.Cimple.TraverseAst.TraverseAst text [Language.Cimple.Ast.Comment (Language.Cimple.Lexer.Lexeme text)] instance Language.Cimple.TraverseAst.TraverseAst text (Language.Cimple.Ast.Node (Language.Cimple.Lexer.Lexeme text)) instance Language.Cimple.TraverseAst.TraverseAst text [Language.Cimple.Ast.Node (Language.Cimple.Lexer.Lexeme text)] instance Language.Cimple.TraverseAst.TraverseAst text (GHC.IO.FilePath, [Language.Cimple.Ast.Node (Language.Cimple.Lexer.Lexeme text)]) instance Language.Cimple.TraverseAst.TraverseAst text [(GHC.IO.FilePath, [Language.Cimple.Ast.Node (Language.Cimple.Lexer.Lexeme text)])] module Language.Cimple.IO parseExpr :: Text -> Either String TextNode parseFile :: FilePath -> IO (Either String (TranslationUnit Text)) parseFiles :: [FilePath] -> IO (Either String [TranslationUnit Text]) parseProgram :: [FilePath] -> IO (Either String (Program Text)) parseStmt :: Text -> Either String TextNode parseText :: Text -> Either String [TextNode]