https://github.com/ruby/prism/commit/aa6163d77a
This commit is contained in:
Kevin Newton 2023-11-12 00:13:15 -05:00 коммит произвёл git
Родитель a7df025c3f
Коммит 91af9e8d93
4 изменённых файлов: 39 добавлений и 0 удалений

Просмотреть файл

@ -171,6 +171,7 @@ extern pm_encoding_t pm_encoding_ibm775;
extern pm_encoding_t pm_encoding_ibm852;
extern pm_encoding_t pm_encoding_ibm855;
extern pm_encoding_t pm_encoding_ibm857;
extern pm_encoding_t pm_encoding_ibm860;
extern pm_encoding_t pm_encoding_iso_8859_1;
extern pm_encoding_t pm_encoding_iso_8859_2;
extern pm_encoding_t pm_encoding_iso_8859_3;

Просмотреть файл

@ -264,6 +264,30 @@ static uint8_t pm_encoding_ibm857_table[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
};
/**
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding IBM860 character.
*/
static uint8_t pm_encoding_ibm860_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
};
/**
* Each element of the following table contains a bitfield that indicates a
* piece of information about the corresponding ISO-8859-1 character.
@ -939,6 +963,7 @@ PRISM_ENCODING_TABLE(ibm775)
PRISM_ENCODING_TABLE(ibm852)
PRISM_ENCODING_TABLE(ibm855)
PRISM_ENCODING_TABLE(ibm857)
PRISM_ENCODING_TABLE(ibm860)
PRISM_ENCODING_TABLE(iso_8859_1)
PRISM_ENCODING_TABLE(iso_8859_2)
PRISM_ENCODING_TABLE(iso_8859_3)
@ -1087,6 +1112,16 @@ pm_encoding_t pm_encoding_ibm857 = {
.multibyte = false
};
/** IBM860 */
pm_encoding_t pm_encoding_ibm860 = {
.name = "IBM860",
.char_width = pm_encoding_single_char_width,
.alnum_char = pm_encoding_ibm860_alnum_char,
.alpha_char = pm_encoding_ibm860_alpha_char,
.isupper_char = pm_encoding_ibm860_isupper_char,
.multibyte = false
};
/** ISO-8859-1 */
pm_encoding_t pm_encoding_iso_8859_1 = {
.name = "ISO-8859-1",

Просмотреть файл

@ -6072,6 +6072,7 @@ parser_lex_magic_comment_encoding_value(pm_parser_t *parser, const uint8_t *star
ENCODING1("CP852", pm_encoding_cp852);
ENCODING1("CP855", pm_encoding_cp855);
ENCODING1("CP857", pm_encoding_ibm857);
ENCODING1("CP860", pm_encoding_ibm860);
ENCODING1("CP878", pm_encoding_koi8_r);
ENCODING2("CP932", "csWindows31J", pm_encoding_windows_31j);
ENCODING1("CP936", pm_encoding_gbk);
@ -6106,6 +6107,7 @@ parser_lex_magic_comment_encoding_value(pm_parser_t *parser, const uint8_t *star
ENCODING1("IBM852", pm_encoding_ibm852);
ENCODING1("IBM855", pm_encoding_ibm855);
ENCODING1("IBM857", pm_encoding_ibm857);
ENCODING1("IBM860", pm_encoding_ibm860);
ENCODING2("ISO-8859-1", "ISO8859-1", pm_encoding_iso_8859_1);
ENCODING2("ISO-8859-2", "ISO8859-2", pm_encoding_iso_8859_2);
ENCODING2("ISO-8859-3", "ISO8859-3", pm_encoding_iso_8859_3);

Просмотреть файл

@ -21,6 +21,7 @@ module Prism
Encoding::IBM852,
Encoding::IBM855,
Encoding::IBM857,
Encoding::IBM860,
Encoding::ISO_8859_1,
Encoding::ISO_8859_2,
Encoding::ISO_8859_3,