Based on a pull request by Futago-za Ryuu (@futagoza): https://github.com/pegjs/pegjs/pull/329 Resolves #318.