MarcWeber / hasktags

Produces ctags "tags" and etags "TAGS" files for Haskell programs
Other
127 stars 32 forks source link

Ignore '=' in comments of data constructors #21

Closed thomie closed 7 years ago

thomie commented 8 years ago

First some code archeology. (Going by GHC's .mailmap file, the original author of hasktags was most likely Rob Ennals (rje), a student of Simon Peyton Jones at the time).

The line I'm removing here was already present in the first version of hasktags: https://git.haskell.org/ghc.git/commit/2744e4fb443cbfe1f3eeeb781079382071ca3cda

The idea was, I think, that finding a second '=' while processing the constructor list of a data type declaration, must mean that we are done processing that type.

data Foo =
  | C1
  | C2

x = 1    -- This equals sign means we are done processing 'Foo'

y | True = 2   -- So 'True' is not reported as a constructor of 'Foo'.

Nowadays, hasktags is much better at detecting where data type declaration start and end, and the crude detection of '=' in getcons2 is not necessary anymore.

This fixes #20. Here is a testcase:

data Bar
   = T1       -- because this comment contains an equals sign (=)
   | T2       -- hasktags didn't report 'T2' as a constructor

The tests in the testcases directory are unaffected.

jhenahan commented 7 years ago

Just reviewing this for a likely merge if I can't find anything to break it. :)