зеркало из https://github.com/github/ruby.git
[ruby/prism] Add macGreek encoding
https://github.com/ruby/prism/commit/c36d3fc647
This commit is contained in:
Родитель
ce85355931
Коммит
3bc41f4f0b
|
@ -190,6 +190,7 @@ extern pm_encoding_t pm_encoding_iso_8859_14;
|
|||
extern pm_encoding_t pm_encoding_iso_8859_15;
|
||||
extern pm_encoding_t pm_encoding_iso_8859_16;
|
||||
extern pm_encoding_t pm_encoding_koi8_r;
|
||||
extern pm_encoding_t pm_encoding_mac_greek;
|
||||
extern pm_encoding_t pm_encoding_mac_iceland;
|
||||
extern pm_encoding_t pm_encoding_mac_romania;
|
||||
extern pm_encoding_t pm_encoding_shift_jis;
|
||||
|
|
|
@ -720,6 +720,30 @@ static uint8_t pm_encoding_koi8_r_table[256] = {
|
|||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Fx
|
||||
};
|
||||
|
||||
/**
|
||||
* Each element of the following table contains a bitfield that indicates a
|
||||
* piece of information about the corresponding macGreek character.
|
||||
*/
|
||||
static uint8_t pm_encoding_mac_greek_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 macIceland character.
|
||||
|
@ -1078,6 +1102,7 @@ PRISM_ENCODING_TABLE(iso_8859_14)
|
|||
PRISM_ENCODING_TABLE(iso_8859_15)
|
||||
PRISM_ENCODING_TABLE(iso_8859_16)
|
||||
PRISM_ENCODING_TABLE(koi8_r)
|
||||
PRISM_ENCODING_TABLE(mac_greek)
|
||||
PRISM_ENCODING_TABLE(mac_iceland)
|
||||
PRISM_ENCODING_TABLE(mac_romania)
|
||||
PRISM_ENCODING_TABLE(windows_1250)
|
||||
|
@ -1402,6 +1427,16 @@ pm_encoding_t pm_encoding_koi8_r = {
|
|||
.multibyte = false
|
||||
};
|
||||
|
||||
/** macGreek */
|
||||
pm_encoding_t pm_encoding_mac_greek = {
|
||||
.name = "macGreek",
|
||||
.char_width = pm_encoding_single_char_width,
|
||||
.alnum_char = pm_encoding_mac_greek_alnum_char,
|
||||
.alpha_char = pm_encoding_mac_greek_alpha_char,
|
||||
.isupper_char = pm_encoding_mac_greek_isupper_char,
|
||||
.multibyte = false
|
||||
};
|
||||
|
||||
/** macIceland */
|
||||
pm_encoding_t pm_encoding_mac_iceland = {
|
||||
.name = "macIceland",
|
||||
|
|
|
@ -6135,6 +6135,7 @@ parser_lex_magic_comment_encoding_value(pm_parser_t *parser, const uint8_t *star
|
|||
ENCODING1("locale", pm_encoding_utf_8);
|
||||
break;
|
||||
case 'M': case 'm':
|
||||
ENCODING1("macGreek", pm_encoding_mac_greek);
|
||||
ENCODING1("macIceland", pm_encoding_mac_iceland);
|
||||
ENCODING1("macRomania", pm_encoding_mac_romania);
|
||||
break;
|
||||
|
|
|
@ -38,6 +38,7 @@ module Prism
|
|||
Encoding::ISO_8859_15 => 0x00...0x100,
|
||||
Encoding::ISO_8859_16 => 0x00...0x100,
|
||||
Encoding::KOI8_R => 0x00...0x100,
|
||||
Encoding::MACGREEK => 0x00...0x100,
|
||||
Encoding::MACICELAND => 0x00...0x100,
|
||||
Encoding::MACROMANIA => 0x00...0x100,
|
||||
Encoding::Windows_1250 => 0x00...0x100,
|
||||
|
|
Загрузка…
Ссылка в новой задаче