diff --git a/cstruct/__init__.py b/cstruct/__init__.py index 073c41c..648f348 100644 --- a/cstruct/__init__.py +++ b/cstruct/__init__.py @@ -195,6 +195,7 @@ def parse_struct(st): # remove the comments st = st.replace("*/","*/\n") st = " ".join(re.split("/\*.*\*/",st)) + st = "\n".join([s.split("//")[0] for s in st.split("\n")]) st.replace("\n", " ") for line_s in st.split(";"): line_s = line_s.strip() diff --git a/cstruct/tests/test_cstruct.py b/cstruct/tests/test_cstruct.py index fa6bb30..b9b5436 100644 --- a/cstruct/tests/test_cstruct.py +++ b/cstruct/tests/test_cstruct.py @@ -52,7 +52,7 @@ class Partition(cstruct.CStruct): unsigned char partition_type; struct Position end; unsigned int start_sect; /* starting sector counting from 0 */ - unsigned int sectors; /* nr of sectors in partition */ + unsigned int sectors; // nr of sectors in partition """