コード例 #1
0
void toLexerOracleAPIs::updateAutoCompletionList(const QStringList &context, QStringList &list)
{
    list << "AAA" << "BBB";
    QsciScintilla* editor = lexer()->editor();
    if (editor == NULL)
        return;

    QmlJS::PersistentTrie::Trie trie;

    QString text = editor->text();
    int len = editor->length();
    char* bufferText = new char[len+1];
    editor->SendScintilla(QsciScintillaBase::SCI_GETTEXT, len, bufferText);
    bufferText[len] = '\0';
    std::auto_ptr <SQLLexer::Lexer> lexer = LexerFactTwoParmSing::Instance().create("OracleGuiLexer", "", "toCustomLexer");
    lexer->setStatement(bufferText, len);
    SQLLexer::Lexer::token_const_iterator it = lexer->begin();
    while (it != lexer->end())
    {
        SQLLexer::Token::TokenType t = it->getTokenType();
        if (it->getTokenType() == SQLLexer::Token::L_IDENTIFIER)
            trie.insert(it->getText());
        it++;
    }
    list << trie.complete(context.last());
}
コード例 #2
0
ファイル: mainwindow.cpp プロジェクト: YLGH/pyland
void MainWindow::runCode()
{

    if (running)
    {
        setRunning(false);
        updateSpeed();
        game->getCallbackState().stop();
    }
    else{
        QsciScintilla *ws = (QsciScintilla*)textWidget->currentWidget();

        int index = (textWidget->currentIndex())+ 1;

        std::string path = "python_embed/scripts/Script " + std::to_string(index) + ".py";

        //Save script as 'Script 1'/'Script 2' etc
        //Also save as 'Current Script.py' as temporary measure before new input manager
        //This python script is always run in bootstrapper.py (in start)
        ofstream fout(path.c_str(), ios::out|ios::trunc);
        ofstream foutcopy("python_embed/scripts/Current Script.py", ios::out|ios::trunc);

        if(!(fout.good() && foutcopy.good()))
        {
            LOG(INFO) << "Output file is bad" << endl;
            return;
        }

        fout << ws->text().toStdString();
        foutcopy << ws->text().toStdString();

        fout.close();
        foutcopy.close();

        setRunning(true);
        updateSpeed();
        game->getCallbackState().restart();
    }
    setGameFocus();
}
コード例 #3
0
ファイル: mainwindow.cpp プロジェクト: finomen/Ivan-Susanin
void MainWindow::runRun()
{
    QsciScintilla *active = dynamic_cast<QsciScintilla*>(ui->tabWidget->currentWidget());

    QString text = active->text();


    const char * script = text.toAscii().data();
    environment::world * w = new environment::world("Virtual world");
    w->start();
    w->run_script(script);
    //w->run_file("../../s.py");


}