diff --git a/modules/syntax/highlighter.krk b/modules/syntax/highlighter.krk index 17b8614..6ce0bb2 100644 --- a/modules/syntax/highlighter.krk +++ b/modules/syntax/highlighter.krk @@ -22,19 +22,29 @@ let FLAG_ESCAPE = 13 let keywords = [ 'and','class','def','else','export','for','if','in','import','let','not', 'or','return','while','try','except','raise','continue','break','as','from', - 'elif', 'lambda', 'pass', 'with', 'is', 'del' + 'elif', 'lambda', 'pass', 'with', 'is', 'del', 'assert', 'yield', 'finally', + 'async', 'await', ] let types = [ 'self','super','len','str','int','float','dir','repr','list','dict','range', 'object','exception','isinstance','type','print','tuple','bool','any','all', - 'hex','ord','chr' + 'hex','ord','chr','bytes','set','getattr','setattr','input','zip','enumerate', + 'property','staticmethod','classmethod','filter','min','max','id','map','bin', + 'sum','sorted','issubclass','hasattr','delattr', 'NotImplemented', 'abs', ] let special = [ 'True', 'False', 'None' ] +let exceptions = [ + 'Exception', 'TypeError', 'ArgumentError', 'IndexError', 'KeyError', + 'AttributeError', 'NameError', 'ImportError', 'IOError', 'ValueError', + 'KeyboardInterrupt', 'ZeroDivisionError', 'NotImplementedError', 'SyntaxError', + 'AssertionError', +] + def toTerminal(processed,colors=None): if not colors: colors = { @@ -233,6 +243,8 @@ class KurokoHighlighter(State): return 0 else if self.findKeywords(special, FLAG_NUMERAL, self.cKeywordQualifier): return 0 + else if self.findKeywords(exceptions, FLAG_PRAGMA, self.cKeywordQualifier): + return 0 else if not self.cKeywordQualifier(self.lastchar()) and self.isdigit(self.charat()): self.paintNumeral() return 0