Safe Haskell | None |
---|---|
Language | Haskell98 |
- data TagVal = TagVal {}
- data Type
- data Tag
- data Pos a = Pos {}
- data SrcPos = SrcPos {}
- newtype UnstrippedTokens = UnstrippedTokens [Token]
- processFile :: FilePath -> Bool -> IO ([Pos TagVal], [String])
- qualify :: Bool -> Pos TagVal -> Pos TagVal
- process :: FilePath -> Bool -> Text -> ([Pos TagVal], [String])
- isHsFile :: FilePath -> Bool
- isLiterateFile :: FilePath -> Bool
- unstrippedTokensOf :: UnstrippedTokens -> [Token]
- stripCpp :: Text -> Text
- stripNewlines :: UnstrippedTokens -> [Token]
- breakBlocks :: UnstrippedTokens -> [UnstrippedTokens]
types
The Ord instance is used to sort tags with the same name. Given multiple matches, vim will visit them in order, so this should be in the order of interest.
We rely that Type < Constructor. TODO how and where? For sorting tags?
Tag !(Pos TagVal) | |
RepeatableTag !(Pos TagVal) | Just like Tag, except these should be deduplicated by their TagVal, where the one with the lowest line number will be preferred. The idea seems to be that functions will emit a tag for both the signature and definition. TODO seems like a hack, why not just deduplicate all tags? And I think I do that now with dropAdjacent. |
Warning !(Pos String) |
newtype UnstrippedTokens Source #
Newlines have to remain in the tokens because breakBlocks
relies on
them. But they make pattern matching on the tokens unreliable because
newlines might be anywhere. A newtype makes sure that the tokens only get
stripped once and that I don't do any pattern matching on unstripped tokens.
process
qualify :: Bool -> Pos TagVal -> Pos TagVal Source #
Each tag is split into a one qualified with its module name and one without.
TODO I could mark it static, to put in a file: mark, which would make vim prioritize it for same-file tags, but I think it already does that, so maybe this isn't necessary?
process :: FilePath -> Bool -> Text -> ([Pos TagVal], [String]) Source #
Process one file's worth of tags.
util
isLiterateFile :: FilePath -> Bool Source #
unstrippedTokensOf :: UnstrippedTokens -> [Token] Source #
stripNewlines :: UnstrippedTokens -> [Token] Source #
It's easier to scan for tokens without pesky newlines popping up
everywhere. But I need to keep the newlines in in case I hit a where
and need to call breakBlocks
again.
breakBlocks :: UnstrippedTokens -> [UnstrippedTokens] Source #
Break the input up into blocks based on indentation.