(
group: ParseNode<"ordgroup">,
errorMessage: string,
allowSpaces?: boolean,
)
| 50 | * literal space counts as a character; `~` and `\ ` do not. |
| 51 | */ |
| 52 | export function assertCharacterGroup( |
| 53 | group: ParseNode<"ordgroup">, |
| 54 | errorMessage: string, |
| 55 | allowSpaces?: boolean, |
| 56 | ): string { |
| 57 | let text = ""; |
| 58 | for (const node of group.body) { |
| 59 | if (node.type === "textord") { |
| 60 | text += node.text; |
| 61 | } else if (allowSpaces && node.type === "spacing" && node.text === " ") { |
| 62 | text += " "; |
| 63 | } else { |
| 64 | throw new ParseError(errorMessage, group); |
| 65 | } |
| 66 | } |
| 67 | return text; |
| 68 | } |
no outgoing calls
no test coverage detected