aspell-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Aspell-user] Spell-checking source code


From: Greg Ward
Subject: [Aspell-user] Spell-checking source code
Date: Tue, 12 Oct 2004 20:27:29 -0400
User-agent: Mutt/1.5.6+20040818i

Hello all -- I've been toying lately with a wrapper for aspell/ispell
(it justs uses the pipe interface) that spell-checks source code -- that
is, it splits identifiers like

  getRemainingObjects
  ProcessMoreStuff
  last_value
  HTTP_NOT_FOUND
  HTTPResponse

into words and checks those words individually.

I know, "aspell -C" (compound words) handles this fairly well.  But I
started out with ispell, and its -C option doesn't seem to do anything.

I still think there are good reasons for writing a wrapper, though:

  * if I type getRemaningObjects, the misspelled word is "Remaning",
    and that's what I want to see

  * there should be a separate dictionary for each programming language,
    and probably one for each project too.  Eg. "int" is a good word
    in C, Java, and Python; "bool" is a good word in C++ and Python (but
    not Java); "sys" and "argv" are good words in Python, etc.
    (Actually, there's a lot of overlap, so right now I have a "base"
    dictionary with words common to several programming languages,
    and an additional per-language dictionary.)

  * I want a non-interactive mode that produces compiler-like
    output -- this would run on the CVS server at checkin time,
    both to spell-check checkin messages and the source code.
    For example, here's my codespell script spell-checking itself:

    $ ./scripts/codespell scripts/codespell
    scripts/codespell:5: codespell: code spell, code-spell?

Right now, this seems so useful that I'm surprised no one has done it
before.  (The only clever bit is the regex that splits identifiers like
'HTTPResponse' into words correctly [1].)  It would also be nice to have
as an Emacs mode (preferably just like "ispell-buffer") or an Eclipse
plug-in.  Is anyone aware of a similar project out there that I'm
reinventing?

Thanks --

        Greg

[1] [A-Z]?[a-z]+|[A-Z]+(?![a-z])
    (first time I've used a negative lookahead in real life)

-- 
Greg Ward <address@hidden>                         http://www.gerg.ca/
One man's theology is another man's belly laugh.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]