+findClassName :: [Token] -> [FoundThing]
+findClassName [] = []
+findClassName [Token n p] = [FoundThing n p]
+findClassName xs = (\(Token n pos : xs') -> FoundThing n pos : findstuff xs') . drop2 . dropParens 0 $ xs
+
+dropParens :: Integer -> [Token] -> [Token]
+dropParens n (Token "(" _ : xs) = dropParens (n + 1) xs
+dropParens 0 (x : xs) = x : xs
+dropParens 1 (Token ")" _ : xs) = xs
+dropParens n (Token ")" _ : xs) = dropParens (n - 1) xs
+dropParens n (_ : xs) = dropParens n xs
+dropParens _ [] = [] -- Shouldn't happen on correct source
+
+-- dropsEverything till token "=>" (if it is on the same line as the
+-- first token. if not return tokens)
+drop2 :: [Token] -> [Token]
+drop2 tokens@(Token _ (Pos _ line_nr _ _ ) : _) =
+ let (line, following) = span (\(Token _ (Pos _ l _ _)) -> l == line_nr) tokens
+ (_, following_in_line) = span (\(Token n _) -> n /= "=>") line
+ in case following_in_line of
+ (Token "=>" _ : xs) -> xs ++ following
+ _ -> tokens
+drop2 xs = xs