https://github.com/basemax/strip-c-comments
A C program to strip comments from a c file and output the result to a new file.
https://github.com/basemax/strip-c-comments
c regex remove-c-comment remove-c-comments remove-comment remove-comments strip-c-comment strip-c-comments strip-comment strip-comments
Last synced: 6 months ago
JSON representation
A C program to strip comments from a c file and output the result to a new file.
- Host: GitHub
- URL: https://github.com/basemax/strip-c-comments
- Owner: BaseMax
- License: gpl-3.0
- Created: 2022-02-11T16:22:44.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-29T10:28:40.000Z (over 2 years ago)
- Last Synced: 2025-05-04T21:45:54.222Z (11 months ago)
- Topics: c, regex, remove-c-comment, remove-c-comments, remove-comment, remove-comments, strip-c-comment, strip-c-comments, strip-comment, strip-comments
- Language: C
- Homepage:
- Size: 25.4 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Strip C-like Comments
A **C program** to strip comments from a `c` file and output the result to a new file.
## Features
- Fast and Without any third-party library
- Without using Regex
- Remove inline C-style comments
- Remove multiline C-style comments
- Trim whitespaces
- Remove two or more empty lines
## Build
```
gcc StripComments.c -o strip_comments
```
## Using
If you are going to strip comments and get the results in stdout:
```
./strip_comments StripComments.c
```
And maybe sometime you need to write the result in another or same file:
```
./strip_comments StripComments.c StripComments.nocomments.c
```
### TODO
- Add Makefile or CMake (to set `strip_comments` in /user/bin/)
Anyone welcome to do contribute or extend the program to support **Python** comments too. (With a flag)
© Copyright Max Base, 2022