docs/encoding.md in yarp-0.12.0 vs docs/encoding.md in yarp-0.13.0

- old
+ new

@@ -8,11 +8,11 @@ ```ruby # encoding: iso-8859-9 ``` -The key of the comment can be either "encoding" or "coding". The value of the comment must be a string that is a valid encoding name. The encodings that YARP supports by default are: +The key of the comment can be either "encoding" or "coding". The value of the comment must be a string that is a valid encoding name. The encodings that prism supports by default are: * `ascii` * `ascii-8bit` * `big5` * `binary` @@ -42,15 +42,15 @@ * `utf8-mac` * `windows-31j` * `windows-1251` * `windows-1252` -For each of these encodings, YARP provides a function for checking if the subsequent bytes form an alphabetic or alphanumeric character. +For each of these encodings, prism provides a function for checking if the subsequent bytes form an alphabetic or alphanumeric character. ## Support for other encodings -If an encoding is encountered that is not supported by YARP, YARP will call a user-provided callback function with the name of the encoding if one is provided. That function can be registered with `yp_parser_register_encoding_decode_callback`. The user-provided callback function can then provide a pointer to an encoding struct that contains the requisite functions that YARP will use those to parse identifiers going forward. +If an encoding is encountered that is not supported by prism, prism will call a user-provided callback function with the name of the encoding if one is provided. That function can be registered with `pm_parser_register_encoding_decode_callback`. The user-provided callback function can then provide a pointer to an encoding struct that contains the requisite functions that prism will use those to parse identifiers going forward. If the user-provided callback function returns `NULL` (the value also provided by the default implementation in case a callback was not registered), an error will be added to the parser's error list and parsing will continue on using the default UTF-8 encoding. ```c // This struct defines the functions necessary to implement the encoding @@ -82,36 +82,36 @@ // passed to Encoding.find in Ruby. const char *name; // Return true if the encoding is a multibyte encoding. bool multibyte; -} yp_encoding_t; +} pm_encoding_t; -// When an encoding is encountered that isn't understood by YARP, we provide +// When an encoding is encountered that isn't understood by prism, we provide // the ability here to call out to a user-defined function to get an encoding // struct. If the function returns something that isn't NULL, we set that to // our encoding and use it to parse identifiers. -typedef yp_encoding_t *(*yp_encoding_decode_callback_t)(yp_parser_t *parser, const uint8_t *name, size_t width); +typedef pm_encoding_t *(*pm_encoding_decode_callback_t)(pm_parser_t *parser, const uint8_t *name, size_t width); -// Register a callback that will be called when YARP encounters a magic comment +// Register a callback that will be called when prism encounters a magic comment // with an encoding referenced that it doesn't understand. The callback should // return NULL if it also doesn't understand the encoding or it should return a -// pointer to a yp_encoding_t struct that contains the functions necessary to +// pointer to a pm_encoding_t struct that contains the functions necessary to // parse identifiers. -YP_EXPORTED_FUNCTION void -yp_parser_register_encoding_decode_callback(yp_parser_t *parser, yp_encoding_decode_callback_t callback); +PRISM_EXPORTED_FUNCTION void +pm_parser_register_encoding_decode_callback(pm_parser_t *parser, pm_encoding_decode_callback_t callback); ``` ## Getting notified when the encoding changes -You may want to get notified when the encoding changes based on the result of parsing an encoding comment. We use this internally for our `lex` function in order to provide the correct encodings for the tokens that are returned. For that you can register a callback with `yp_parser_register_encoding_changed_callback`. The callback will be called with a pointer to the parser. The encoding can be accessed through `parser->encoding`. +You may want to get notified when the encoding changes based on the result of parsing an encoding comment. We use this internally for our `lex` function in order to provide the correct encodings for the tokens that are returned. For that you can register a callback with `pm_parser_register_encoding_changed_callback`. The callback will be called with a pointer to the parser. The encoding can be accessed through `parser->encoding`. ```c -// When the encoding that is being used to parse the source is changed by YARP, +// When the encoding that is being used to parse the source is changed by prism, // we provide the ability here to call out to a user-defined function. -typedef void (*yp_encoding_changed_callback_t)(yp_parser_t *parser); +typedef void (*pm_encoding_changed_callback_t)(pm_parser_t *parser); -// Register a callback that will be called whenever YARP changes the encoding it -// is using to parse based on the magic comment. -YP_EXPORTED_FUNCTION void -yp_parser_register_encoding_changed_callback(yp_parser_t *parser, yp_encoding_changed_callback_t callback); +// Register a callback that will be called whenever prism changes the encoding +// it is using to parse based on the magic comment. +PRISM_EXPORTED_FUNCTION void +pm_parser_register_encoding_changed_callback(pm_parser_t *parser, pm_encoding_changed_callback_t callback); ```