From: Myun2 Date: Tue, 3 Aug 2010 13:11:40 +0000 (+0900) Subject: mbstring: euc_jp.hpp, shift_jis.hpp 実装 X-Git-Tag: 20111130_shapeup_prev~275 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=53d441a855400c1af49c15a3aa1d1d177d940e57;p=roast%2Froast.git mbstring: euc_jp.hpp, shift_jis.hpp 実装 --- diff --git a/roast/include/roast/str/multibyte/japanese/euc_jp.hpp b/roast/include/roast/str/multibyte/japanese/euc_jp.hpp index 3ccc885b..2c520abe 100644 --- a/roast/include/roast/str/multibyte/japanese/euc_jp.hpp +++ b/roast/include/roast/str/multibyte/japanese/euc_jp.hpp @@ -6,9 +6,53 @@ #ifndef __SFJP_ROAST__str__multi_byte__japanese__euc_jp_HPP__ #define __SFJP_ROAST__str__multi_byte__japanese__euc_jp_HPP__ +#include "roast/lexical/string_structure.hpp" + namespace roast { - + namespace multibyte + { + namespace jananese + { + namespace euc_jp + { + using namespace ::roast::lexical::structure; + + /* + §ŒäƒR[ƒh + 0x00`0x1FA0x7F + ASCII•¶Žš + 0x20`0x7E + + Š¿Žš + 0xA1A1`0xFEFE (‘æ1ƒoƒCƒgE‘æ2ƒoƒCƒg‚Æ‚à0xA1`0xFE) + ”¼ŠpƒJƒ^ƒJƒi + 0x8EA1`0x8EDF + •â•Š¿Žš + 0x8FA1A1`0x8FFEFE (‘æ2ƒoƒCƒgE‘æ3ƒoƒCƒg‚Æ‚à0xA1`0xFE) + */ + typedef or< + // 1byte (00-7f) + int_range< 0x00, 0x7f >, + + // 3byte (0x8FA1A1-0x8FFEFE) + seq< + int_range< 0x8f, 0x8f >, + int_range< 0xa1, 0xfe >, + int_range< 0xa1, 0xfe > + >, + + // 2byte (0x8EA1`0x8EDF) + seq< + int_range< 0xa1, 0xfe >, + int_range< 0xa1, 0xfe > + >, + + get_numeric<1> + > lexical_rule; + } + } + } } #endif//__SFJP_ROAST__str__multi_byte__japanese__euc_jp_HPP__ diff --git a/roast/include/roast/str/multibyte/japanese/shift_jis.hpp b/roast/include/roast/str/multibyte/japanese/shift_jis.hpp index 1a215eb4..e9b98a65 100644 --- a/roast/include/roast/str/multibyte/japanese/shift_jis.hpp +++ b/roast/include/roast/str/multibyte/japanese/shift_jis.hpp @@ -6,9 +6,47 @@ #ifndef __SFJP_ROAST__str__multi_byte__japanese__shift_jis_HPP__ #define __SFJP_ROAST__str__multi_byte__japanese__shift_jis_HPP__ +#include "roast/lexical/string_structure.hpp" + namespace roast { - + namespace multibyte + { + namespace jananese + { + namespace euc_jp + { + using namespace ::roast::lexical::structure; + + // Shift_JIS + typedef or< + + // 1byte (00-7f) + seq< + test< + int_range< 0x00, 0x7f > + >, + get_numeric<1> + >, + + // 2byte (0x81-0x9f | 0xe0-0xef) (0x40-0x7e | 0x80-0xfc) + seq< + test, + int_range< 0xe0, 0xef > + > + >, + get_numeric<2> + >, + + // unknown (Get 1byte.) + get_numeric<1> + > + lexical_rule; + } + } + } } #endif//__SFJP_ROAST__str__multi_byte__japanese__shift_jis_HPP__