Added logic to remove bash and shell comments

This commit is contained in:
Kevin Veen-Birkenbach 2024-07-21 09:22:53 +02:00
parent c950a42ca9
commit 095701e304

View File

@ -9,6 +9,8 @@ class CodeProcessor:
C = ".c" C = ".c"
CPP = ".cpp" CPP = ".cpp"
H = ".h" H = ".h"
BASH = ".sh"
SHELL = ".bash"
@staticmethod @staticmethod
def remove_comments(content, file_type): def remove_comments(content, file_type):
@ -34,6 +36,12 @@ class CodeProcessor:
CodeProcessor.H: [ CodeProcessor.H: [
(r'\s*//.*', '',0), (r'\s*//.*', '',0),
(r'/\*.*?\*/', '',0) (r'/\*.*?\*/', '',0)
],
CodeProcessor.BASH: [
(r'\s*#.*', '', 0)
],
CodeProcessor.SHELL: [
(r'\s*#.*', '', 0)
] ]
} }