From b1ca0bb60058b60f3ceca8973d9a50b608327265 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sun, 11 Dec 2022 19:47:43 +0800 Subject: [PATCH] - enhancement: Import FPS (free problem set) files. --- NEWS.md | 8 +- RedPandaIDE/RedPandaIDE.pro | 4 +- RedPandaIDE/compiler/projectcompiler.cpp | 4 +- RedPandaIDE/cpprefacter.cpp | 4 +- RedPandaIDE/editor.cpp | 46 +- RedPandaIDE/mainwindow.cpp | 35 +- RedPandaIDE/mainwindow.h | 2 + RedPandaIDE/mainwindow.ui | 11 + RedPandaIDE/parser/cppparser.cpp | 157 ++- RedPandaIDE/parser/cppparser.h | 20 +- RedPandaIDE/parser/cpppreprocessor.cpp | 1 - RedPandaIDE/parser/cpppreprocessor.h | 19 +- RedPandaIDE/problems/freeprojectsetformat.cpp | 91 ++ RedPandaIDE/problems/freeprojectsetformat.h | 9 + RedPandaIDE/problems/ojproblemset.h | 3 + RedPandaIDE/syntaxermanager.cpp | 42 +- RedPandaIDE/syntaxermanager.h | 4 - RedPandaIDE/todoparser.cpp | 4 +- RedPandaIDE/translations/RedPandaIDE_pt_BR.ts | 12 + RedPandaIDE/translations/RedPandaIDE_zh_CN.ts | 1219 +++++++++-------- RedPandaIDE/translations/RedPandaIDE_zh_TW.ts | 12 + RedPandaIDE/widgets/codecompletionpopup.cpp | 4 +- RedPandaIDE/widgets/codecompletionpopup.h | 4 +- RedPandaIDE/widgets/cpudialog.cpp | 2 +- RedPandaIDE/widgets/ojproblemsetmodel.cpp | 12 +- RedPandaIDE/widgets/ojproblemsetmodel.h | 3 +- libs/qsynedit/qsynedit/SynEdit.cpp | 12 +- libs/qsynedit/qsynedit/syntaxer/asm.cpp | 2 +- libs/qsynedit/qsynedit/syntaxer/cpp.cpp | 2 +- libs/qsynedit/qsynedit/syntaxer/syntaxer.h | 4 +- 30 files changed, 1037 insertions(+), 715 deletions(-) create mode 100644 RedPandaIDE/problems/freeprojectsetformat.cpp create mode 100644 RedPandaIDE/problems/freeprojectsetformat.h diff --git a/NEWS.md b/NEWS.md index 6709b0f8..5b13d7c6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,7 +3,13 @@ Red Panda C++ Version 2.6 - enhancement: Highlighter for makefiles - fix: QSortFilterProxyModel not correctly cleared when exiting and project closed. (ASSERT fails in DEBUG mode.) - enhancement: Windows installers now use UNICODE encoding. - - fix: can't correctly show code suggestions after "template <" + - fix: Can't correctly show code suggestions after "template <" + - enhancement: Better code completion support for macros + - fix: Paste not enabled when create a new file and system clipboard is empty. + - enhancement: Auto rebuild when project's compiler set changed. + - enhancement: When current file is the project's makefile, show project's compiler set in the toolbar. + - enhancement: Prevent error of "del" to stop make when rebuild project. + - enhancement: Import FPS (free problem set) files. Red Panda C++ Version 2.5 diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 5aa68d81..8c438c7f 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -1,4 +1,4 @@ -QT += core gui printsupport network svg +QT += core gui printsupport network svg xml greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -97,6 +97,7 @@ SOURCES += \ parser/cpptokenizer.cpp \ parser/parserutils.cpp \ parser/statementmodel.cpp \ + problems/freeprojectsetformat.cpp \ problems/ojproblemset.cpp \ problems/problemcasevalidator.cpp \ project.cpp \ @@ -232,6 +233,7 @@ HEADERS += \ parser/cpptokenizer.h \ parser/parserutils.h \ parser/statementmodel.h \ + problems/freeprojectsetformat.h \ problems/ojproblemset.h \ problems/problemcasevalidator.h \ project.h \ diff --git a/RedPandaIDE/compiler/projectcompiler.cpp b/RedPandaIDE/compiler/projectcompiler.cpp index 153203ba..8fb0aed1 100644 --- a/RedPandaIDE/compiler/projectcompiler.cpp +++ b/RedPandaIDE/compiler/projectcompiler.cpp @@ -311,9 +311,9 @@ void ProjectCompiler::writeMakeClean(QFile &file) { writeln(file, "clean: clean-custom"); if (mProject->options().type == ProjectType::DynamicLib) - writeln(file, QString("\t${RM} $(CLEANOBJ) $(CLEAN_DEF) $(CLEAN_STATIC) > %1 2>&1").arg(NULL_FILE)); + writeln(file, QString("\t-${RM} $(CLEANOBJ) $(CLEAN_DEF) $(CLEAN_STATIC) > %1 2>&1").arg(NULL_FILE)); else - writeln(file, QString("\t${RM} $(CLEANOBJ) > %1 2>&1").arg(NULL_FILE)); + writeln(file, QString("\t-${RM} $(CLEANOBJ) > %1 2>&1").arg(NULL_FILE)); writeln(file); } diff --git a/RedPandaIDE/cpprefacter.cpp b/RedPandaIDE/cpprefacter.cpp index 4ea3aa0a..d2639b2c 100644 --- a/RedPandaIDE/cpprefacter.cpp +++ b/RedPandaIDE/cpprefacter.cpp @@ -207,7 +207,7 @@ PSearchResultTreeItem CppRefacter::findOccurenceInFile( QByteArray encoding; editor.document()->loadFromFile(filename,ENCODING_AUTO_DETECT,encoding); } - editor.setSyntaxer(syntaxerManager.getCppSyntaxer()); + editor.setSyntaxer(syntaxerManager.getSyntaxer(QSynedit::ProgrammingLanguage::CPP)); int posY = 0; while (posY < editor.document()->count()) { QString line = editor.document()->getString(posY); @@ -272,7 +272,7 @@ void CppRefacter::renameSymbolInFile(const QString &filename, const PStatement & editor.document()->loadFromFile(filename,ENCODING_AUTO_DETECT,encoding); } QStringList newContents; - editor.setSyntaxer(syntaxerManager.getCppSyntaxer()); + editor.setSyntaxer(syntaxerManager.getSyntaxer(QSynedit::ProgrammingLanguage::CPP)); int posY = 0; while (posY < editor.document()->count()) { QString line = editor.document()->getString(posY); diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index cfc274d2..3b239b36 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -111,7 +111,7 @@ Editor::Editor(QWidget *parent, const QString& filename, syntaxer = syntaxerManager.getSyntaxer(mFilename); } else { mFileEncoding = ENCODING_ASCII; - syntaxer=syntaxerManager.getCppSyntaxer(); + syntaxer=syntaxerManager.getSyntaxer(QSynedit::ProgrammingLanguage::CPP); } if (syntaxer) { @@ -390,7 +390,7 @@ bool Editor::saveAs(const QString &name, bool fromProject){ setUseCodeFolding(false); } setSyntaxer(newSyntaxer); - if (!newSyntaxer || newSyntaxer->language() != QSynedit::ProgrammingLanguage::Cpp) { + if (!newSyntaxer || newSyntaxer->language() != QSynedit::ProgrammingLanguage::CPP) { mSyntaxIssues.clear(); } applyColorScheme(pSettings->editor().colorScheme()); @@ -1037,7 +1037,7 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to if (CppTypeKeywords.contains(token) || ( - syntaxer()->language()==QSynedit::ProgrammingLanguage::Cpp + syntaxer()->language()==QSynedit::ProgrammingLanguage::CPP && ((QSynedit::CppSyntaxer*)syntaxer().get())->customTypeKeywords().contains(token) ) @@ -1938,38 +1938,32 @@ QStringList Editor::getExpressionAtPosition( const QSynedit::BufferCoord &pos) { QStringList result; - if (!syntaxer()) + if (!syntaxer() || !parser()) return result; int line = pos.line-1; int ch = pos.ch-1; int symbolMatchingLevel = 0; LastSymbolType lastSymbolType=LastSymbolType::None; - QSynedit::PSyntaxer syntaxer; - if (isNew()) - syntaxer = syntaxerManager.getCppSyntaxer(); - else - syntaxer = syntaxerManager.getSyntaxer(mFilename); - if (!syntaxer) - return result; + QSynedit::CppSyntaxer syntaxer; while (true) { if (line>=document()->count() || line<0) break; QStringList tokens; if (line==0) { - syntaxer->resetState(); + syntaxer.resetState(); } else { - syntaxer->setState(document()->ranges(line-1)); + syntaxer.setState(document()->ranges(line-1)); } QString sLine = document()->getString(line); - syntaxer->setLine(sLine,line-1); - while (!syntaxer->eol()) { - int start = syntaxer->getTokenPos(); - QString token = syntaxer->getToken(); + syntaxer.setLine(sLine,line-1); + while (!syntaxer.eol()) { + int start = syntaxer.getTokenPos(); + QString token = syntaxer.getToken(); int endPos = start + token.length()-1; if (start>ch) { break; } - QSynedit::PTokenAttribute attr = syntaxer->getTokenAttribute(); + QSynedit::PTokenAttribute attr = syntaxer.getTokenAttribute(); if ( (line == pos.line-1) && (start<=ch) && (ch<=endPos)) { if (attr->tokenType() == QSynedit::TokenType::Comment @@ -1981,7 +1975,7 @@ QStringList Editor::getExpressionAtPosition( && attr->tokenType() != QSynedit::TokenType::Space){ tokens.append(token); } - syntaxer->next(); + syntaxer.next(); } for (int i=tokens.count()-1;i>=0;i--) { QString token = tokens[i]; @@ -2657,7 +2651,7 @@ void Editor::initParser() { if (pSettings->codeCompletion().shareParser()) { if (pSettings->codeCompletion().enabled() - && (syntaxer() && syntaxer()->language() == QSynedit::ProgrammingLanguage::Cpp) + && (syntaxer() && syntaxer()->language() == QSynedit::ProgrammingLanguage::CPP) ) { mParser = sharedParser(mUseCppSyntax?ParserLanguage::CPlusPlus:ParserLanguage::C); } @@ -2677,7 +2671,7 @@ void Editor::initParser() resetCppParser(mParser); mParser->setEnabled( pSettings->codeCompletion().enabled() && - (syntaxer() && syntaxer()->language() == QSynedit::ProgrammingLanguage::Cpp)); + (syntaxer() && syntaxer()->language() == QSynedit::ProgrammingLanguage::CPP)); } Editor::QuoteStatus Editor::getQuoteStatus() @@ -2809,7 +2803,7 @@ void Editor::reparse(bool resetParser) return; if (!syntaxer()) return; - if (syntaxer()->language() != QSynedit::ProgrammingLanguage::Cpp + if (syntaxer()->language() != QSynedit::ProgrammingLanguage::CPP && syntaxer()->language() != QSynedit::ProgrammingLanguage::GLSL) return; if (!mParser) @@ -3117,7 +3111,7 @@ void Editor::showCompletion(const QString& preWord,bool autoComplete, CodeComple QSet keywords; if (syntaxer()) { - if (syntaxer()->language() != QSynedit::ProgrammingLanguage::Cpp ) { + if (syntaxer()->language() != QSynedit::ProgrammingLanguage::CPP ) { keywords = syntaxer()->keywords(); } else { if (mUseCppSyntax) { @@ -4569,7 +4563,7 @@ void Editor::checkSyntaxInBack() return; if (!syntaxer()) return; - if (syntaxer()->language()!=QSynedit::ProgrammingLanguage::Cpp) + if (syntaxer()->language()!=QSynedit::ProgrammingLanguage::CPP) return; pMainWindow->checkSyntaxInBack(this); } @@ -4779,14 +4773,14 @@ void Editor::applySettings() } if (pSettings->editor().enableCustomCTypeKeywords()) { - if (syntaxer() && syntaxer()->language() == QSynedit::ProgrammingLanguage::Cpp) { + if (syntaxer() && syntaxer()->language() == QSynedit::ProgrammingLanguage::CPP) { QSet set; foreach(const QString& s, pSettings->editor().customCTypeKeywords()) set.insert(s); ((QSynedit::CppSyntaxer*)(syntaxer().get()))->setCustomTypeKeywords(set); } } else { - if (syntaxer() && syntaxer()->language() == QSynedit::ProgrammingLanguage::Cpp) { + if (syntaxer() && syntaxer()->language() == QSynedit::ProgrammingLanguage::CPP) { ((QSynedit::CppSyntaxer*)(syntaxer().get()))->setCustomTypeKeywords(QSet()); } } diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 35796ab1..6c492dee 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -35,6 +35,7 @@ #include "widgets/darkfusionstyle.h" #include "widgets/lightfusionstyle.h" #include "problems/problemcasevalidator.h" +#include "problems/freeprojectsetformat.h" #include "widgets/ojproblempropertywidget.h" #include "iconsmanager.h" #include "widgets/newclassdialog.h" @@ -578,8 +579,7 @@ void MainWindow::updateEditorActions(const Editor *e) ui->actionCut->setEnabled(true); ui->actionFoldAll->setEnabled(e->document()->count()>0); ui->actionIndent->setEnabled(!e->readOnly()); - - ui->actionPaste->setEnabled(!e->readOnly() && !QGuiApplication::clipboard()->text().isEmpty()); + ui->actionPaste->setEnabled(!e->readOnly()); ui->actionRedo->setEnabled(e->canRedo()); ui->actionUndo->setEnabled(e->canUndo()); ui->actionSave->setEnabled(!e->readOnly()); @@ -1545,7 +1545,12 @@ void MainWindow::updateCompilerSet() Editor *e = mEditorList->getEditor(); if ( !e || e->inProject()) { index = mProject->options().compilerSet; + } else if (e->syntaxer() + && e->syntaxer()->language()==QSynedit::ProgrammingLanguage::Makefile + && mProject->directory() == extractFileDir(e->filename())) { + index = mProject->options().compilerSet; } + if (index < 0 || index>=mCompilerSet->count()) { index = pSettings->compilerSets().defaultIndex(); } @@ -1710,6 +1715,7 @@ void MainWindow::updateActionIcons() pIconsManager->setIcon(ui->btnRemoveProblem, IconsManager::ACTION_MISC_CROSS); pIconsManager->setIcon(ui->btnSaveProblemSet, IconsManager::ACTION_FILE_SAVE_AS); pIconsManager->setIcon(ui->btnLoadProblemSet, IconsManager::ACTION_FILE_OPEN_FOLDER); + pIconsManager->setIcon(ui->btnImportFPS, IconsManager::ACTION_CODE_BACK); pIconsManager->setIcon(ui->btnAddProblemCase, IconsManager::ACTION_MISC_ADD); pIconsManager->setIcon(ui->btnRemoveProblemCase, IconsManager::ACTION_MISC_REMOVE); @@ -5137,6 +5143,7 @@ void MainWindow::onCompilerSetChanged(int index) QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) { mCompilerSet->setCurrentIndex(mProject->options().compilerSet); + //ui->actionRebuild->trigger(); return; } mProject->setCompilerSet(index); @@ -6288,10 +6295,13 @@ void MainWindow::on_actionProject_options_triggered() { if (!mProject) return; +// int oldCompilerSet = mProject->options().compilerSet; QString oldName = mProject->name(); PSettingsDialog dialog = SettingsDialog::projectOptionDialog(); dialog->exec(); updateCompilerSet(); +// if (oldCompilerSet != mProject->options().compilerSet) +// ui->actionRebuild->trigger(); } @@ -8898,3 +8908,24 @@ void MainWindow::on_actionGenerate_Assembly_triggered() doGenerateAssembly(); } + +void MainWindow::on_btnImportFPS_clicked() +{ + QString fileName = QFileDialog::getOpenFileName( + this, + tr("Import FPS Problem Set"), + QString(), + tr("FPS Problem Set Files (*.fps)")); + if (!fileName.isEmpty()) { + try { + QList problems = importFreeProblemSet(fileName); + mOJProblemSetModel.addProblems(problems); + } catch (FileError& error) { + QMessageBox::critical(this,tr("Load Error"), + error.reason()); + } + } + ui->lblProblemSet->setText(mOJProblemSetModel.name()); + ui->lstProblemSet->setCurrentIndex(mOJProblemSetModel.index(0,0)); +} + diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index 10384df1..6127b231 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -748,6 +748,8 @@ private slots: void on_actionGenerate_Assembly_triggered(); + void on_btnImportFPS_clicked(); + private: Ui::MainWindow *ui; EditorList *mEditorList; diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index 3675f8fb..42cf3c04 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -838,6 +838,17 @@ + + + + Import FPS Problem Set + + + + :/icons/images/newlook24/058-prev.png:/icons/images/newlook24/058-prev.png + + + diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index 1729f4ef..502e08fe 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -416,7 +416,7 @@ PStatement CppParser::findStatementOf(const QString &fileName, PEvalStatement CppParser::evalExpression( const QString &fileName, - const QStringList &phraseExpression, + QStringList &phraseExpression, const PStatement ¤tScope) { QMutexLocker locker(&mMutex); @@ -3925,6 +3925,24 @@ QList CppParser::getListOfFunctions(const QString &fileName, int lin return result; } +PStatement CppParser::findMacro(const QString &phrase, const QString &fileName) +{ + const StatementMap& statementMap =mStatementList.childrenStatements(nullptr); + if (statementMap.isEmpty()) + return PStatement(); + StatementList statements = statementMap.values(phrase); + PFileIncludes includes = mPreprocessor.includesList().value(fileName,PFileIncludes()); + foreach (const PStatement& s, statements) { + if (s->kind == StatementKind::skPreprocessor) { + if (includes && !includes->includeFiles.contains(s->fileName) + && !includes->includeFiles.contains(s->definitionFileName)) + continue; + return s; + } + } + return PStatement(); +} + PStatement CppParser::findMemberOfStatement(const QString &phrase, const PStatement& scopeStatement) { @@ -4017,7 +4035,7 @@ PStatement CppParser::findStatementInNamespace(const QString &name, const QStrin } PEvalStatement CppParser::doEvalExpression(const QString& fileName, - const QStringList& phraseExpression, + QStringList& phraseExpression, int &pos, const PStatement& scope, const PEvalStatement& previousResult, @@ -4032,7 +4050,7 @@ PEvalStatement CppParser::doEvalExpression(const QString& fileName, freeScoped); } -PEvalStatement CppParser::doEvalPointerArithmetic(const QString &fileName, const QStringList &phraseExpression, int &pos, const PStatement &scope, const PEvalStatement &previousResult, bool freeScoped) +PEvalStatement CppParser::doEvalPointerArithmetic(const QString &fileName, QStringList &phraseExpression, int &pos, const PStatement &scope, const PEvalStatement &previousResult, bool freeScoped) { if (pos>=phraseExpression.length()) return PEvalStatement(); @@ -4083,7 +4101,7 @@ PEvalStatement CppParser::doEvalPointerArithmetic(const QString &fileName, const PEvalStatement CppParser::doEvalPointerToMembers( const QString &fileName, - const QStringList &phraseExpression, + QStringList &phraseExpression, int &pos, const PStatement &scope, const PEvalStatement &previousResult, @@ -4126,7 +4144,7 @@ PEvalStatement CppParser::doEvalPointerToMembers( } PEvalStatement CppParser::doEvalCCast(const QString &fileName, - const QStringList &phraseExpression, + QStringList &phraseExpression, int &pos, const PStatement& scope, const PEvalStatement& previousResult, @@ -4258,7 +4276,7 @@ PEvalStatement CppParser::doEvalCCast(const QString &fileName, } PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName, - const QStringList &phraseExpression, + QStringList &phraseExpression, int &pos, const PStatement& scope, const PEvalStatement& previousResult, @@ -4390,7 +4408,7 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName, } PEvalStatement CppParser::doEvalScopeResolution(const QString &fileName, - const QStringList &phraseExpression, + QStringList &phraseExpression, int &pos, const PStatement& scope, const PEvalStatement& previousResult, @@ -4445,7 +4463,7 @@ PEvalStatement CppParser::doEvalScopeResolution(const QString &fileName, } PEvalStatement CppParser::doEvalTerm(const QString &fileName, - const QStringList &phraseExpression, + QStringList &phraseExpression, int &pos, const PStatement& scope, const PEvalStatement& previousResult, @@ -4459,6 +4477,7 @@ PEvalStatement CppParser::doEvalTerm(const QString &fileName, PEvalStatement result; if (pos>=phraseExpression.length()) return result; +// qDebug()<<"eval term"<effectiveTypeStatement); } +// if (!statement) { +// statement = findMacro( +// phraseExpression[pos], +// fileName); +// } } pos++; if (statement && statement->kind == StatementKind::skConstructor) { @@ -4535,6 +4559,15 @@ PEvalStatement CppParser::doEvalTerm(const QString &fileName, case StatementKind::skFunction: result = doCreateEvalFunction(fileName,statement); break; + case StatementKind::skPreprocessor: + //qDebug()<<"before"<args.isEmpty()) { + s=macro->value; + phraseExpression.removeAt(pos); + } else { + QString args=macro->args.mid(1,macro->args.length()-2).trimmed(); // remove '(' ')' + + if(args=="") + return false; + QStringList argList = args.split(','); + QList argUsed; + for (int i=0;i tokens = mPreprocessor.tokenizeValue(macro->value); + + QString formatStr = ""; + DefineArgTokenType lastTokenType=DefineArgTokenType::Other; + int index; + foreach (const PDefineArgToken& token, tokens) { + switch(token->type) { + case DefineArgTokenType::Identifier: + index = argList.indexOf(token->value); + if (index>=0) { + argUsed[index] = true; + if (lastTokenType == DefineArgTokenType::Sharp) { + formatStr+= "\"%"+QString("%1").arg(index+1)+"\""; + break; + } else { + formatStr+= "%"+QString("%1").arg(index+1); + break; + } + } + formatStr += token->value; + break; + case DefineArgTokenType::DSharp: + case DefineArgTokenType::Sharp: + break; + case DefineArgTokenType::Space: + case DefineArgTokenType::Symbol: + formatStr+=token->value; + break; + default: + break; + } + lastTokenType = token->type; + } + QStringList values; + int i; + int level=1; + QString current; + for (i=pos+2;itokenType()) { + case QSynedit::TokenType::Space: + case QSynedit::TokenType::Comment: + break; + default: + phraseExpression.insert(pos+i,token); + i++; + } + syntaxer.next(); + } + return true; +} + PEvalStatement CppParser::doCreateEvalNamespace(const PStatement &namespaceStatement) { if (!namespaceStatement) diff --git a/RedPandaIDE/parser/cppparser.h b/RedPandaIDE/parser/cppparser.h index 49aa277b..63c7d49a 100644 --- a/RedPandaIDE/parser/cppparser.h +++ b/RedPandaIDE/parser/cppparser.h @@ -83,7 +83,7 @@ public: * @return the statement of the evaluation result */ PEvalStatement evalExpression(const QString& fileName, - const QStringList& expression, + QStringList& expression, const PStatement& currentScope); PStatement findTypeDefinitionOf(const QString& fileName, const QString& aType, @@ -239,6 +239,7 @@ private: QList getListOfFunctions(const QString& fileName, int line, const PStatement& statement, const PStatement& scopeStatement); + PStatement findMacro(const QString& phrase, const QString& fileName); PStatement findMemberOfStatement( const QString& phrase, const PStatement& scopeStatement); @@ -272,7 +273,7 @@ private: * @return */ PEvalStatement doEvalExpression(const QString& fileName, - const QStringList& phraseExpression, + QStringList& phraseExpression, int &pos, const PStatement& scope, const PEvalStatement& previousResult, @@ -280,47 +281,50 @@ private: PEvalStatement doEvalPointerArithmetic( const QString& fileName, - const QStringList& phraseExpression, + QStringList& phraseExpression, int &pos, const PStatement& scope, const PEvalStatement& previousResult, bool freeScoped); PEvalStatement doEvalPointerToMembers( const QString& fileName, - const QStringList& phraseExpression, + QStringList& phraseExpression, int &pos, const PStatement& scope, const PEvalStatement& previousResult, bool freeScoped); PEvalStatement doEvalCCast( const QString& fileName, - const QStringList& phraseExpression, + QStringList& phraseExpression, int &pos, const PStatement& scope, const PEvalStatement& previousResult, bool freeScoped); PEvalStatement doEvalMemberAccess( const QString& fileName, - const QStringList& phraseExpression, + QStringList& phraseExpression, int &pos, const PStatement& scope, const PEvalStatement& previousResult, bool freeScoped); PEvalStatement doEvalScopeResolution( const QString& fileName, - const QStringList& phraseExpression, + QStringList& phraseExpression, int &pos, const PStatement& scope, const PEvalStatement& previousResult, bool freeScoped); PEvalStatement doEvalTerm( const QString& fileName, - const QStringList& phraseExpression, + QStringList& phraseExpression, int &pos, const PStatement& scope, const PEvalStatement& previousResult, bool freeScoped); + bool expandMacro(QStringList& phraseExpression,int &pos, + const PStatement& macro); + PEvalStatement doCreateEvalNamespace(const PStatement& namespaceStatement); PEvalStatement doCreateEvalType(const QString& fileName,const PStatement& typeStatement); diff --git a/RedPandaIDE/parser/cpppreprocessor.cpp b/RedPandaIDE/parser/cpppreprocessor.cpp index d97f3806..7457d482 100644 --- a/RedPandaIDE/parser/cpppreprocessor.cpp +++ b/RedPandaIDE/parser/cpppreprocessor.cpp @@ -579,7 +579,6 @@ void CppPreprocessor::expandMacro(const QString &line, QString &newLine, QString } else { PDefine define = getDefine(word); if (define && define->args=="" ) { - //newLine:=newLine+RemoveGCCAttributes(define^.Value); if (define->value != word ) newLine += expandMacros(define->value,depth+1); else diff --git a/RedPandaIDE/parser/cpppreprocessor.h b/RedPandaIDE/parser/cpppreprocessor.h index 1a5b1c65..c6c18062 100644 --- a/RedPandaIDE/parser/cpppreprocessor.h +++ b/RedPandaIDE/parser/cpppreprocessor.h @@ -94,6 +94,8 @@ public: const QList &projectIncludePathList() const; void setOnGetFileStream(const GetFileStreamCallBack &newOnGetFileStream); + static QList tokenizeValue(const QString& value); + private: void preprocessBuffer(); void skipToEndOfPreprocessor(); @@ -128,44 +130,43 @@ private: void invalidDefinesInFile(const QString& fileName); void parseArgs(PDefine define); - QList tokenizeValue(const QString& value); QStringList removeComments(const QStringList& text); /* * '_','a'..'z','A'..'Z','0'..'9' */ - bool isWordChar(const QChar& ch); +static bool isWordChar(const QChar& ch); /* * 'A'..'Z', '0'..'9', 'a'..'z', '_', '*', '&', '~' */ - bool isIdentChar(const QChar& ch); +static bool isIdentChar(const QChar& ch); /* * '\r','\n' */ - bool isLineChar(const QChar& ch); +static bool isLineChar(const QChar& ch); /* * '\t' ' ' */ - bool isSpaceChar(const QChar& ch); +static bool isSpaceChar(const QChar& ch); /* * '+', '-', '*', '/', '!', '=', '<', '>', '&', '|', '^' */ - bool isOperatorChar(const QChar& ch); +static bool isOperatorChar(const QChar& ch); /* * 'A'..'Z', 'a'..'z', '_' */ - bool isMacroIdentChar(const QChar& ch); +static bool isMacroIdentChar(const QChar& ch); /* * '0'..'9' */ - bool isDigit(const QChar& ch); +static bool isDigit(const QChar& ch); /* * '0'..'9','x',X','a'..'f','A'..'F','u','U','l','L' */ - bool isNumberChar(const QChar& ch); +static bool isNumberChar(const QChar& ch); QString lineBreak(); diff --git a/RedPandaIDE/problems/freeprojectsetformat.cpp b/RedPandaIDE/problems/freeprojectsetformat.cpp new file mode 100644 index 00000000..a3eb94b6 --- /dev/null +++ b/RedPandaIDE/problems/freeprojectsetformat.cpp @@ -0,0 +1,91 @@ +#include "freeprojectsetformat.h" + +#include +#include +# + +QList importFreeProblemSet(const QString &filename) +{ + QFile file(filename); + QList problems; + if (!file.open(QFile::ReadOnly)) + return problems; + QXmlStreamReader xml; + xml.setDevice(&file); + POJProblem currentProblem; + POJProblemCase currentCase; + QString currentText; + QString currentEleName; + while(!xml.atEnd()) { + xml.readNext(); + switch (xml.tokenType()) { + case QXmlStreamReader::TokenType::StartElement: + currentEleName = xml.name().toString(); + if (xml.name()=="item") { + currentProblem=std::make_shared(); + } else if (currentProblem && + ( xml.name()=="sample_input" + || xml.name()=="test_input")) { + currentCase = std::make_shared(); + foreach (const QXmlStreamAttribute& attr, xml.attributes()) { + if (attr.name() == "name") { + currentCase->name = attr.value().toString(); + break; + } + } + currentCase->name = QObject::tr("Problem Case %1").arg(currentProblem->cases.count()+1); + } else if (currentProblem && + xml.name()=="time_limit") { + foreach (const QXmlStreamAttribute& attr, xml.attributes()) { + if (attr.name() == "unit" && attr.value()=="ms") { + currentEleName = xml.name().toString(); + break; + } + } + } else if (currentProblem && + xml.name()=="memory_limit") { + foreach (const QXmlStreamAttribute& attr, xml.attributes()) { + if (attr.name() == "unit" && attr.value()=="mb") { + currentEleName = xml.name().toString(); + break; + } + } + } + break; + case QXmlStreamReader::TokenType::EndElement: + currentEleName.clear(); + if (currentProblem && xml.name()=="item") { + problems.append(currentProblem); + currentProblem.reset(); + } + break; + case QXmlStreamReader::TokenType::Characters: + if (currentCase && + ( + currentEleName=="test_input" || + currentEleName=="sample_input")) { + currentCase->input = xml.text().toString(); + } else if (currentCase && currentProblem && + ( + currentEleName=="test_output" || + currentEleName=="sample_output")) { + currentCase->expected = xml.text().toString(); + currentProblem->cases.append(currentCase); + currentCase.reset(); + } else if (currentProblem && currentEleName=="description") { + currentProblem->description = xml.text().toString(); + } else if (currentProblem && currentEleName=="hint") { + currentProblem->hint = xml.text().toString(); + } else if (currentProblem && currentEleName=="title") { + currentProblem->name = xml.text().toString(); + } else if (currentProblem && currentEleName=="time_limit") { + currentProblem->timeLimit = xml.text().toInt(); + } else if (currentProblem && currentEleName=="memory_limit") { + currentProblem->memoryLimit = xml.text().toInt(); + } + default: + break; + } + } + return problems; +} diff --git a/RedPandaIDE/problems/freeprojectsetformat.h b/RedPandaIDE/problems/freeprojectsetformat.h new file mode 100644 index 00000000..8b635000 --- /dev/null +++ b/RedPandaIDE/problems/freeprojectsetformat.h @@ -0,0 +1,9 @@ +#ifndef FREEPROJECTSETFORMAT_H +#define FREEPROJECTSETFORMAT_H + +#include "ojproblemset.h" + +QList importFreeProblemSet(const QString& filename); +//void exportFreeProblemSet(const QList& problems); + +#endif // FREEPROJECTSETFORMAT_H diff --git a/RedPandaIDE/problems/ojproblemset.h b/RedPandaIDE/problems/ojproblemset.h index 9bece8ee..deefb709 100644 --- a/RedPandaIDE/problems/ojproblemset.h +++ b/RedPandaIDE/problems/ojproblemset.h @@ -54,7 +54,10 @@ struct OJProblem { QString name; QString url; QString description; + QString hint; QString answerProgram; + int timeLimit; // ms + int memoryLimit; // mb QVector cases; }; diff --git a/RedPandaIDE/syntaxermanager.cpp b/RedPandaIDE/syntaxermanager.cpp index 842b1bc0..c159c9dc 100644 --- a/RedPandaIDE/syntaxermanager.cpp +++ b/RedPandaIDE/syntaxermanager.cpp @@ -36,14 +36,14 @@ SyntaxerManager::SyntaxerManager() QSynedit::PSyntaxer SyntaxerManager::getSyntaxer(QSynedit::ProgrammingLanguage language) { switch(language) { - case QSynedit::ProgrammingLanguage::Cpp: - return getCppSyntaxer(); - case QSynedit::ProgrammingLanguage::Asssembly: - return getAsmSyntaxer(); + case QSynedit::ProgrammingLanguage::CPP: + return std::make_shared(); + case QSynedit::ProgrammingLanguage::Assembly: + return std::make_shared(); case QSynedit::ProgrammingLanguage::Makefile: - return getMakefileSyntaxer(); + return std::make_shared(); case QSynedit::ProgrammingLanguage::GLSL: - return getGLSLSyntaxer(); + return std::make_shared(); default: return QSynedit::PSyntaxer(); } @@ -59,15 +59,15 @@ QSynedit::PSyntaxer SyntaxerManager::getSyntaxer(const QString &filename) || suffix == "hxx" || suffix == "hh" || suffix == "C" || suffix == "CPP" || suffix =="H" || suffix == "c++" || suffix == "h++") { - return getCppSyntaxer(); + return getSyntaxer(QSynedit::ProgrammingLanguage::CPP); } else if (suffix == "vs" || suffix == "fs" || suffix == "frag") { - return getGLSLSyntaxer(); + return getSyntaxer(QSynedit::ProgrammingLanguage::GLSL); } else if (suffix == "s" || suffix == "asm") { - return getAsmSyntaxer(); + return getSyntaxer(QSynedit::ProgrammingLanguage::Assembly); } else if (basename.compare("makefile", Qt::CaseInsensitive)==0) { - return getMakefileSyntaxer(); + return getSyntaxer(QSynedit::ProgrammingLanguage::Makefile); } else if (suffix.isEmpty()) { - return getCppSyntaxer(); + return getSyntaxer(QSynedit::ProgrammingLanguage::CPP); } return QSynedit::PSyntaxer(); } @@ -79,26 +79,6 @@ QSynedit::PSyntaxer SyntaxerManager::copy(QSynedit::PSyntaxer syntaxer) return getSyntaxer(syntaxer->language()); } -QSynedit::PSyntaxer SyntaxerManager::getCppSyntaxer() -{ - return std::make_shared(); -} - -QSynedit::PSyntaxer SyntaxerManager::getAsmSyntaxer() -{ - return std::make_shared(); -} - -QSynedit::PSyntaxer SyntaxerManager::getGLSLSyntaxer() -{ - return std::make_shared(); -} - -QSynedit::PSyntaxer SyntaxerManager::getMakefileSyntaxer() -{ - return std::make_shared(); -} - void SyntaxerManager::applyColorScheme(QSynedit::PSyntaxer syntaxer, const QString &schemeName) { if (!syntaxer) diff --git a/RedPandaIDE/syntaxermanager.h b/RedPandaIDE/syntaxermanager.h index 8284e15d..f79de7bb 100644 --- a/RedPandaIDE/syntaxermanager.h +++ b/RedPandaIDE/syntaxermanager.h @@ -26,10 +26,6 @@ public: QSynedit::PSyntaxer getSyntaxer(QSynedit::ProgrammingLanguage language); QSynedit::PSyntaxer getSyntaxer(const QString& filename); QSynedit::PSyntaxer copy(QSynedit::PSyntaxer syntaxer); - QSynedit::PSyntaxer getCppSyntaxer(); - QSynedit::PSyntaxer getAsmSyntaxer(); - QSynedit::PSyntaxer getGLSLSyntaxer(); - QSynedit::PSyntaxer getMakefileSyntaxer(); void applyColorScheme(QSynedit::PSyntaxer syntaxer, const QString& schemeName); }; diff --git a/RedPandaIDE/todoparser.cpp b/RedPandaIDE/todoparser.cpp index 93b6c929..0a00500a 100644 --- a/RedPandaIDE/todoparser.cpp +++ b/RedPandaIDE/todoparser.cpp @@ -106,7 +106,7 @@ TodoThread::TodoThread(const QStringList &files, QObject *parent): QThread(paren void TodoThread::parseFile() { - QSynedit::PSyntaxer syntaxer = syntaxerManager.getCppSyntaxer(); + QSynedit::PSyntaxer syntaxer = syntaxerManager.getSyntaxer(QSynedit::ProgrammingLanguage::CPP); emit parseStarted(); doParseFile(mFilename,syntaxer); emit parseFinished(); @@ -114,7 +114,7 @@ void TodoThread::parseFile() void TodoThread::parseFiles() { - QSynedit::PSyntaxer highlighter = syntaxerManager.getCppSyntaxer(); + QSynedit::PSyntaxer highlighter = syntaxerManager.getSyntaxer(QSynedit::ProgrammingLanguage::CPP); emit parseStarted(); foreach(const QString& filename,mFiles) { doParseFile(filename,highlighter); diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts index a5cc75aa..d242e743 100644 --- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts +++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts @@ -4732,6 +4732,14 @@ Generate Assembly + + Import FPS Problem Set + + + + FPS Problem Set Files (*.fps) + + NewClassDialog @@ -6167,6 +6175,10 @@ Reserve Word for Types + + Problem Case %1 + Caso do problema %1 + RegisterModel diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index d434f0ae..3a887d4c 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -193,17 +193,17 @@ p, li { white-space: pre-wrap; } BacktraceModel - + Function 函数 - + Filename 文件名 - + Line @@ -249,17 +249,17 @@ p, li { white-space: pre-wrap; } BreakpointModel - + Filename 文件名 - + Line - + Condition 条件 @@ -1322,7 +1322,7 @@ Are you really want to continue? 失败 - + @@ -1337,7 +1337,7 @@ Are you really want to continue? 无法写入文件"%1" - + Save As 另存为 @@ -1367,14 +1367,14 @@ Are you really want to continue? 要剪切的内容超过了字符数限制! - + Print Document 打印文档 - - - + + + Ctrl+click for more info Ctrl+单击以获取更多信息 @@ -1383,27 +1383,27 @@ Are you really want to continue? 未找到符号'%1'! - + astyle not found 找不到astyle程序 - + Can't find astyle in "%1". 找不到astyle程序"%1". - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Readonly 只读 @@ -3918,18 +3918,18 @@ Are you really want to continue? MainWindow - + Red Panda C++ 小熊猫C++ - - - - - - - + + + + + + + Issues 编译器 @@ -3948,8 +3948,8 @@ Are you really want to continue? 工具 - - + + Run 运行 @@ -3961,25 +3961,25 @@ Are you really want to continue? - + Project 项目 - + Watch 监视 - + Structure 结构 - + Files 文件 @@ -3989,68 +3989,68 @@ Are you really want to continue? - - - - + + + + Debug 调试 - + Evaluate: 求值 - - + + Debug Console 调试主控台 - + Call Stack 调用栈 - + Breakpoints 断点 - + Locals 局部变量 - - + + Search 查找 - + History: 历史: - + Search Again 重新查找 - + Replace with: 替换为: - + Replace 替换 - + Close 关闭 @@ -4079,83 +4079,83 @@ Are you really want to continue? 工具栏2 - + New 新建 - + Ctrl+N Ctrl+N - + Open... 打开... - + Ctrl+O Ctrl+O - + Save 保存 - + Ctrl+S Ctrl+S - + Save As... 另存为... - + Save As 另存为 - + Save All 全部保存 - + Ctrl+Shift+S Ctrl+Shift+S - + Options 选项 - - - - + + + + Compile 编译 - - + + Tools Output 工具输出 - - + + Choose Input File 选择输入文件 - + ... ... @@ -4175,199 +4175,199 @@ Are you really want to continue? 选择 - + F9 F9 - + F10 F10 - + Undo 恢复 - + Ctrl+Z Ctrl+Z - + Redo 重做 - + Ctrl+Y Ctrl+Y - + Cut 剪切 - + Ctrl+X Ctrl+X - - - - + + + + Copy 复制 - + Ctrl+C Ctrl+C - - + + Paste 粘贴 - + Ctrl+V Ctrl+V - - - + + + Select All 选择全部 - + Ctrl+A Ctrl+A - + Indent 缩进 - + UnIndent 取消缩进 - + Toggle Comment 切换注释 - + Ctrl+/ Ctrl+/ - + Collapse All 全部收起 - + Uncollapse All 全部展开 - + Encode in ANSI 使用ANSI编码 - + Encode in UTF-8 使用UTF-8编码 - + Auto Detect 自动检测 - + Convert to ANSI 转换为ANSI编码 - + Convert to UTF-8 转换为UTF-8编码 - - + + Compile & Run 编译运行 - + F11 F11 - - + + Rebuild All 全部重编译 - + F12 F12 - + Stop Execution 停止执行 - + F6 F6 - + F5 F5 - + Step Over 单步跳过 - + F7 F7 - + Step Into 单步进入 - + Problem Set 试题集 - + New Problem Set 新建试题集 @@ -4386,101 +4386,101 @@ Are you really want to continue? - + Save Problem Set 保存试题集 - + Load Problem Set 载入试题集 - + Memory 内存 - + Address Expression: Address: 地址表达式: - + Cancel 取消 - - + + TODO TODO - - + + Bookmark 书签 - - - + + + Problem 试题 - - + + Add Probem Case 添加试题案例 - - + + Remove Problem Case Remove Problem Set 删除试题集 - - + + Open Anwser Source File 打开答案源代码文件 - - - + + + Run All Cases Run Current Case 运行所有案例 - + Problem Cases Validation Options 测试案例验证选项 - + %v/%m %v/%m - + Output 输出 - + Input 输入 - + Expected 期望输出 @@ -4519,425 +4519,431 @@ Are you really want to continue? 管理器 - + + + Import FPS Problem Set + 导入FPS试题集 + + + Messages 消息 - + Ignore Spaces 忽略空格 - + New Source File 新建源代码文件 - + Tab Tab - + Shift+Tab Shift+Tab - + F8 F8 - + Step Out 单步跳出 - + Ctrl+F8 Ctrl+F8 - + Run To Cursor 执行到光标处 - + Ctrl+F5 Ctrl+F5 - + Continue 继续执行 - + F4 F4 - + Add Watch... 添加监视 - + View CPU Window... 打开CPU信息窗口... - + Exit 退出 - + Find... 查找... - + Ctrl+F Ctrl+F - + Find in Files... 在文件中查找... - + Ctrl+Shift+F Ctrl+Shift+F - + Replace... 替换 - + Ctrl+R Ctrl+R - + Find Next 查找下一个 - + F3 F3 - + Find Previous 查找前一个 - + Shift+F3 Shift+F3 - + Remove Watch 删除监视值 - + Remove All Watches Remove All 删除全部监视值 - + Modify Watch... 修改监视值 - + Reformat Code 对代码重新排版 - + Ctrl+Shift+A Ctrl+Shift+A - + Go back 前一次编辑位置 - + Ctrl+Alt+Left Ctrl+Alt+Left - + Forward 后一次编辑位置 - + Ctrl+Alt+Right Ctrl+Alt+Right - + Ctrl+W Ctrl+W - + Close All 全部关闭 - + Ctrl+Shift+W Ctrl+Shift+W - + Maximize Editor 最大化编辑器 - + Ctrl+F11 Ctrl+F11 - + Next 下一窗口 - + Ctrl+Tab Ctrl+Tab - + Previous 前一窗口 - + Ctrl+Shift+Tab Ctrl+Shift+Tab - + Toggle breakpoint 切换断点 - + Ctrl+F4 Ctrl+F4 - - + + Clear all breakpoints 删除所有断点 - + Breakpoint property... 设置断点条件... - + Goto Declaration 跳转到声明处 - + Ctrl+Shift+G Ctrl+Shift+G - + Goto Definition 跳转到定义处 - + Ctrl+G Ctrl+G - + Find references 查找符号的引用 - + Open containing folder 打开所在的文件夹 - + Ctrl+B Ctrl+B - + Open a terminal here 打开命令行窗口 - + File Properties... 文件属性... - + Close Project 关闭项目 - + Project options 项目属性 - + New Project... 新建项目... - - + + New Project File 新建项目文件 - + F1 F1 - + Move Selection Up 向上移动选中的行 - + Ctrl+Shift+Up Ctrl+Shift+Up - + Move Selection Down 向下移动选中的行 - + Ctrl+Shift+Down Ctrl+Shift+Down - + Convert to UTF-8 BOM 转换为UTF-8 BOM编码 - + Encode in UTF-8 BOM 使用UTF-8 BOM编码 - + Compiler Options... 编译器选项... - + Toggle Explorer Panel 切换管理器面板 - + Ctrl+F9 Ctrl+F9 - + Toggle Messages Panel 切换消息面板 - + Ctrl+F10 Ctrl+F10 - + Raylib Manual Raylib教程 - + Select Word 选中当前单词 - + Go to Line... 跳转到行... - + New Template... 新建模板... - + New Template from Project 从项目创建模板 - + Goto block start 跳转到代码段开始 - + Ctrl+Alt+Up Ctrl+Alt+Up - + Goto block end 跳转到代码段结束 - + Ctrl+Alt+Down Ctrl+Alt+Down - + Switch header/source 切换头文件/源文件 - + Switch Header/Source 切换头文件/源文件 - + Generate Assembly 生成汇编 @@ -4946,200 +4952,200 @@ Are you really want to continue? 保存为模板... - - + + New File 新建文件 - + Add to project... 添加到项目... - + Remove from project 从项目删除 - + View Makefile 查看Makefile - + Clean 清理构建文件 - + Open Folder in Explorer 在浏览器中打开 - + Open In Terminal 在终端中打开 - + About 关于 - - + + Rename Symbol 重命名符号 - + Shift+F6 Shift+F6 - + Print... 打印... - + Ctrl+P Ctrl+P - - + + Export As RTF 导出为RTF - - + + Export As HTML 导出为HTML - + Move To Other View 移动到其他视图 - + Ctrl+M Ctrl+M - - + + C++ Reference C++参考手册 - + C Reference C参考手册 - + Show Tool Panels 显示全部工具面板 - + Create Git Repository Create Repository 创建Git仓库 - + Commit 提交(Commit) - + Revert 撤销(Revert) - + Reset 回滚(Reset) - + Add Files 添加文件 - + Restore 还原(Restore) - + Website 官方网站 - + Branch/Switch 分支切换(Switch) - + Merge 合并(Merge) - - + + Show Log Log 显示日志(Log) - + Remotes... 远程仓库... - + Fetch 取回(Fetch) - + Pull 拉取(Pull) - + Push 推送(Push) - + Hide Non Support Files 隐藏不支持的文件 - + Toggle Block Comment 切换块注释 - + Alt+Shift+A Alt+Shift+A - + Match Bracket 匹配当前括号 - + Ctrl+] Ctrl+] @@ -5148,50 +5154,50 @@ Are you really want to continue? 工具窗口栏 - + Status Bar 状态栏 - + Ctrl+Backspace Ctrl+Backspace - + Interrupt 中断 - - + + Delete To Word Begin 删除到单词开头 - + Ctrl+Shift+B Ctrl+Shift+B - + Delete to Word End 删除到单词结尾 - + Ctrl+Shift+E Ctrl+Shift+E - + New Class... Add Class... 新建类... - - + + New Header... New Header 新建头文件... @@ -5201,47 +5207,47 @@ Are you really want to continue? 插入行 - + Delete Line 删除当前行 - + Ctrl+D Ctrl+D - + Duplicate Line 复制当前行 - + Ctrl+E Ctrl+E - + Delete Word 删除当前单词 - + Ctrl+Shift+D Ctrl+Shift+D - + Delete to EOL 删除到行尾 - + Ctrl+Del Ctrl+Del - + Delete to BOL 删除到行首 @@ -5250,27 +5256,27 @@ Are you really want to continue? C/C++参考 - + EGE Manual EGE图形库手册 - + Add Bookmark 添加书签 - + Remove Bookmark 删除书签 - + Modify Bookmark Description 修改书签说明 - + Locate in Files View 在文件视图中定位 @@ -5279,47 +5285,47 @@ Are you really want to continue? 打开文件夹 - + Running Parameters... 运行参数... - + File Encoding 文件编码 - + Recent Files 文件历史 - - - - - - + + + + + + Debugging 正在调试 - - - - - - + + + + + + Running 正在运行 - - - - - - + + + + + + Compiling 正在编译 @@ -5328,23 +5334,23 @@ Are you really want to continue? 行:%1 列:%2 已选择:%3 总行数:%4 总长度:%5 - + Line:%1 Col:%2 Selected:%3 Lines:%4 Length:%5 Line: %1 Col: %2 Selected: %3 Lines: %4 Length: %5 行: %1 列: %2 已选择 :%3 总行数: %4 总长度: %5 - + Read Only 只读 - + Insert 插入 - + Overwrite 覆写 @@ -5357,133 +5363,133 @@ Are you really want to continue? 你确定要关闭'%1'吗? - - + + Confirm 确认 - - - + + + Source file is not compiled. 源文件尚未编译。 - - + + Compile now? 现在编译? - - + + Source file is more recent than executable. 源文件比可执行程序新。 - + Recompile now? 重新编译? - - - - + + + + Wrong Compiler Settings 错误的编译器设置 - - - - + + + + Compiler is set not to generate executable. 编译器被设置为不生成可执行文件。 - - + + We need the executabe to run problem case. 我们需要可执行文件来运行试题案例。 - + No compiler set 无编译器设置 - + No compiler set is configured. 没有配置编译器设置。 - + Can't start debugging. 无法启动调试器 - - + + Enable debugging 启用调试参数 - - + + You have not enabled debugging info (-g3) and/or stripped it from the executable (-s) in Compiler Options.<BR /><BR />Do you want to correct this now? 当前编译设置中未启用调试选项(-g3),或启用了信息剥除选项(-s)<br /><br/>是否纠正这一问题? - + Project not built 项目尚未构建 - + Project hasn't been built. Build it now? 项目尚未构建。是否构建? - + Host applcation missing 宿主程序不存在 - + DLL project needs a host application to run. 动态链接库(DLL)需要一个宿主程序来运行。 - + But it's missing. 但它不存在。 - + Host application not exists 宿主程序不存在 - + Host application file '%1' doesn't exist. 宿主程序'%1'不存在。 - - + + Please correct this before start debugging 请在调试前改正设置。 - + Recompile? 重新编译? - - + + Save last open info error 保存上次打开信息失败 @@ -5492,86 +5498,86 @@ Are you really want to continue? 无法删除旧上次打开信息文件'%1' - + Can't save last open info file '%1' 无法保存上次打开信息文件'%1' - - + + Load last open info error 载入上次打开信息失败 - - + + Can't load last open info file '%1' 无法载入上次打开信息文件'%1' - + Open Source File 打开源代码文件 - - + + Batch Set Cases 批量设置案例 - + Show detail debug logs 显示详细调试器日志 - + Copy all 全部复制 - + Go to Line 跳转到行 - + Line - + Template Exists 模板已存在 - + Template %1 already exists. Do you want to overwrite? 模板%1已存在。是否覆盖? - - - - - - + + + + + + Clear 清除 - + Export 导出 - + Insert Snippet 插入代码段 - - + + Problem Set %1 试题集%1 @@ -5592,68 +5598,68 @@ Are you really want to continue? 或者选择使用其他的网络端口。 - - + + Rebuild Project 重新构建项目 - - + + Project has been modified, do you want to rebuild it? 项目已经被修改过,是否需要重新构建? - + Auto Save Error 自动保存出错 - + Auto save "%1" to "%2" failed:%3 自动保存"%1"到"%2"失败:%3 - + Properties... 试题属性... - + Set Problem Set Name 设置试题集名称 - + Problem Set Name: 试题集名称: - + Remove 删除 - + Remove All Bookmarks 删除全部书签 - + Modify Description 修改描述 - - - + + + Bookmark Description 书签描述 - - - + + + Description: 描述: @@ -5662,204 +5668,209 @@ Are you really want to continue? 在调试主控台中显示调试器输出 - + Remove this search 清除这次搜索 - + Clear all searches 删除所有搜索 - + Breakpoint condition... 断点条件... - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Remove All Breakpoints Remove all breakpoints 删除所有断点 - + Remove Breakpoint 删除当前断点 - + Rename File 重命名文件 - - + + Add Folder 添加文件夹 - - + + New folder 新文件夹 - + Folder name: 文件夹: - + Rename Folder 重命名 - + Can't open last open information file '%1' for write! 无法写入配置文件'%1'。 - + Run Current Case 运行当前案例 - + Remove Folder 删除文件夹 - + Switch to normal view 切换为普通视图 - + Switch to custom view 切换为自定义视图 - + Sort By Type 按类型排序 - + Sort alphabetically 按名称排序 - + Show inherited members 显示继承的成员 - + Goto declaration 跳转到声明处 - + Goto definition 跳转到定义处 - + In current file 仅当前文件 - + In current project 整个项目 - - + + New Folder 新建文件夹 - + Rename 重命名 - - - - + + + + Delete 删除 - + Open in Editor 在编辑器中打开 - + Open in External Program 使用外部程序打开 - + Open in Terminal 在终端中打开 - + Open in Windows Explorer 在Windows浏览器中打开 - + Character sets 字符集 - + Convert to %1 转换为%1编码 - + %1 files autosaved 已自动保存%1个文件 - + Set answer to... 设置答案源代码... - + select other file... 选择其他文件... - + Select Answer Source File 选择答案源代码文件 + + + FPS Problem Set Files (*.fps) + FPS试题集文件(*.fps) + C/C++Source Files (*.c *.cpp *.cc *.cxx) C/C++Source Files (*.c *.cpp *.cc *.cxx C/C++源代码文件 (*.c *.cpp *.cc *.cxx) - + New Folder %1 新建文件夹%1 @@ -5872,68 +5883,68 @@ Are you really want to continue? 无标题%1 - + Do you really want to delete %1? 你真的要删除%1吗? - + Do you really want to delete %1 files? 你真的要删除%1个文件吗? - + Save project 保存项目 - + The project '%1' has modifications. 项目'%1'有改动。 - - + + Do you want to save it? 需要保存吗? - - + + File Changed 文件已发生变化 - + New Project File? 新建项目文件? - + Do you want to add the new file to the project? 您是否要将新建的文件加入项目? - - - - + + + + Save Error 保存失败 - + Change Project Compiler Set 改变项目编译器配置集 - + Change the project's compiler set will lose all custom compiler set options. 改变项目的编译器配置集会导致所有的自定义编译器选项被重置。 - - + + Do you really want to do that? 你真的想要那么做吗? @@ -5942,12 +5953,12 @@ Are you really want to continue? 批量设置案例 - + Choose input files 选择输入数据文件 - + Input data files (*.in) 输入数据文件 (*.in) @@ -5956,104 +5967,104 @@ Are you really want to continue? 无标题%1 - + Modify Watch 修改监视表达式 - + Watch Expression 监视表达式 - + Do you really want to clear all breakpoints in this file? 您真的要清除该文件的所有断点吗? - + New project 新建项目 - + Close %1 and start new project? 关闭'%1'以打开新项目? - + Folder not exist 文件夹不存在 - + Folder '%1' doesn't exist. Create it now? 文件夹'%1'不存在。是否创建? - + Can't create folder 无法创建文件夹 - + Failed to create folder '%1'. 创建文件夹'%1'失败。 - + Save new project as - + Folder %1 is not empty. 文件夹%1不是空的。 - + Do you really want to delete it? 你真的要删除它吗? - + Change working folder 改变工作文件夹 - + File '%1' is not in the current working folder. File '%1' is not in the current working folder 文件'%1'不在当前工作文件夹中。 - + Do you want to change working folder to '%1'? 是否将工作文件夹改设为'%1'? - + Can't Commit 无法提交 - + Git needs user info to commit. Git需要用信息进行提交。 - + Choose Input Data File 选择输入数据文件 - - + + All files (*.*) 所有文件 (*.*) - + Choose Expected Output Data File Choose Expected Input Data File 选择期望输出文件 @@ -6063,61 +6074,61 @@ Are you really want to continue? 第%1行 - - - + + + Choose Working Folder 选择工作文件夹 - - + + Header Exists 头文件已存在 - - + + Header file "%1" already exists! 头文件"%1"已存在! - + Source Exists 源文件已存在! - + Source file "%1" already exists! 源文件"%1"已存在! - + Can't commit! 无法提交! - + The following files are in conflicting: 下列文件处于冲突状态,请解决后重新添加和提交: - + Commit Message 提交信息 - + Commit Message: 提交信息: - + Commit Failed 提交失败 - + Commit message shouldn't be empty! 提交信息不能为空! @@ -6126,22 +6137,22 @@ Are you really want to continue? 小熊猫Dev-C++项目文件 (*.dev) - + New project fail 新建项目失败 - + Can't assign project template 无法使用模板创建项目 - + Remove file 删除文件 - + Remove the file from disk? 同时从硬盘上删除文件? @@ -6150,229 +6161,230 @@ Are you really want to continue? 无标题 - + New Project File Name 新的项目文件名 - + File Name: 文件名: - + File Already Exists! 文件已存在! - + File '%1' already exists! 文件'%1'已经存在! - + Add to project 添加到项目 - + C/C++ Source Files (*.c *.cpp *.cc *.cxx) C/C++源代码文件 (*.c *.cpp *.cc *.cxx) - + This operation will remove all cases for the current problem. 本操作会删除此试题的所有案例。 - + Red Panda C++ project file (*.dev) 小熊猫C++项目文件(*.dev) - + Rename Error 重命名出错 - + Symbol '%1' is defined in system header. 符号'%1'在系统头文件中定义,无法修改。 - + New Name 新名称 - - + + Replace Error 替换出错 - + Can't open file '%1' for replace! 无法打开文件'%1'进行替换! - + Contents has changed since last search! 内容和上次查找时不一致。 - + Rich Text Format Files (*.rtf) RTF格式文件 (*.rtf) - + HTML Files (*.html) HTML文件 (*.html) - + The current problem set is not empty. 当前的试题集不是空的。 - + Problem %1 试题%1 - - + + Problem Set Files (*.pbs) 试题集文件 (*.pbs) - + + Load Error 载入失败 - - + + Problem Case %1 试题案例%1 - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + Error 错误 - + Recent Projects 项目历史 - + Load Theme Error 载入主题失败 - - + + Clear History 清除历史 - - + + Version Control 版本控制 - + File '%1' was changed. 磁盘文件'%1'已被修改。 - + Reload its content from disk? 是否重新读取它的内容? - + File '%1' was removed. 磁盘文件'%1'已被删除。 - + Keep it open? 是否保持它在小熊猫C++中打开的编辑窗口? - + Open 打开 - + Compile Failed 编译失败 - + Run Failed 运行失败 - - - - + + + + Confirm Convertion 确认转换 - - - - + + + + The editing file will be saved using %1 encoding. <br />This operation can't be reverted. <br />Are you sure to continue? 当前编辑器中的文件将会使用%1编码保存。<br />这项操作无法被撤回。<br />你确定要继续吗? - + New Watch Expression 新监视表达式 - + Enter Watch Expression (it is recommended to use 'this->' for class members): 输入监视表达式 - + Parsing file %1 of %2: "%3" (%1/%2)正在解析文件"%3" - - + + Done parsing %1 files in %2 seconds 完成%1个文件的解析,用时%2秒 - + (%1 files per second) (每秒%1个文件) @@ -6654,12 +6666,12 @@ Are you really want to continue? OJProblemModel - + Name 名称 - + Time(ms) Time(sec) 时间(毫秒) @@ -7558,7 +7570,7 @@ Are you really want to continue? QApplication - + Error 错误 @@ -7752,7 +7764,7 @@ Are you really want to continue? 生成调试信息(-g3) - + Would you like Red Panda C++ to search for compilers in PATH? 您同意小熊猫C++在PATH路径中寻找gcc编译器吗? @@ -7865,23 +7877,23 @@ Are you really want to continue? 只生成汇编代码(-S) - - + + Confirm 确认 - + The following problems were found during validation of compiler set "%1": 在验证编译器设置"%1"时遇到了下列问题: - + Leaving those directories will lead to problems during compilation. 在配置中保留这些文件夹可能会导致编译出错。 - + Would you like Red Panda C++ to remove them for you and add the default paths to the valid paths? 是否让小熊猫C++删除这些配置,并尝试重新建立配置? @@ -7890,13 +7902,13 @@ Are you really want to continue? 如果仍然保留这些设置,可能会导致编译错误。<br /><br />请选择“是”,除非您清楚的知道选择“否”的后果, - - + + Compiler set not configuared. 未配置编译器设置。 - + Would you like Red Panda C++ to search for compilers in the following locations: <BR />'%1'<BR />'%2'? 您需要小熊猫C++在下列位置搜索编译器吗:<br />%1<br />%2 @@ -8257,8 +8269,8 @@ Are you really want to continue? - - + + Can't open file '%1' for read. 无法读取文件'%1'. @@ -8271,7 +8283,7 @@ Are you really want to continue? 无法写入文件'%1'. - + Can't parse problem set file '%1':%2 无法解析试题集文件"%1":%2 @@ -8281,16 +8293,21 @@ Are you really want to continue? <Auto Generated by Git> <由Git自动生成> + + + Problem Case %1 + 试题案例%1 + RegisterModel - + Register 寄存器 - + Value @@ -8954,14 +8971,14 @@ Are you really want to continue? 性能 - + Compiler Set 编译器配置集 - + Compiler @@ -8973,7 +8990,7 @@ Are you really want to continue? 自动链接 - + @@ -9050,15 +9067,15 @@ Are you really want to continue? 杂项 - - + + Program Runner 程序运行 - + Problem Set 试题集 @@ -9552,14 +9569,14 @@ Are you really want to continue? JSON文件'%1':%2中存在错误:%3 - - + + Execute to evaluate 执行以求值 - - + + Not Valid 在当前作用域中无效 @@ -9568,17 +9585,17 @@ Are you really want to continue? 无法读取文件'%1'. - + Expression 表达式 - + Type 类型 - + Value diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts index 06f915cb..f0ae912e 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts @@ -4573,6 +4573,14 @@ Generate Assembly + + Import FPS Problem Set + + + + FPS Problem Set Files (*.fps) + + NewClassDialog @@ -5904,6 +5912,10 @@ Reserve Word for Types + + Problem Case %1 + + RegisterModel diff --git a/RedPandaIDE/widgets/codecompletionpopup.cpp b/RedPandaIDE/widgets/codecompletionpopup.cpp index 262e984a..489e5881 100644 --- a/RedPandaIDE/widgets/codecompletionpopup.cpp +++ b/RedPandaIDE/widgets/codecompletionpopup.cpp @@ -540,7 +540,7 @@ void CodeCompletionPopup::filterList(const QString &member) } void CodeCompletionPopup::getCompletionFor( - const QStringList &ownerExpression, + QStringList ownerExpression, const QString& memberOperator, const QStringList& memberExpression, const QString &fileName, @@ -808,7 +808,7 @@ void CodeCompletionPopup::getCompletionFor( } } -void CodeCompletionPopup::getCompletionForFunctionWithoutDefinition(const QString& preWord, const QStringList &ownerExpression, const QString &memberOperator, const QStringList &memberExpression, const QString &fileName, int line) +void CodeCompletionPopup::getCompletionForFunctionWithoutDefinition(const QString& preWord, QStringList ownerExpression, const QString &memberOperator, const QStringList &memberExpression, const QString &fileName, int line) { if(!mParser) { return; diff --git a/RedPandaIDE/widgets/codecompletionpopup.h b/RedPandaIDE/widgets/codecompletionpopup.h index 71f277bf..d5f480db 100644 --- a/RedPandaIDE/widgets/codecompletionpopup.h +++ b/RedPandaIDE/widgets/codecompletionpopup.h @@ -134,7 +134,7 @@ private: void addStatement(const PStatement& statement, const QString& fileName, int line); void filterList(const QString& member); void getCompletionFor( - const QStringList& ownerExpression, + QStringList ownerExpression, const QString& memberOperator, const QStringList& memberExpression, const QString& fileName, @@ -143,7 +143,7 @@ private: void getCompletionForFunctionWithoutDefinition( const QString& preWord, - const QStringList& ownerExpression, + QStringList ownerExpression, const QString& memberOperator, const QStringList& memberExpression, const QString& fileName, diff --git a/RedPandaIDE/widgets/cpudialog.cpp b/RedPandaIDE/widgets/cpudialog.cpp index b27ddc41..85fbc740 100644 --- a/RedPandaIDE/widgets/cpudialog.cpp +++ b/RedPandaIDE/widgets/cpudialog.cpp @@ -32,7 +32,7 @@ CPUDialog::CPUDialog(QWidget *parent) : setWindowFlags(windowFlags() | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint); setWindowFlag(Qt::WindowContextHelpButtonHint,false); ui->setupUi(this); - ui->txtCode->setSyntaxer(syntaxerManager.getAsmSyntaxer()); + ui->txtCode->setSyntaxer(syntaxerManager.getSyntaxer(QSynedit::ProgrammingLanguage::Assembly)); ui->txtCode->setReadOnly(true); ui->txtCode->gutter().setShowLineNumbers(false); ui->txtCode->setCaretUseTextColor(true); diff --git a/RedPandaIDE/widgets/ojproblemsetmodel.cpp b/RedPandaIDE/widgets/ojproblemsetmodel.cpp index 0b0344cc..f300fab0 100644 --- a/RedPandaIDE/widgets/ojproblemsetmodel.cpp +++ b/RedPandaIDE/widgets/ojproblemsetmodel.cpp @@ -68,13 +68,23 @@ QString OJProblemSetModel::exportFilename() const return mProblemSet.exportFilename; } -void OJProblemSetModel::addProblem(POJProblem problem) +void OJProblemSetModel::addProblem(const POJProblem& problem) { beginInsertRows(QModelIndex(), mProblemSet.problems.count(), mProblemSet.problems.count()); mProblemSet.problems.append(problem); endInsertRows(); } +void OJProblemSetModel::addProblems(const QList &problems) +{ + if (problems.isEmpty()) + return; + beginInsertRows(QModelIndex(), mProblemSet.problems.count(), mProblemSet.problems.count()+problems.count()-1); + foreach( const POJProblem& p, problems) + mProblemSet.problems.append(p); + endInsertRows(); +} + POJProblem OJProblemSetModel::problem(int index) { return mProblemSet.problems[index]; diff --git a/RedPandaIDE/widgets/ojproblemsetmodel.h b/RedPandaIDE/widgets/ojproblemsetmodel.h index e5b4d04e..f61daf47 100644 --- a/RedPandaIDE/widgets/ojproblemsetmodel.h +++ b/RedPandaIDE/widgets/ojproblemsetmodel.h @@ -80,7 +80,8 @@ public: void rename(const QString& newName); QString name() const; QString exportFilename() const; - void addProblem(POJProblem problem); + void addProblem(const POJProblem& problem); + void addProblems(const QList &problems); POJProblem problem(int index); void removeProblem(int index); bool problemNameUsed(const QString& name); diff --git a/libs/qsynedit/qsynedit/SynEdit.cpp b/libs/qsynedit/qsynedit/SynEdit.cpp index d21c3aa1..72b6892f 100644 --- a/libs/qsynedit/qsynedit/SynEdit.cpp +++ b/libs/qsynedit/qsynedit/SynEdit.cpp @@ -1619,13 +1619,13 @@ int SynEdit::calcIndentSpaces(int line, const QString& lineText, bool addIndent) matchingIndents = rangeAfterFirstToken.matchingIndents; indentAdded = true; l = startLine; - } else if (mSyntaxer->language() == ProgrammingLanguage::Cpp + } else if (mSyntaxer->language() == ProgrammingLanguage::CPP && trimmedLineText.startsWith('#') && attr == ((CppSyntaxer *)mSyntaxer.get())->preprocessorAttribute()) { indentAdded = true; indentSpaces=0; l=0; - } else if (mSyntaxer->language() == ProgrammingLanguage::Cpp + } else if (mSyntaxer->language() == ProgrammingLanguage::CPP && mSyntaxer->isLastLineCommentNotFinished(rangePreceeding.state) ) { // last line is a not finished comment, @@ -2906,7 +2906,7 @@ void SynEdit::doAddChar(QChar AChar) if (mActiveSelectionMode==SelectionMode::Normal && mOptions.testFlag(eoAutoIndent) && mSyntaxer - && mSyntaxer->language() == ProgrammingLanguage::Cpp + && mSyntaxer->language() == ProgrammingLanguage::CPP && (oldCaretY<=mDocument->count()) ) { //unindent if ':' at end of the line @@ -5479,7 +5479,7 @@ int SynEdit::doInsertTextByNormalMode(const BufferCoord& pos, const QStringList& int caretY=pos.line; // step1: insert the first line of Value into current line if (text.length()>1) { - if (!mUndoing && mSyntaxer && mSyntaxer->language()==ProgrammingLanguage::Cpp && mOptions.testFlag(eoAutoIndent)) { + if (!mUndoing && mSyntaxer && mSyntaxer->language()==ProgrammingLanguage::CPP && mOptions.testFlag(eoAutoIndent)) { QString s = trimLeft(text[0]); if (sLeftSide.isEmpty()) { sLeftSide = GetLeftSpacing(calcIndentSpaces(caretY,s,true),true); @@ -5509,7 +5509,7 @@ int SynEdit::doInsertTextByNormalMode(const BufferCoord& pos, const QStringList& if (i==text.length()-1) { str = sRightSide; } else { - if (!mUndoing && mSyntaxer && mSyntaxer->language()==ProgrammingLanguage::Cpp && mOptions.testFlag(eoAutoIndent) && notInComment) { + if (!mUndoing && mSyntaxer && mSyntaxer->language()==ProgrammingLanguage::CPP && mOptions.testFlag(eoAutoIndent) && notInComment) { str = GetLeftSpacing(calcIndentSpaces(caretY,"",true),true); } else { str = ""; @@ -5519,7 +5519,7 @@ int SynEdit::doInsertTextByNormalMode(const BufferCoord& pos, const QStringList& str = text[i]; if (i==text.length()-1) str += sRightSide; - if (!mUndoing && mSyntaxer && mSyntaxer->language()==ProgrammingLanguage::Cpp && mOptions.testFlag(eoAutoIndent) && notInComment) { + if (!mUndoing && mSyntaxer && mSyntaxer->language()==ProgrammingLanguage::CPP && mOptions.testFlag(eoAutoIndent) && notInComment) { int indentSpaces = calcIndentSpaces(caretY,str,true); str = GetLeftSpacing(indentSpaces,true)+trimLeft(str); } diff --git a/libs/qsynedit/qsynedit/syntaxer/asm.cpp b/libs/qsynedit/qsynedit/syntaxer/asm.cpp index 61674bdb..901cbeb1 100644 --- a/libs/qsynedit/qsynedit/syntaxer/asm.cpp +++ b/libs/qsynedit/qsynedit/syntaxer/asm.cpp @@ -300,7 +300,7 @@ QString ASMSyntaxer::languageName() ProgrammingLanguage ASMSyntaxer::language() { - return ProgrammingLanguage::Asssembly; + return ProgrammingLanguage::Assembly; } QString ASMSyntaxer::getToken() const diff --git a/libs/qsynedit/qsynedit/syntaxer/cpp.cpp b/libs/qsynedit/qsynedit/syntaxer/cpp.cpp index c1fcec44..20b3d3d6 100644 --- a/libs/qsynedit/qsynedit/syntaxer/cpp.cpp +++ b/libs/qsynedit/qsynedit/syntaxer/cpp.cpp @@ -1627,7 +1627,7 @@ QString CppSyntaxer::languageName() ProgrammingLanguage CppSyntaxer::language() { - return ProgrammingLanguage::Cpp; + return ProgrammingLanguage::CPP; } SyntaxerState CppSyntaxer::getState() const diff --git a/libs/qsynedit/qsynedit/syntaxer/syntaxer.h b/libs/qsynedit/qsynedit/syntaxer/syntaxer.h index bbdf91bf..fed3197a 100644 --- a/libs/qsynedit/qsynedit/syntaxer/syntaxer.h +++ b/libs/qsynedit/qsynedit/syntaxer/syntaxer.h @@ -81,8 +81,8 @@ enum class TokenType { enum class ProgrammingLanguage { DecideBySuffix, Composition, - Asssembly, - Cpp, + Assembly, + CPP, GLSL, Makefile, Custom