splitter: Fix handling of trailing comments/whitespace