Agda-2.5.2: A dependently typed functional programming language and proof assistant

Safe Haskell | None
Language | Haskell2010

Agda.Syntax.Parser.Literate

Description

Preprocessors for literate code formats

Synopsis

- literateProcessors :: [(String, Processor)]
- literateExts :: [String]
- literateExtsShortList :: [String]
- literateSrcFile :: [Layer] -> SrcFile
- literateTeX :: Position -> String -> [Layer]
- literateRsT :: Position -> String -> [Layer]
- illiterate :: [Layer] -> String
- isCode :: Layer -> Bool
- type Processor = Position -> String -> [Layer]
- data Layer = Layer {
  - layerType :: LayerType
  - interval :: Interval
  - layerContent :: String
  }
- data LayerType
  - = Markup
  - | Comment
  - | Code

# Documentation

literateProcessors :: [(String, Processor)] #

List of valid extensions for literate Agda files, and their corresponding preprocessors.

If you add new extensions, remember to update test/Utils.hs so that test cases ending in the new extensions are found.

literateExts :: [String] #

Possible extensions for a literate Agda file

literateExtsShortList :: [String] #

Short list of extensions for literate Agda files For display purposes.

literateSrcFile :: [Layer] -> SrcFile #

literateTeX :: Position -> String -> [Layer] #

Preprocessor for literate TeX

literateRsT :: Position -> String -> [Layer] #

Preprocessor for reStructuredText

illiterate :: [Layer] -> String #

Blanks the non-code parts of a given file, preserving positions of characters corresponding to code. This way, there is a direct correspondence between source positions and positions in the processed result.

isCode :: Layer -> Bool #

Checks if a layer corresponds to Agda code

type Processor = Position -> String -> [Layer] #

Type of a literate preprocessor: Invariants:

    f : Processor

    f pos s /= []

    f pos s >>= layerContent == s

data Layer #

Constructors

Layer |
Fields layerType :: LayerType interval :: Interval layerContent :: String

Instances

Show Layer # |
Methods showsPrec :: Int -> Layer -> ShowS # show :: Layer -> String # showList :: [Layer] -> ShowS #
HasRange Layer # |
Methods getRange :: Layer -> Range #

data LayerType #

Constructors

Markup |
Comment |
Code |

Instances

Eq LayerType # |
Methods (==) :: LayerType -> LayerType -> Bool # (/=) :: LayerType -> LayerType -> Bool #
Show LayerType # |
Methods showsPrec :: Int -> LayerType -> ShowS # show :: LayerType -> String # showList :: [LayerType] -> ShowS #