зеркало из https://github.com/github/ruby.git
[ruby/prism] feat: add encoding for IBM865
(https://github.com/ruby/prism/pull/1884) * feat: add encoding for IBM865 * style: fix incorrect autoformat https://github.com/ruby/prism/commit/14c6ae0182
This commit is contained in:
Родитель
9aee12cc28
Коммит
701b0650de
|
@ -177,6 +177,7 @@ extern pm_encoding_t pm_encoding_ibm860;
|
|||
extern pm_encoding_t pm_encoding_ibm861;
|
||||
extern pm_encoding_t pm_encoding_ibm862;
|
||||
extern pm_encoding_t pm_encoding_ibm864;
|
||||
extern pm_encoding_t pm_encoding_ibm865;
|
||||
extern pm_encoding_t pm_encoding_ibm866;
|
||||
extern pm_encoding_t pm_encoding_iso_8859_1;
|
||||
extern pm_encoding_t pm_encoding_iso_8859_2;
|
||||
|
|
|
@ -384,6 +384,30 @@ static uint8_t pm_encoding_ibm864_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 IBM865 character.
|
||||
*/
|
||||
static uint8_t pm_encoding_ibm865_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 IBM866 character.
|
||||
|
@ -1328,6 +1352,7 @@ PRISM_ENCODING_TABLE(ibm860)
|
|||
PRISM_ENCODING_TABLE(ibm861)
|
||||
PRISM_ENCODING_TABLE(ibm862)
|
||||
PRISM_ENCODING_TABLE(ibm864)
|
||||
PRISM_ENCODING_TABLE(ibm865)
|
||||
PRISM_ENCODING_TABLE(ibm866)
|
||||
PRISM_ENCODING_TABLE(iso_8859_1)
|
||||
PRISM_ENCODING_TABLE(iso_8859_2)
|
||||
|
@ -1537,6 +1562,16 @@ pm_encoding_t pm_encoding_ibm864 = {
|
|||
.multibyte = false
|
||||
};
|
||||
|
||||
/** IBM866 */
|
||||
pm_encoding_t pm_encoding_ibm865 = {
|
||||
.name = "IBM865",
|
||||
.char_width = pm_encoding_single_char_width,
|
||||
.alnum_char = pm_encoding_ibm865_alnum_char,
|
||||
.alpha_char = pm_encoding_ibm865_alpha_char,
|
||||
.isupper_char = pm_encoding_ibm865_isupper_char,
|
||||
.multibyte = false
|
||||
};
|
||||
|
||||
/** IBM866 */
|
||||
pm_encoding_t pm_encoding_ibm866 = {
|
||||
.name = "IBM866",
|
||||
|
|
|
@ -6077,6 +6077,7 @@ parser_lex_magic_comment_encoding_value(pm_parser_t *parser, const uint8_t *star
|
|||
ENCODING1("CP861", pm_encoding_ibm861);
|
||||
ENCODING1("CP862", pm_encoding_ibm862);
|
||||
ENCODING1("CP864", pm_encoding_ibm864);
|
||||
ENCODING1("CP865", pm_encoding_ibm865);
|
||||
ENCODING1("CP866", pm_encoding_ibm866);
|
||||
ENCODING1("CP874", pm_encoding_windows_874);
|
||||
ENCODING1("CP878", pm_encoding_koi8_r);
|
||||
|
@ -6118,6 +6119,7 @@ parser_lex_magic_comment_encoding_value(pm_parser_t *parser, const uint8_t *star
|
|||
ENCODING1("IBM861", pm_encoding_ibm861);
|
||||
ENCODING1("IBM862", pm_encoding_ibm862);
|
||||
ENCODING1("IBM864", pm_encoding_ibm864);
|
||||
ENCODING1("IBM865", pm_encoding_ibm865);
|
||||
ENCODING1("IBM866", pm_encoding_ibm866);
|
||||
ENCODING2("ISO-8859-1", "ISO8859-1", pm_encoding_iso_8859_1);
|
||||
ENCODING2("ISO-8859-2", "ISO8859-2", pm_encoding_iso_8859_2);
|
||||
|
|
|
@ -24,6 +24,7 @@ module Prism
|
|||
Encoding::IBM861 => 0x00...0x100,
|
||||
Encoding::IBM862 => 0x00...0x100,
|
||||
Encoding::IBM864 => 0x00...0x100,
|
||||
Encoding::IBM865 => 0x00...0x100,
|
||||
Encoding::IBM866 => 0x00...0x100,
|
||||
Encoding::ISO_8859_1 => 0x00...0x100,
|
||||
Encoding::ISO_8859_2 => 0x00...0x100,
|
||||
|
|
Загрузка…
Ссылка в новой задаче