Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various cleanups #26

Merged
merged 3 commits into from Aug 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Hasktags.hs
Expand Up @@ -28,7 +28,7 @@ import Data.List
import Data.Maybe

import System.IO
import System.Directory
import System.Directory hiding (isSymbolicLink)
import Text.JSON.Generic
import Control.Monad

Expand Down
3 changes: 1 addition & 2 deletions src/Main.hs
@@ -1,13 +1,12 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE CPP #-}

module Main (main) where
import Hasktags

import System.Environment

import Data.List

import System.IO
import System.Directory
import System.Console.GetOpt
import System.Exit
Expand Down
21 changes: 10 additions & 11 deletions src/Tags.hs
Expand Up @@ -16,7 +16,7 @@ import Control.Monad
mywords :: Bool -> String -> [String]
mywords spaced s = case rest of
')':xs -> (blanks' ++ ")") : mywords spaced xs
"" -> []
"" -> []
'{':'-':xs -> (blanks' ++ "{-") : mywords spaced xs
'-':'}':xs -> (blanks' ++ "-}") : mywords spaced xs
'{':xs -> (blanks' ++ "{") : mywords spaced xs
Expand All @@ -26,22 +26,22 @@ mywords spaced s = case rest of
'=':xs -> (blanks' ++ "=") : mywords spaced xs
',':xs -> (blanks' ++ ",") : mywords spaced xs
':':':':xs -> (blanks' ++ "::") : mywords spaced xs
s' -> (blanks' ++ w) : mywords spaced s''
where (w, s'') = myBreak s'
myBreak [] = ([],[])
myBreak (':':':':xs) = ([], "::"++xs)
myBreak (')':xs) = ([],')':xs)
s' -> (blanks' ++ w) : mywords spaced s''
where (w, s'') = myBreak s'
myBreak [] = ([],[])
myBreak (':':':':xs) = ([], "::"++xs)
myBreak (')':xs) = ([],')':xs)
myBreak ('(':xs) = ([],'(':xs)
myBreak ('`':xs) = ([],'`':xs)
myBreak ('=':xs) = ([],'=':xs)
myBreak (',':xs) = ([],',':xs)
myBreak ('`':xs) = ([],'`':xs)
myBreak ('=':xs) = ([],'=':xs)
myBreak (',':xs) = ([],',':xs)
myBreak xss@(x:xs)
| isSpace x
= if spaced
then ([], xss)
else ([], dropWhile isSpace xss)
| otherwise = let (a,b) = myBreak xs
in (x:a,b)
in (x:a,b)
where blanks' = if spaced then blanks else ""
(blanks, rest) = span {-partain:Char.-}isSpace s

Expand Down Expand Up @@ -159,4 +159,3 @@ etagsDumpThing (FoundThing _ name (Pos _filename line token fullline)) =
++ "\x7f"
++ name ++ "\x01"
++ show line ++ "," ++ show (line + 1) ++ "\n"