()
| 324 | } |
| 325 | |
| 326 | function* IPAddress() { |
| 327 | const first = yield Digit; |
| 328 | yield '.'; |
| 329 | const second = yield Digit; |
| 330 | yield '.'; |
| 331 | const third = yield Digit; |
| 332 | yield '.'; |
| 333 | const fourth = yield Digit; |
| 334 | yield mustEnd; |
| 335 | return [first, second, third, fourth]; |
| 336 | } |
| 337 | |
| 338 | it('accepts valid IP addresses', () => { |
| 339 | expect(parse('1.2.3.4', IPAddress())).toEqual({ |