| 49 | } |
| 50 | |
| 51 | QsciLexer *LexerManager::createSciLexer(const QString &language, const QString &fileName) |
| 52 | { |
| 53 | auto proxy = sciLexerProxyMng.value(language, nullptr); |
| 54 | if (proxy) { |
| 55 | // The `SciLexerHandler` is structured by `TextEditor` |
| 56 | SciLexerHandler *handler = new SciLexerHandler(); |
| 57 | handler->setProxy(proxy); |
| 58 | return handler; |
| 59 | } |
| 60 | |
| 61 | for (auto proxy : sciLexerProxyMng) { |
| 62 | if (proxy->isSupport(fileName)) { |
| 63 | SciLexerHandler *handler = new SciLexerHandler(); |
| 64 | handler->setProxy(proxy); |
| 65 | return handler; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | return defaultSciLexer(language); |
| 70 | } |
| 71 | |
| 72 | QsciLexer *LexerManager::defaultSciLexer(const QString &language) |
| 73 | { |