目次

eos

xpeg::eos : Element(Element::TYPE_EOS);

Description

End of Stream の略です。Streamの終端で1回だけmatchします。

Bug

単体で使うとStream終端で複数回matchします。scanとかで使うと無限ループします。

Example

テキストファイルを1行ずつイテレートするサンプルです。最終行に改行が無くても表示します。

C++

Xtal

if (fs : FileStream("text.txt", "r")){
    fs.scan(xpeg::eol|xpeg::eos){
        it.prefix.p;
    }
}
else {
    "cannot open file".p;
}

Output

text file
no
中身
desu