LexaCount
I'm currently writing LexaCount, a project to count lines of code which will exclude lines newlines, blank lines and lines with comments in C.
It is meant to be a small side project I'll use myself regularly as I need a good way to count the source lines of code of my ongoing projects.
5 Replies
I hope it can release this in the coming days as it's already halfway done. It is based on an old utility I made back in 2021 which counted lines of code but didn't exclude comments or blank lines, and was made solely for Newtrodit.
This utility will target any project made in the major languages (C, JavaScript, Rust, Python, Java, Zig, PHP, etc.)
Still thinking about how I'll implement multiline comments for C, C++, CSS and HTML
I will be adding the option of not counting lines that are only brackets or parenthesis, so:
will return 2 lines
Alright, line counting seems to work now
Gonna try to implement this
Added an optional table display
I think that for the sake of expandability you should almost have a file for the language specifing syntax so you don't have to hard code them into the program in a nasty way
some like:
or for Python:
Though the
blocks
and indents
part could be dropped seeing as you don't really care for them anyway
This is just an idea but I think it would be better then having, well I don't know a header with a bunch of macros for exampleI like this idea
I should do that with a structure containing language, extension, single line comment, multiline comment begin/end, brackets
Found a bug in the table padding regarding lists
Fixed
Not in the way I like because it decreases performance, but it works at least
Multiple lists are separated by a horitzontal line
Ooo, nice
I think that the CWD can be shortened to just
.
instead of having the realpath show
It's a bit long
so smaller terminal sizes will have some issues
So in this case because you're in C:\Users\Andreu\Desktop
The paths would be like
.\newtrodit\
etc
instead of
C:\Users\Andreu\Desktop\newtrodit
You may also make it an option for uses realpaths
for example --realpath