aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/glsleditor
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2017-05-05 18:44:26 +0200
committerEike Ziller <eike.ziller@qt.io>2017-05-08 08:49:42 +0000
commitfca108c35dd414b1d90eeb4b75f30292a2723f9b (patch)
tree0b914b32df2b8a3a49c700d7e43ec68765dee5cc /src/plugins/glsleditor
parent51996e9afec32b0b90225fab39e01aeb29b90197 (diff)
Remove dead code from GLSL highlighter
Change-Id: I43734e16ee0972906666629dc822e19982980d0e Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/glsleditor')
-rw-r--r--src/plugins/glsleditor/glslhighlighter.cpp83
1 files changed, 0 insertions, 83 deletions
diff --git a/src/plugins/glsleditor/glslhighlighter.cpp b/src/plugins/glsleditor/glslhighlighter.cpp
index eed647e177..23f9c9d550 100644
--- a/src/plugins/glsleditor/glslhighlighter.cpp
+++ b/src/plugins/glsleditor/glslhighlighter.cpp
@@ -325,88 +325,5 @@ bool GlslHighlighter::isPPKeyword(const QStringRef &text) const
return false;
}
-#if 0
-void Highlighter::highlightBlock(const QString &text)
-{
- const int previousState = previousBlockState();
- int state = 0, initialBraceDepth = 0;
- if (previousState != -1) {
- state = previousState & 0xff;
- initialBraceDepth = previousState >> 8;
- }
-
- int braceDepth = initialBraceDepth;
-
- Parentheses parentheses;
- parentheses.reserve(20); // assume wizard level ;-)
-
- const QByteArray data = text.toLatin1();
- GLSL::Lexer lex(/*engine=*/ 0, data.constData(), data.size());
- lex.setState(qMax(0, previousState));
- lex.setScanKeywords(false);
- lex.setScanComments(true);
- const int variant = m_editor->languageVariant();
- lex.setVariant(variant);
-
- int foldingIndent = initialBraceDepth;
- if (TextBlockUserData *userData = BaseTextDocumentLayout::testUserData(currentBlock())) {
- userData->setFoldingIndent(0);
- userData->setFoldingStartIncluded(false);
- userData->setFoldingEndIncluded(false);
- }
-
- QList<GLSL::Token> tokens;
- GLSL::Token tk;
- do {
- lex.yylex(&tk);
- tokens.append(tk);
- } while (tk.isNot(GLSL::Parser::EOF_SYMBOL));
-
- for (int i = 0; i < tokens.size(); ++i) {
- const GLSL::Token &tk = tokens.at(i);
-
- if (tk.is(GLSL::Parser::T_NUMBER)) {
- setFormat(tk.position, tk.length, formatForCategory(GLSLNumberFormat));
- } else if (tk.is(GLSL::Parser::T_COMMENT)) {
- setFormat(tk.position, tk.length, Qt::darkGreen); // ### FIXME: formatForCategory(GLSLCommentFormat);
- } else if (tk.is(GLSL::Parser::T_IDENTIFIER)) {
- int kind = lex.findKeyword(data.constData() + tk.position, tk.length);
- if (kind == GLSL::Parser::T_RESERVED)
- setFormat(tk.position, tk.length, formatForCategory(GLSLReservedKeyword));
- else if (kind != GLSL::Parser::T_IDENTIFIER)
- setFormat(tk.position, tk.length, formatForCategory(GLSLKeywordFormat));
- } else if (tk.is(GLSL::Parser::T_LEFT_PAREN) || tk.is(GLSL::Parser::T_LEFT_BRACE) || tk.is(GLSL::Parser::T_LEFT_BRACKET)) {
- const QChar c = text.at(tk.begin());
- parentheses.append(Parenthesis(Parenthesis::Opened, c, tk.begin()));
- if (tk.is(GLSL::Parser::T_LEFT_BRACE)) {
- ++braceDepth;
-
- // if a folding block opens at the beginning of a line, treat the entire line
- // as if it were inside the folding block
-// if (tk.begin() == firstNonSpace) {
-// ++foldingIndent;
-// BaseTextDocumentLayout::userData(currentBlock())->setFoldingStartIncluded(true);
-// }
- }
- } else if (tk.is(GLSL::Parser::T_RIGHT_PAREN) || tk.is(GLSL::Parser::T_RIGHT_BRACE) || tk.is(GLSL::Parser::T_RIGHT_BRACKET)) {
- const QChar c = text.at(tk.begin());
- parentheses.append(Parenthesis(Parenthesis::Closed, c, tk.begin()));
- if (tk.is(GLSL::Parser::T_RIGHT_BRACE)) {
- --braceDepth;
- if (braceDepth < foldingIndent) {
- // unless we are at the end of the block, we reduce the folding indent
- if (i == tokens.size()-1 || tokens.at(i+1).is(GLSL::Parser::T_SEMICOLON))
- BaseTextDocumentLayout::userData(currentBlock())->setFoldingEndIncluded(true);
- else
- foldingIndent = qMin(braceDepth, foldingIndent);
- }
- }
- }
-
- } while (tk.isNot(GLSL::Parser::EOF_SYMBOL));
- setCurrentBlockState((braceDepth << 8) | lex.state());
-}
-#endif
-
} // namespace Internal
} // namespace GlslEditor