Lines Matching +full:- +full:single +full:- +full:end
11 # Trying to parse JSON comments and then being able to re-insert them into
12 # the correct location on a re-emitted and sorted JSON would be very difficult.
15 # - Single-line style comments (//) can be on a new line or at the end of
18 # - Multi-line style comments (/* */) use the must be free-standing.
20 # - Comments will get inserted back into the file in the line they came
24 # - No attempts to re-indent multi-line comments will be made.
27 # prettier before using this script and planning to move multi-line comments
37 def __init__(self) -> None:
40 # Extract out the comments from a JSON-like string and save them away.
41 def extract_comments(self, contents: str) -> str:
48 single = CommentTracker.single_line_pattern.search(line)
49 if single:
50 do_append = False if line.startswith(single.group(0)) else True
51 line = line[: single.start(0)]
52 self.comments.append((do_append, idx, single.group(0)))
72 result.append(multi_line_segment[multi_end.end(0) :])
77 # Re-insert the saved off comments into a JSON-like string.
78 def insert_comments(self, contents: str) -> str: