Пример #1
0
void ScanParseSkel::scanFile(const Char8 *szFilename)
{
    if(szFilename == NULL)
        return;

#ifdef OSG_FLEX_USE_IOSTREAM_INPUT
    std::ifstream is(szFilename);

    if(is.good())
    {
        PNOTICE << "Loading Stream: " << szFilename << std::endl;

        scanStream(is);

        is.close();
    }
#else
    FILE *pInFile = fopen(szFilename, "r");

    if(pInFile != NULL)
    {
        PNOTICE << "Loading File : " << szFilename << std::endl;

        OSGScanParseSkel_in = pInFile;

        OSGScanParseSkel_parse(this);

        fclose(pInFile);
    }
#endif
}
void StreamHelper::getStreamFromFileStream(vector<string> &vs,vector<string> &oriPro,const char *path)
{
	FILE *in;
	in = fopen(path,"r");
	if (in == NULL) return;


	scanStream(oriPro,in);
	vs.assign(oriPro.begin(),oriPro.end());
	formateStream(vs);
	fclose(in);

}
void StreamHelper::getStreamFromBaseStream(vector<string> &vs)
{

	cout<<"input production before a enter one by one\n "
		"input one ';' to finish\n";
    scanStream(vs);
    formateStream(vs);
    cout<<".....................\n";
    for (size_t i=0;i<vs.size();i++)
    {
        cout<<vs[i]<<endl;
    }
    cout<<".....................\n";
}
Пример #4
0
Soprano::Node Soprano::N3NodeParser::parseNode( QTextStream& s, Node::N3ParserFlags flags ) const
{
    clearError();

    s.skipWhiteSpace();

    Node node;

    // we treat the empty string as an empty node without an error
    if ( s.atEnd() ) {
        return Node();
    }

    QChar c;
    s >> c;

    // parser resource node
    // ============================================
    if ( c == '<' ) {
        QString str;
        if ( scanStream( s, &str, '>' ) ) {
            node = Soprano::Node( QUrl::fromEncoded( str.toLatin1(), flags&Node::StrictUris ? QUrl::StrictMode : QUrl::TolerantMode ) );
        }
    }

    // parse blank node
    // ============================================
    else if ( c == '_' ) {
        s >> c;
        if ( c == ':' ) {
            // TODO: restrict the charset
            QString str;
            s >> str;
            if ( !str.isEmpty() )
                node = Soprano::Node::createBlankNode( str );
        }