| 25 | |
| 26 | |
| 27 | def remove_beginning_comments(command): |
| 28 | # Regular expression pattern to match comments |
| 29 | pattern = r"^(/\*.*?\*/|--.*?)(?:\n|$)" |
| 30 | |
| 31 | # Find and remove all comments from the beginning |
| 32 | cleaned_command = command |
| 33 | comments = [] |
| 34 | match = re.match(pattern, cleaned_command, re.DOTALL) |
| 35 | while match: |
| 36 | comments.append(match.group()) |
| 37 | cleaned_command = cleaned_command[len(match.group()) :].lstrip() |
| 38 | match = re.match(pattern, cleaned_command, re.DOTALL) |
| 39 | |
| 40 | return [cleaned_command, comments] |
| 41 | |
| 42 | |
| 43 | def register_typecasters(connection): |