kuvshinovdr / srcstats

A small console program to gather and report C++ source files statistics.
MIT License
1 stars 1 forks source link

Other programming languages support #10

Open kuvshinovdr opened 3 months ago

kuvshinovdr commented 3 months ago

There are three parts in programming language support in SrcStats:

  1. File recognizer: given a possible source file decide if it is a source file and what programming language it belongs. Currently we only test the file extension. So at least it is needed to add another languages file extensions and treat the files accordingly.
  2. Decommenting.
  3. Separate and total statistics reporting. Each supported language should have its own statistics accumulator object. Finally all of them should be summarized in a separate total section.
kuvshinovdr commented 2 months ago

Preliminary support in version 0.5: Lang_interface provides a common interface for objects implementing programming language suport; File_type_recognizer now becomes File_type_dispatcher that stores pointers to language interface objects and calls them on each recognized file according to its type. The only language interface object being available now is cpp, however.

kuvshinovdr commented 2 months ago

Possible languages to be supported: Rust, Go, Python, C#, Java, JavaScript/TypeScript, Lua, FreePascal(?), Ruby, R, Julia, Matlab, Wolfram (Mathematica), Maxima, Swift, Kotlin, CMake, Fortran 90.

kuvshinovdr commented 2 months ago

Better support in version 0.6: inherit from Lang_base class, define the default constructor and override language_name, register_file_types and decomment_in_place methods.

kuvshinovdr commented 1 month ago

Preliminary C# support added.