Sedlexing.Utf16SourceUtf16.from_gen s opt_bo creates a lexbuf from an UTF-16 encoded stream. If opt_bo matches with None the function expects a BOM (Byte Order Mark), and takes the byte order as Utf16.Big_endian if it cannot find one. When opt_bo matches with Some bo, bo is taken as byte order. In this case a leading BOM is kept in the stream - the lexer has to ignore it and a `wrong' BOM (0xfffe) will raise Utf16.InvalidCodepoint.
Works as Utf16.from_gen with an in_channel.
Works as Utf16.from_gen with a string.
utf16_lexeme lb bo bom as Sedlexing.lexeme with a result encoded in UTF-16 in byte_order bo and starting with a BOM if bom = true.
sub_lexeme lb pos len bo bom as Sedlexing.sub_lexeme with a result encoded in UTF-16 with byte order bo and starting with a BOM if bom=true