Type Definition lib_ruby_parser::source::CustomDecoder [−][src]
type CustomDecoder = fn(_: StringPtr, _: List<u8>) -> CustomDecoderResult;
Decoder is what is used if input source has encoding that is not supported out of the box.
Supported encoding are:
- UTF-8
- ASCII-8BIT (or BINARY, it’s an alias)
So if your source looks like this:
# encoding: koi8-r
\xFF = 42
you need to provide a decoder that converts this byte sequence into UTF-8 bytes.
Decoding function
Takes encoding name and initial input as arguments
and returns Ok(decoded)
vector of bytes or Err(error)
that will be returned
in the ParserResult::diagnostics
vector.