Skip to content

Commit

Permalink
Merge pull request #26 from bgamari/master
Browse files Browse the repository at this point in the history
Various cleanups
  • Loading branch information
MarcWeber committed Aug 25, 2016
2 parents b25a032 + 2feed77 commit 8648083
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
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"

0 comments on commit 8648083

Please sign in to comment.