diff options
author | Orhan Toy <[email protected]> | 2023-11-19 00:23:03 +0100 |
---|---|---|
committer | git <[email protected]> | 2023-11-19 01:03:19 +0000 |
commit | 71a30b7596915189a71e90ebf2c81844cf045248 (patch) | |
tree | e362ba41db281578c38aa06146764f02fccbb91a /prism | |
parent | db6492092f6ebcbaeecbd6851722c38619182bb1 (diff) |
[ruby/prism] Add macCyrillic encoding
https://github.com/ruby/prism/commit/220b40921a
Diffstat (limited to 'prism')
-rw-r--r-- | prism/enc/pm_encoding.h | 1 | ||||
-rw-r--r-- | prism/enc/pm_tables.c | 35 | ||||
-rw-r--r-- | prism/prism.c | 1 |
3 files changed, 37 insertions, 0 deletions
diff --git a/prism/enc/pm_encoding.h b/prism/enc/pm_encoding.h index 93599fc87f..c6addba9c1 100644 --- a/prism/enc/pm_encoding.h +++ b/prism/enc/pm_encoding.h @@ -193,6 +193,7 @@ 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_cent_euro; +extern pm_encoding_t pm_encoding_mac_cyrillic; extern pm_encoding_t pm_encoding_mac_greek; extern pm_encoding_t pm_encoding_mac_iceland; extern pm_encoding_t pm_encoding_mac_roman; diff --git a/prism/enc/pm_tables.c b/prism/enc/pm_tables.c index 6f9e513664..01ca103bff 100644 --- a/prism/enc/pm_tables.c +++ b/prism/enc/pm_tables.c @@ -770,6 +770,30 @@ static uint8_t pm_encoding_mac_cent_euro_table[256] = { /** * Each element of the following table contains a bitfield that indicates a + * piece of information about the corresponding macCyrillic character. + */ +static uint8_t pm_encoding_mac_cyrillic_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 macGreek character. */ static uint8_t pm_encoding_mac_greek_table[256] = { @@ -1272,6 +1296,7 @@ PRISM_ENCODING_TABLE(iso_8859_15) PRISM_ENCODING_TABLE(iso_8859_16) PRISM_ENCODING_TABLE(koi8_r) PRISM_ENCODING_TABLE(mac_cent_euro) +PRISM_ENCODING_TABLE(mac_cyrillic) PRISM_ENCODING_TABLE(mac_greek) PRISM_ENCODING_TABLE(mac_iceland) PRISM_ENCODING_TABLE(mac_roman) @@ -1622,6 +1647,16 @@ pm_encoding_t pm_encoding_mac_cent_euro = { .multibyte = false }; +/** macCyrillic */ +pm_encoding_t pm_encoding_mac_cyrillic = { + .name = "macCyrillic", + .char_width = pm_encoding_single_char_width, + .alnum_char = pm_encoding_mac_cyrillic_alnum_char, + .alpha_char = pm_encoding_mac_cyrillic_alpha_char, + .isupper_char = pm_encoding_mac_cyrillic_isupper_char, + .multibyte = false +}; + /** macGreek */ pm_encoding_t pm_encoding_mac_greek = { .name = "macGreek", diff --git a/prism/prism.c b/prism/prism.c index ddba96c001..5de401e311 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -6140,6 +6140,7 @@ parser_lex_magic_comment_encoding_value(pm_parser_t *parser, const uint8_t *star break; case 'M': case 'm': ENCODING1("macCentEuro", pm_encoding_mac_cent_euro); + ENCODING1("macCyrillic", pm_encoding_mac_cyrillic); ENCODING1("macGreek", pm_encoding_mac_greek); ENCODING1("macIceland", pm_encoding_mac_iceland); ENCODING1("macRoman", pm_encoding_mac_roman); |