2

I have a large source code package in C and I would like to spell check all string literals and comments. After adding exceptions to a file, I would like to perform the same procedure on each release, to see if there are any spelling errors inserted.

I have checked with ispell, hunspell and aspell but, to my disappointment and surprise, although they do seem to understand HTML, Tex and a few other languages they do not have a C feature. The closest I found was a "ccpp" filter mentioned for aspell, but when I "aspell dump filters" the ccpp filter is not listed.

Any ideas?

Kostas
  • 1,292
  • 1
  • 13
  • 20
  • 1
    You don't need anything special: aspell will automatically use `ccpp` filter for files with appropriate extensions, e.g. .c or .h. – danpla Mar 01 '19 at 22:08

1 Answers1

1

You have to write a lexer first to extract string constants and comments to a text file with the associated line & column of the source file. (ply can be useful or lex/yacc but needs some coding).

Then use whatever spell checker you like, then parse the report, and trace back to the original C file location.

Or connect directly the spell checker to your lexer.

Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219