from core.environment import IGNORE, MEANINGFUL import re def processString(source: str) -> str: """Remove blank characters and comments from source code. Args: source: The source code string. Returns: The cleaned source code. """ source = source.lstrip(IGNORE) while source and source[0] == ";": line_end: int = source.find("\n") if line_end < 0: return "" source = source[line_end:].lstrip(IGNORE) return source def findPrefix(source: str, separators: str = IGNORE + MEANINGFUL) -> str: """Find a meaningful prefix (token) in the source string. Args: source: The source code string. separators: Characters that mark token boundaries. Returns: The prefix token found, or empty string if none. """ pattern: str = rf"^[^{separators}]*" match = re.match(pattern, source) return match.group(0) if match else ""