I know this question has been answered but as like me many other new users came here and will know that the options mentioned in above answers are little advance level. I am posting this answer for further reference for some other new comers
Creating a syntax Highlighter with python and Qt is a good choice. As python is very powerful language and QT is great framework for GUI application development.
Syntax highlighter is simplest Regex expression with QTextEdit Object. You just parse the Regex expressions and then select specific QTextFormat for that kind of regex and on apply that text format onto that block.
Here is code example of simplest syntax highlighter implemented in Python using Qt4 the highlight function implemented in syntaxHighlighter class drived from QSyntaxHighlighter
def highlightBlock(self, text):
for pattern, format in self.highlightingRules:
expression = QtCore.QRegExp(pattern)
index = expression.indexIn(text)
while index >= 0:
length = expression.matchedLength()
self.setFormat(index, length, format)
index = expression.indexIn(text, index + length)
self.setCurrentBlockState(0)
startIndex = 0
if self.previousBlockState() != 1:
startIndex = self.commentStartExpression.indexIn(text)
while startIndex >= 0:
endIndex = self.commentEndExpression.indexIn(text, startIndex)
if endIndex == -1:
self.setCurrentBlockState(1)
commentLength = len(text) - startIndex
else:
commentLength = endIndex - startIndex + self.commentEndExpression.matchedLength()
self.setFormat(startIndex, commentLength,
self.multiLineCommentFormat)
startIndex = self.commentStartExpression.indexIn(text,
startIndex + commentLength);
Using this example I have created an Assembly syntax highlighter in Python with Qt4 for 8051 microcontroller. For further reference and a good starting point you can refer to that code.