News and announcements

華和梨辞書のパースのめどがつきました

Written for KAWARI-Perl by N Narazaka on 2012-05-25

エントリ内容だけでなく、一連の辞書としてのパースに成功しました。
kis,dictも判別しますし、見た感じ良く動いています。ただし括弧の整合などは怪しいです。
まだテストしたサンプルが少ないので99%バグは存在しますが、希望は見えました。

ただ、この次点ですでに若干場当たり実装感があるのはいかんなあ……。

主にdictionaryブランチのt/dictionary.tをperl dictionary.tなどとやってやればkawarirc.kisのパース結果が見られます。

Updated .

華和梨辞書のエントリ内容のパースに成功した気がします。

Written for KAWARI-Perl by N Narazaka on 2012-05-24

hoge : huga,piyo
のhugaのみのパースですが、おおむねうまくいった模様です。
Kawari/Script.pmに直に下記を食わせて以下のようなツリーを生成しました。

"a$(set rr $[0*5])\"a\"\\"a$[2+1]666$(set aaa $(get s)$aaaa[$[${en}*2]]$[5+2/3])

|
V

$VAR1 = bless( {
                 'tree' => [
                             '',
                             bless( {
                                      'tree' => [
                                                  'a$(set rr $[0*5])\\"a\\"\\\\'
                                                ],
                                      'type' => 'dquoted'
                                    }, 'Kawari::Script' ),
                             'a',
                             bless( {
                                      'tree' => [
                                                  '2+1'
                                                ],
                                      'type' => 'expr'
                                    }, 'Kawari::Script' ),
                             '666',
                             bless( {
                                      'tree' => [
                                                  'set aaa ',
                                                  bless( {
                                                           'tree' => [
                                                                       'get s'
                                                                     ],
                                                           'type' => 'cmd'
                                                         }, 'Kawari::Script' ),
                                                  '',
                                                  bless( {
                                                           'index' => bless( {
                                                                               'tree' => [
                                                                                           '',
                                                                                           bless( {
                                                                                                    'tree' => [
                                                                                                                '',
                                                                                                                bless( {
                                                                                                                         'tree' => [
                                                                                                                                     'en'
                                                                                                                                   ],
                                                                                                                         'type' => 'call'
                                                                                                                       }, 'Kawari::Script' ),
                                                                                                                '*2'
                                                                                                              ],
                                                                                                    'type' => 'expr'
                                                                                                  }, 'Kawari::Script' ),
                                                                                           ''
                                                                                         ],
                                                                               'type' => 'elem_index'
                                                                             }, 'Kawari::Script' ),
                                                           'tree' => [
                                                                       'aaaa'
                                                                     ],
                                                           'type' => 'elem'
                                                         }, 'Kawari::Script' ),
                                                  '',
                                                  bless( {
                                                           'tree' => [
                                                                       '5+2/3'
                                                                     ],
                                                           'type' => 'expr'
                                                         }, 'Kawari::Script' ),
                                                  ''
                                                ],
                                      'type' => 'cmd'
                                    }, 'Kawari::Script' ),
                             ''
                           ],
                 'type' => 'plain'
               }, 'Kawari::Script' );

12 of 2 results