1{-# LANGUAGE OverloadedStrings #-}23-- | This module implmeents a 'Formatter' for Scheme syntax definitions.4module SchemeDoc.Format.Syntax (Syntax, mkSyntax) where56import qualified Data.Text as T7import SchemeDoc.Format.Types8import SchemeDoc.Format.Util9import SchemeDoc.Types1011-- | A R7RS syntax definition.12newtype Syntax = Syntax13 { name :: T.Text14 -- ^ Name of the syntax definition15 }16 deriving (Eq, Show)1718instance Formatable Syntax where19 -- For syntax definitions, usage instruction should be20 -- provided in the accompanying documentation comment.21 fmt (Syntax keyword) desc =22 mkDeclaration keyword desc $ \n ->23 do24 component "syntax " n25 fromMkd desc2627-- | Parse a Scheme syntax definition28--29-- > <syntax definition> →30-- > (define-syntax <keyword> <transformer spec>)31mkSyntax :: Sexp -> Maybe Syntax32mkSyntax (List (Id "define-syntax" : Id keyword : _)) =33 Just $ Syntax keyword34mkSyntax _ = Nothing