wxD 作業を楽したいがためにhtmlパーサと、d言語簡易パーサ作る。

なんか、いちいち、仕様書とにらめっこするのもてーへんなので、勢いに任せて、仕様書のHTMLをパースして、そいつを、Dソースの該当メソッドの位置に埋め込んじゃうってのを作りました。あと、仕様にあるけど、足りないメソッドをクラスの一番下につけたり、グーグル検索に直ぐ飛べるようにアドレス追加したり、、、。

以下、挿入したソース

module wxd.wxAcceleratorTable;

private import std.string, wxd.Define, wxd.LoadWxc, wxd.wxdBase;

public class wxAcceleratorTable : wxdBase {
    protected this(bool _dummy) { super(true); }

    protected this(void* inst, bool _dummy) {
        _instance = inst;
        super(true);
    }
    public static wxAcceleratorTable Create(void* inst) {
        return new wxAcceleratorTable(inst, true);
    }

    //spec this();
    //spec this(const wxAcceleratorTable& bitmap);
    //spec this(int n, wxAcceleratorEntry entries[]);
    //spec this(const wxString& resource);
    public this(int n, void* entries) {
        _instance = wxAcceleratorTable_Create(n, entries);
        super(true);
    }
    //spec ~this();
    public ~this() {
        if (!_already_call_destructor) {
            wxAcceleratorTable_Delete(_instance);
            _already_call_destructor = true;
        }
    }

    //spec http://www.google.co.jp/search?q=wxAcceleratorTable
    //spec bool Ok() const;
    //spec wxAcceleratorTable&  operator =(const wxAcceleratorTable& accel);
    //spec bool operator ==(const wxAcceleratorTable& accel);
    //spec bool operator !=(const wxAcceleratorTable& accel);
}

//spec 以下が自動挿入個所です。

一気に書き上げたので、すげー、疲れた。
けど、これで100人力です。

プログラムは2つ。

1つは、wxDの仕様書のhtmlから、dっぽい、c++っぽい、簡易d言語パーサ用のファイルを出力するもの。内部では、Webアプリケーション作成ライブラリ用のhtmlパーサを使っています。

もう一つは、dのコードハイライトを改造して、字句解析関数にして、Webアプリケーション用に作った、XMLDomクラスに構文解析っぽいことをして、突っ込んで、ちょこちょこ、XMLいじくって使いやすいようにしておいて、あとは、Domの表層部分(classのノードの上だけ)回って必要な個所に、関数仕様をぶちこんでいっています。