コード例 #1
0
ファイル: sieveparser.cpp プロジェクト: aox/aox
class SieveCommand * SieveParser::command()
{
    whitespace();

    SieveCommand * sc = new SieveCommand;
    sc->setParser( this );
    sc->setStart( pos() );

    sc->setIdentifier( identifier() );
    sc->setArguments( arguments() );
    whitespace();
    if ( nextChar() == '{' ) {
        sc->setBlock( block() );
    }
    else if ( present( ";" ) ) {
        // fine
    }
    else {
        setError( "Garbage after command: " + following() );
        // if the line ends with ';', skip ahead to it
        uint x = pos();
        while ( x < input().length() &&
                input()[x] != '\n' && input()[x] != '\r' )
            x++;
        if ( x > pos() && input()[x-1] == ';' )
            step( x - pos() );
    }

    sc->setError( error() );
    sc->setEnd( pos() );
    return sc;
}