diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 28cf0aa0..385d34fe 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -16,6 +16,8 @@ SOURCES += \ compiler/executablerunner.cpp \ compiler/filecompiler.cpp \ compiler/stdincompiler.cpp \ + parser/cpppreprocessor.cpp \ + parser/statementmodel.cpp \ qsynedit/Search.cpp \ qsynedit/SearchBase.cpp \ qsynedit/SearchRegex.cpp \ @@ -73,6 +75,9 @@ HEADERS += \ compiler/executablerunner.h \ compiler/filecompiler.h \ compiler/stdincompiler.h \ + parser/cpppreprocessor.h \ + parser/statementmodel.h \ + parser/utils.h \ qsynedit/Search.h \ qsynedit/SearchBase.h \ qsynedit/SearchRegex.h \ diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts index 748f274b..e47fc441 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -1,6 +1,65 @@ + + BacktraceModel + + + Function + 函数 + + + + Filename + 文件名 + + + + Line + + + + + BreakpointModel + + + Filename + 文件名 + + + + Line + + + + + Condition + + + + + CPUDialog + + + CPU Info + + + + + Disassemble + + + + + AT&&T + + + + + Intel + + + ColorEdit @@ -13,60 +72,116 @@ Compiler - + + Clean before rebuild failed. + + + + Compile Result: 编译结果: - + - Errors: %1 - 错误数: %1 - + - Warnings: %1 - 警告数: %1 - + - Output Filename: %1 - 输出文件名: %1 - + - Output Size: %1 - 输出文件大小: %1 - + - Compilation Time: %1 secs - 编译时间: %1 秒 - + [Error] [错误] - + [Warning] [警告] - + [Info] [信息] - + [Note] [说明] + + + The compiler process failed to start. + + + + + The compiler process crashed after starting successfully. + + + + + The last waitFor...() function timed out. + + + + + An error occurred when attempting to write to the compiler process. + + + + + An error occurred when attempting to read from the compiler process. + + + + + An unknown error occurred. + + - Time Elasped: %1 secs - 编译时间: %1 秒 + + CompilerManager + + + + No compiler set + + + + + + No compiler set is configured. + + + + + + Can't start debugging. + + + CompilerSetDirectoriesWidget @@ -226,12 +341,12 @@ 选择性能分析器 - + Confirm 确认 - + Red Panda C++ will clear current compiler list and search for compilers in the following locations: '%1' '%2' @@ -242,27 +357,146 @@ Are you really want to continue? 你确定要继续吗? - - + + + Failed + + + + + + Can't find any compiler. + + + + + Compiler Set Name 编译器配置名称 - + Name 名称 - + Compiler Set Folder 编译器所在文件夹 - + New name 新名称 + + DebugGeneralWidget + + + Form + 表单 + + + + Debug Console + + + + + Font: + 字体: + + + + Show only monospaced fonts + 只显示等宽字体 + + + + Size: + 大小: + + + + Show debug logs in the debug console + + + + + Show full gdb annotations + + + + + Disassembly Coding Style + + + + + Intel + + + + + AT&&T + + + + + Debugger + + + No compiler set + + + + + No compiler set is configured. + + + + + Can't start debugging. + + + + + Debugger not exists + + + + + Can''t find debugger in : "%1" + + + + + + Execute to evaluate + + + + + Not found in current context + + + + + Compile + 编译 + + + + Source file is more recent than executable. + + + + + Recompile? + + + Editor @@ -270,48 +504,52 @@ Are you really want to continue? 无标题 - + untitled%1 无标题%1 - - - - - - - Fail - 失败 + 失败 - + + + + + + + + Error + 错误 + + + File %1 is not writable! - + Save As 另存为 - + The text to be copied exceeds count limit! 要复制的内容超过了行数限制! - + The text to be copied exceeds character limit! 要复制的内容超过了字符数限制! - + The text to be cut exceeds count limit! 要剪切的内容超过了行数限制! - + The text to be cut exceeds character limit! 要剪切的内容超过了字符数限制! @@ -618,6 +856,92 @@ Are you really want to continue? 方块 + + EditorSymbolCompletionWidget + + + Form + 表单 + + + + Complete Symbols + + + + + Details + + + + + Complete Braces{} + + + + + Complete Brackets [] + + + + + Complete Parenthesis () + + + + + Complete Multiline Comments /**/ + + + + + Complete Single Quotations '' + + + + + Complete Double Quotations "" + + + + + Complete #include <> + + + + + Skip matching symbols while typing + + + + + Remove symbol pairs when delete chars + + + + + EditorSyntaxCheckWidget + + + Form + 表单 + + + + Enable Auto Syntax Check + + + + + Check when save/load file + + + + + Check when count of lines changed + + + EnvironmentAppearenceWidget @@ -651,6 +975,57 @@ Are you really want to continue? 大小: + + ExecutableRunner + + + The runner process failed to start. + + + + + The runner process crashed after starting successfully. + + + + + The last waitFor...() function timed out. + + + + + An error occurred when attempting to write to the runner process. + + + + + An error occurred when attempting to read from the runner process. + + + + + An unknown error occurred. + + + + + ExecutorGeneralWidget + + + Form + 表单 + + + + Pause console programs after return + + + + + Minimize IDE when running programs + + + FileCompiler @@ -670,6 +1045,7 @@ Are you really want to continue? + Can't delete the old executable file "%1". 无法删除旧的可执行文件"%1". @@ -682,16 +1058,21 @@ Are you really want to continue? + The Compiler '%1' doesn't exists! + + + + Processing %1 source file: 正在处理%1源程序文件: - + %1 Compiler: %2 %1编译器: %2 - + Command: %1 %2 命令: %1 %2 @@ -699,22 +1080,22 @@ Are you really want to continue? IssuesModel - + Filename 文件名 - + Line - + Col - + Description 描述 @@ -727,301 +1108,642 @@ Are you really want to continue? 小熊猫C++ - - Tab 1 - - - - - Tab 2 - - - - + + Issues 编译器 - + Compile Log 编译日志 - + File 文件 - + Tools 工具 - - - + + Run 运行 - + Edit 编辑 - - + + Project + + + + + Watch + + + + + Structure + + + + + Files + + + + + Resource + + + + + + + Debug + + + + + Evaluate: + + + + + Debug Console + + + + + Call Stack + + + + + Breakpoints + + + + + Locals + + + + + + Search + + + + + History: + + + + + Search Again + + + + + Replace with: + + + + + Replace + + + + + Close + + + + + Execute + + + + + + toolBar - + toolBar_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 编译 - + 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 + + + + + F8 + F8 + + + + Step Out + + + + + Ctrl+F8 + + + + + Run To Cursor + + + + + Ctrl+F5 + + + + + Continue + + + + + F4 + F4 + + + + Add Watch... + + + + + View CPU Window... + + + + + Exit + + + + + Find... + + + + + Ctrl+F + + + + + Find in Files... + + + + + Ctrl+Shift+F + + + + + Replace... + + + + + Ctrl+R + + + + + Find Next + + + + + F3 + F3 + + + + Find Previous + + + + + Shift+F3 + + + + File Encoding 文件编码 - + + Recent Files + + + + + + Debugging + + + + + + Running + + + + + + Compiling + + + + Line:%1 Col:%2 Selected:%3 Lines:%4 Length:%5 行:%1 列:%2 已选择:%3 总行数:%4 总长度:%5 - + Read Only 只读 - + Insert 插入 - + Overwrite 覆写 - - - - - - + + + Confirm + 确认 + + + + + + Source file is not compiled. + + + + + + Compile now? + + + + + + Source file is more recent than executable. + + + + + Recompile now? + + + + + 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? + + + + + Recompile? + + + + + + + + + Error 错误 - + 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): + + QApplication - + Error 错误 @@ -1029,12 +1751,12 @@ Are you really want to continue? QObject - + Save 保存 - + Save changes to %1? 将修改保存到"%1"? @@ -1069,31 +1791,74 @@ Are you really want to continue? - - + + Error 错误 - + Can't create configuration folder %1 无法创建配置文件夹"%1" - + Can't write to configuration file %1 无法写入配置文件夹"%1" - + + + + + The following %1 directories don't exist: + + + + + + binary + + + + + No %1 directories have been specified. + + + + + C include + + + + + + C++ include + + + + + + + + Cannot find the %1 "%2" + + + + C options C语言选项 - + Code Generation 代码生成 + + + The following problems were found during validation of compiler set "%1": + + Binaries @@ -1125,13 +1890,13 @@ Are you really want to continue? - - + + untitled 无标题 - + Index %1 out of range 下标"%1"越界 @@ -1382,7 +2147,7 @@ Are you really want to continue? - + default 缺省 @@ -1392,154 +2157,352 @@ Are you really want to continue? 无标题 + + RegisterModel + + + Register + + + + + Value(Hex) + + + + + Value(Dec) + + + + + SearchDialog + + + Dialog + + + + + Text to Find: + + + + + Replace with: + + + + + Options: + + + + + Case Sensitive + + + + + Whole words only + + + + + Regular Expression + + + + + Prompt on replace + + + + + Scope: + + + + + Global + + + + + Selection + 选中文字 + + + + Origin: + + + + + From cursor + + + + + Entire scope + + + + + Direction: + + + + + Forward + + + + + Backward + + + + + Where: + + + + + Current File + + + + + Files In Project + + + + + Open Files + + + + + + + Find + + + + + Cancel + + + + + Find in files + + + + + + + Replace + + + + + Replace this occurrence of ''%1''? + + + + + SearchResultListModel + + + Current File: + + + + + Files In Project: + + + + + Open Files: + + + + + SearchResultTreeModel + + + Line + + + + + SearchResultTreeViewDelegate + + + + Line + + + Settings::CompilerSet - + Support all ANSI standard C programs (-ansi) 支持所有ANSI标准C程序(-ansi) - + Do not recognize asm,inline or typeof as a keyword (-fno-asm) 不支持将asm、inline和typeof作为关键字(-fno-asm) - + Imitate traditional C preprocessors (-traditional-cpp) 模仿传统C预处理器行为(-traditional-cpp) - + Optimize for the following machine (-march) - + Optimize less, while maintaining full compatibility (-tune) - + Enable use of specific instructions (-mx) - + Optimization level (-Ox) - + Compile with the following pointer size (-mx) - + Language standard (-std) - + Generate debugging information (-g3) - + Generate profiling info for analysis (-pg) - + Warnings - + Inhibit all warning messages (-w) - + Show most warnings (-Wall) - + Show some more warnings (-Wextra) - + Check ISO C/C++/C++0x conformance (-pedantic) - + Only check the code for syntax errors (-fsyntax-only) - + Make all warnings into errors (-Werror) - + Abort compilation on first error (-Wfatal-errors) - + Linker - + Link an Objective C program (-lobjc) - + Do not use standard system libraries (-nostdlib) - + Do not create a console window (-mwindows) - + Strip executable (-s) - + Link libraries statically (-static) - + Output - + -fverbose-asm - + Use pipes instead of temporary files during compilation (-pipe) - + Do not assemble, compile and generate the assemble code (-S) + + Settings::CompilerSets + + + Confirm + 确认 + + SettingsDialog @@ -1568,64 +2531,131 @@ Are you really want to continue? 取消 - + Appearence 外观 - + Environment 环境 - + Compiler Set 编译器配置集 - + Compiler 编译器 - + + + General 通用 - + + + Editor 编辑器 - + Font 字体 - + Copy & Export 复制/导出 - + Color 配色 - + + Symbol Completion + + + + + Auto Syntax Checking + + + + + Program Runner + + + + + Debugger + + + + Save Changes 保存修改 - + There are changes in the settings, do you want to save them before swtich to other page? 本页中有尚未保存的设置修改,是否保存后再切换到其他页? + + StdinCompiler + + + Checking file syntax... + + + + + - Filename: %1 + - 文件名: %1 + + + + - Compiler Set Name: %1 + - 编译器配置: %1 + + + + Can't find the compiler for file %1 + 找不到适合文件%1的编译器 + + + + The Compiler '%1' doesn't exists! + + + + + Processing %1 source file: + 正在处理%1源程序文件: + + + + %1 Compiler: %2 + %1编译器: %2 + + + + Command: %1 %2 + 命令: %1 %2 + + SynEdit diff --git a/RedPandaIDE/parser/cpppreprocessor.cpp b/RedPandaIDE/parser/cpppreprocessor.cpp new file mode 100644 index 00000000..c32a9d9c --- /dev/null +++ b/RedPandaIDE/parser/cpppreprocessor.cpp @@ -0,0 +1,6 @@ +#include "cpppreprocessor.h" + +CppPreprocessor::CppPreprocessor(QObject *parent) : QObject(parent) +{ + +} diff --git a/RedPandaIDE/parser/cpppreprocessor.h b/RedPandaIDE/parser/cpppreprocessor.h new file mode 100644 index 00000000..62947403 --- /dev/null +++ b/RedPandaIDE/parser/cpppreprocessor.h @@ -0,0 +1,16 @@ +#ifndef CPPPREPROCESSOR_H +#define CPPPREPROCESSOR_H + +#include + +class CppPreprocessor : public QObject +{ + Q_OBJECT +public: + explicit CppPreprocessor(QObject *parent = nullptr); + +signals: + +}; + +#endif // CPPPREPROCESSOR_H diff --git a/RedPandaIDE/parser/statementmodel.cpp b/RedPandaIDE/parser/statementmodel.cpp new file mode 100644 index 00000000..d16cbd0e --- /dev/null +++ b/RedPandaIDE/parser/statementmodel.cpp @@ -0,0 +1,6 @@ +#include "statementmodel.h" + +StatementModel::StatementModel(QObject *parent) : QObject(parent) +{ + +} diff --git a/RedPandaIDE/parser/statementmodel.h b/RedPandaIDE/parser/statementmodel.h new file mode 100644 index 00000000..175dfb0d --- /dev/null +++ b/RedPandaIDE/parser/statementmodel.h @@ -0,0 +1,16 @@ +#ifndef STATEMENTMODEL_H +#define STATEMENTMODEL_H + +#include + +class StatementModel : public QObject +{ + Q_OBJECT +public: + explicit StatementModel(QObject *parent = nullptr); + +signals: + +}; + +#endif // STATEMENTMODEL_H diff --git a/RedPandaIDE/parser/utils.h b/RedPandaIDE/parser/utils.h new file mode 100644 index 00000000..93eeaae1 --- /dev/null +++ b/RedPandaIDE/parser/utils.h @@ -0,0 +1,51 @@ +#ifndef PARSER_UTILS_H +#define PARSER_UTILS_H +#include +#include +// preprocess/ macro define +struct Define { + QString Name; + QString args; + QString value; + QString filename; + bool isMultiLine; // if true the expanded macro will span multiline + bool hardCoded;// if true, don't free memory (points to hard defines) + QStringList argList; // args list to format values + QString formatValue; // format template to format values +}; + +using PDefine = std::shared_ptr; + +enum class SkipType { + skItself, // skip itself + skToSemicolon, // skip to ; + skToColon, // skip to : + skToRightParenthesis, // skip to ) + skToLeftBrace,// Skip to { + skToRightBrace, // skip to } + skNone // It's a keyword but don't process here +}; + +enum class StatementKind { + skUnknown, + skPreprocessor, + skEnumType, + skEnum, + skTypedef, + skClass, + skFunction, + skConstructor, + skDestructor, + skVariable, + skParameter, + skNamespace, + skNamespaceAlias, + skBlock, + skUserCodeIn, // user code template + skKeyword, // keywords + skGlobalVariable, + skLocalVariable, + skAlias +}; + +#endif // PARSER_UTILS_H