| Copyright | (c) 2019-2020 Vaclav Svejcar |
|---|---|
| License | BSD-3 |
| Maintainer | vaclav.svejcar@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Headroom.Header.Utils
Description
Useful functions for searching specific text fragments in input text, used by other modules to detect existing license headers in source code files.
Synopsis
- findLine :: (Text -> Bool) -> Text -> Int
- findLineStartingWith :: [Text] -> Text -> Int
- linesCountByRegex :: Regex -> Text -> Int
- reML :: QuasiQuoter
Documentation
Arguments
| :: (Text -> Bool) | predicate to find line |
| -> Text | input text |
| -> Int | number of line that matches given predicate |
Finds line in given text that matches given predicate and returns its line number.
Arguments
| :: [Text] | patterns to use |
| -> Text | input text |
| -> Int | number of line starting with one of patterns |
Finds line starting with one of given patterns and returns its line number
(specialized form of findLine).
Arguments
| :: Regex | regular expression to use |
| -> Text | input text |
| -> Int | number of lines matching given regex |
Count lines that matches the given (multiline) regex. Useful for example to find how many lines are taken by multi-line comment in source code.
reML :: QuasiQuoter Source #
Regex configuration for matching multi-line UTF strings.