diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2023-11-12 00:17:08 -0500 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-11-16 17:39:38 +0000 |
| commit | b753e16945a4bf29ca0e84cecedc1363dffbfc19 (patch) | |
| tree | 78065ba1d738b716baffa30d32c98d497f91135a | |
| parent | 7dba4f424d41290131c229efbdd34930b27354bc (diff) | |
[ruby/prism] IBM862 encoding
https://github.com/ruby/prism/commit/151698bf86
| -rw-r--r-- | prism/enc/pm_encoding.h | 1 | ||||
| -rw-r--r-- | prism/enc/pm_tables.c | 35 | ||||
| -rw-r--r-- | prism/prism.c | 2 | ||||
| -rw-r--r-- | test/prism/encoding_test.rb | 1 |
4 files changed, 39 insertions, 0 deletions
diff --git a/prism/enc/pm_encoding.h b/prism/enc/pm_encoding.h index 31d196eddb..88f128c045 100644 --- a/prism/enc/pm_encoding.h +++ b/prism/enc/pm_encoding.h @@ -173,6 +173,7 @@ 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_ibm861; +extern pm_encoding_t pm_encoding_ibm862; 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; diff --git a/prism/enc/pm_tables.c b/prism/enc/pm_tables.c index e85f94f796..d33f52e2df 100644 --- a/prism/enc/pm_tables.c +++ b/prism/enc/pm_tables.c @@ -314,6 +314,30 @@ static uint8_t pm_encoding_ibm861_table[256] = { /** * Each element of the following table contains a bitfield that indicates a + * piece of information about the corresponding IBM862 character. + */ +static uint8_t pm_encoding_ibm862_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. */ static uint8_t pm_encoding_iso_8859_1_table[256] = { @@ -989,6 +1013,7 @@ PRISM_ENCODING_TABLE(ibm855) PRISM_ENCODING_TABLE(ibm857) PRISM_ENCODING_TABLE(ibm860) PRISM_ENCODING_TABLE(ibm861) +PRISM_ENCODING_TABLE(ibm862) PRISM_ENCODING_TABLE(iso_8859_1) PRISM_ENCODING_TABLE(iso_8859_2) PRISM_ENCODING_TABLE(iso_8859_3) @@ -1157,6 +1182,16 @@ pm_encoding_t pm_encoding_ibm861 = { .multibyte = false }; +/** IBM862 */ +pm_encoding_t pm_encoding_ibm862 = { + .name = "IBM862", + .char_width = pm_encoding_single_char_width, + .alnum_char = pm_encoding_ibm862_alnum_char, + .alpha_char = pm_encoding_ibm862_alpha_char, + .isupper_char = pm_encoding_ibm862_isupper_char, + .multibyte = false +}; + /** ISO-8859-1 */ pm_encoding_t pm_encoding_iso_8859_1 = { .name = "ISO-8859-1", diff --git a/prism/prism.c b/prism/prism.c index 1ec789003b..0812cf840b 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -6074,6 +6074,7 @@ parser_lex_magic_comment_encoding_value(pm_parser_t *parser, const uint8_t *star ENCODING1("CP857", pm_encoding_ibm857); ENCODING1("CP860", pm_encoding_ibm860); ENCODING1("CP861", pm_encoding_ibm861); + ENCODING1("CP862", pm_encoding_ibm862); ENCODING1("CP878", pm_encoding_koi8_r); ENCODING2("CP932", "csWindows31J", pm_encoding_windows_31j); ENCODING1("CP936", pm_encoding_gbk); @@ -6110,6 +6111,7 @@ parser_lex_magic_comment_encoding_value(pm_parser_t *parser, const uint8_t *star ENCODING1("IBM857", pm_encoding_ibm857); ENCODING1("IBM860", pm_encoding_ibm860); ENCODING1("IBM861", pm_encoding_ibm861); + ENCODING1("IBM862", pm_encoding_ibm862); 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); diff --git a/test/prism/encoding_test.rb b/test/prism/encoding_test.rb index 45c6e83269..c445d023a3 100644 --- a/test/prism/encoding_test.rb +++ b/test/prism/encoding_test.rb @@ -23,6 +23,7 @@ module Prism Encoding::IBM857, Encoding::IBM860, Encoding::IBM861, + Encoding::IBM862, Encoding::ISO_8859_1, Encoding::ISO_8859_2, Encoding::ISO_8859_3, |
