* Check if bytes at position match a string.
(pos: number, str: string)
| 511 | * Check if bytes at position match a string. |
| 512 | */ |
| 513 | private matchesAt(pos: number, str: string): boolean { |
| 514 | const bytes = this.scanner.bytes; |
| 515 | |
| 516 | for (let i = 0; i < str.length; i++) { |
| 517 | if (pos + i >= bytes.length || bytes[pos + i] !== str.charCodeAt(i)) { |
| 518 | return false; |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | return true; |
| 523 | } |
| 524 | |
| 525 | /** |
| 526 | * Skip whitespace at given position, return new position. |