Kostas
Kostas

Reputation: 1322

Bulk spell checking for C code

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?

Upvotes: 2

Views: 512

Answers (1)

Jean-François Fabre
Jean-François Fabre

Reputation: 140276

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.

Upvotes: 1

Related Questions