class Crass::Scanner
def peek(length = 1)
doesn't consume them. The number of characters returned may be less than
Returns up to _length_ characters starting at the current position, but
def peek(length = 1) # Grab the bytes for up to _length_ characters and then take the first # _length_ characters. A UTF-8 character is at most four bytes, so `length # * 4` bytes always contains at least _length_ whole characters when that # many remain. This avoids the O(n) character-offset slice that # `@string[pos, length]` would otherwise perform on multi-byte input. @string.byteslice(@scanner.pos, length * 4).slice(0, length) || '' end