nl_tokens: Parse a buffer to a array of segments
pl_tokens: function parseSegments ( buffer ) { if ( buffer . length == 0 ) throw new Error ( "bad segments stream" ) ; let <mask> = 0 ; let segments = [ ] ; while ( pointer < buffer . length ) { let seg = parseSegment ( buffer , pointer ) ; segments . push ( seg ) ; pointer += seg . bufferLength ; delete seg . bufferLength ; } if ( pointer != buffer . length ) { throw new Error ( "Bad / incomplete segments" ) ; } return segments ; }