[ruby/prism] IBM720 encoding
https://github.com/ruby/prism/commit/fc1f6ea3af
This commit is contained in:
parent
ba937eee0b
commit
8c44d69b9f
@ -165,6 +165,7 @@ extern pm_encoding_t pm_encoding_cp855;
|
||||
extern pm_encoding_t pm_encoding_euc_jp;
|
||||
extern pm_encoding_t pm_encoding_gbk;
|
||||
extern pm_encoding_t pm_encoding_ibm437;
|
||||
extern pm_encoding_t pm_encoding_ibm720;
|
||||
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;
|
||||
|
@ -120,6 +120,30 @@ static uint8_t pm_encoding_ibm437_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 IBM720 character.
|
||||
*/
|
||||
static uint8_t pm_encoding_ibm720_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.
|
||||
@ -789,6 +813,7 @@ PRISM_ENCODING_TABLE(cp850)
|
||||
PRISM_ENCODING_TABLE(cp852)
|
||||
PRISM_ENCODING_TABLE(cp855)
|
||||
PRISM_ENCODING_TABLE(ibm437)
|
||||
PRISM_ENCODING_TABLE(ibm720)
|
||||
PRISM_ENCODING_TABLE(iso_8859_1)
|
||||
PRISM_ENCODING_TABLE(iso_8859_2)
|
||||
PRISM_ENCODING_TABLE(iso_8859_3)
|
||||
@ -877,6 +902,16 @@ pm_encoding_t pm_encoding_ibm437 = {
|
||||
.multibyte = false
|
||||
};
|
||||
|
||||
/** IBM720 */
|
||||
pm_encoding_t pm_encoding_ibm720 = {
|
||||
.name = "IBM720",
|
||||
.char_width = pm_encoding_single_char_width,
|
||||
.alnum_char = pm_encoding_ibm720_alnum_char,
|
||||
.alpha_char = pm_encoding_ibm720_alpha_char,
|
||||
.isupper_char = pm_encoding_ibm720_isupper_char,
|
||||
.multibyte = false
|
||||
};
|
||||
|
||||
/** ISO-8859-1 */
|
||||
pm_encoding_t pm_encoding_iso_8859_1 = {
|
||||
.name = "ISO-8859-1",
|
||||
|
@ -6073,6 +6073,7 @@ parser_lex_magic_comment_encoding_value(pm_parser_t *parser, const uint8_t *star
|
||||
ENCODING1("CP855", pm_encoding_cp855);
|
||||
ENCODING2("GBK", "CP936", pm_encoding_gbk);
|
||||
ENCODING2("IBM437", "CP437", pm_encoding_ibm437);
|
||||
ENCODING2("IBM720", "CP720", pm_encoding_ibm720);
|
||||
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);
|
||||
|
@ -15,6 +15,7 @@ module Prism
|
||||
Encoding::EUC_JP,
|
||||
Encoding::GBK,
|
||||
Encoding::IBM437,
|
||||
Encoding::IBM720,
|
||||
Encoding::ISO_8859_1,
|
||||
Encoding::ISO_8859_2,
|
||||
Encoding::ISO_8859_3,
|
||||
|
Loading…
x
Reference in New Issue
Block a user