class koHLSLLanguage(KoLanguageBase): name = "HLSL" _reg_desc_ = "%s Language" % name _reg_contractid_ = "@activestate.com/koLanguage?language=%s;1" \ % (name) _reg_clsid_ = "{fd0846b3-ff7f-41af-b324-179783084469}" _reg_categories_ = [("komodo-language", name)] primary = 0 defaultExtension = ".hlsl" commentDelimiterInfo = { "line": [ "//" ], "block": [ ("/*", "*/") ], "markup": "*", } _dedenting_statements = [u'throw', u'return', u'break', u'continue'] _indenting_statements = [u'case'] searchURL = "http://www.google.com/search?q=hlsl+site%3Amicrosoft.com%2F+%W" # matches: # function name # name: function # name = function # class.prototype.name = function namedBlockDescription = 'HLSL functions and classes' namedBlockRE = r'^[ |\t]*?(?:([\w|\.|_]*?)\s*=\s*function|function\s*([\w|\_]*?)|([\w|\_]*?)\s*:\s*function).*?$' supportsSmartIndent = "brace" sample = """ float4 normal = mul(IN.Normal, ModelViewIT); normal.w = 0.0; normal = normalize(normal); float4 light = normalize(LightVec); float4 eye = float4(1.0, 1.0, 1.0, 0.0); float4 vhalf = normalize(light + eye); """ styleStdin = sci_constants.SCE_C_STDIN styleStdout = sci_constants.SCE_C_STDOUT styleStderr = sci_constants.SCE_C_STDERR def __init__(self): # Same as JavaScript's KoLanguageBase.__init__(self) self._style_info.update( _block_comment_styles = [sci_constants.SCE_C_COMMENT, sci_constants.SCE_C_COMMENTDOC, sci_constants.SCE_C_COMMENTDOCKEYWORD, sci_constants.SCE_C_COMMENTDOCKEYWORDERROR], _variable_styles = [sci_constants.SCE_C_IDENTIFIER] ) self._setupIndentCheckSoftChar() def getVariableStyles(self): # Same as JavaScript's return self._style_info._variable_styles def get_lexer(self): if self._lexer is None: self._lexer = KoLexerLanguageService() self._lexer.setLexer(sci_constants.SCLEX_CPP) self._lexer.setKeywords(0, HLSLLangInfo.keywords) self._lexer.setProperty('fold.cpp.syntax.based', '1') self._lexer.supportsFolding = 1 return self._lexer
class koGoLanguage(KoLanguageBase, KoLanguageBaseDedentMixin): name = "Go" _reg_desc_ = "%s Language" % name _reg_contractid_ = "@activestate.com/koLanguage?language=%s;1" \ % (name) _reg_clsid_ = "{2d6ed8b6-f079-441a-8b5a-10ef781cb989}" _reg_categories_ = [("komodo-language", name)] modeNames = ['go'] primary = 1 internal = 0 accessKey = 'g' defaultExtension = ".go" commentDelimiterInfo = { "line": [ "//" ], "block": [ ("/*", "*/") ], "markup": "*", } _dedenting_statements = [u'goto', u'return', u'break', u'continue'] namedBlockRE = "^[ \t]*?(func\s+(?:\(.*?\)\s*)?\w|package\s+\w)" namedBlockDescription = 'Go functions, methods and packages' supportsSmartIndent = "brace" # The following sample contains embedded tabs because that's the Go way. sample = r"""\ package commands import ( "encoding/json" ) type Filters []string func (f *Filters) String() string { a := "a string" b := 'c' // a char c := 43 // a num return fmt.Sprint(*f) } /* Block comment on these two lines */ """ def __init__(self): KoLanguageBase.__init__(self) self._style_info.update( _block_comment_styles = [sci_constants.SCE_C_COMMENT, sci_constants.SCE_C_COMMENTDOC, sci_constants.SCE_C_COMMENTDOCKEYWORD, sci_constants.SCE_C_COMMENTDOCKEYWORDERROR], _variable_styles = [components.interfaces.ISciMoz.SCE_C_IDENTIFIER] ) self._setupIndentCheckSoftChar() self._fastCharData = \ FastCharData(trigger_char=";", style_list=(sci_constants.SCE_C_OPERATOR,), skippable_chars_by_style={ sci_constants.SCE_C_OPERATOR : "])",}, for_check=True) # And add the new default prefs if they don't exist globalPrefs = components.classes["@activestate.com/koPrefService;1"]\ .getService(components.interfaces.koIPrefService).prefs # Chunk adding prefs based on which ones they were added with. if not globalPrefs.hasPref("gocodeDefaultLocation"): globalPrefs.setStringPref("gocodeDefaultLocation", "") if not globalPrefs.hasPref("godefDefaultLocation"): globalPrefs.setStringPref("godefDefaultLocation", "") if not globalPrefs.hasPref("golangDefaultLocation"): globalPrefs.setStringPref("golangDefaultLocation", "") globalPrefs.setStringPref("Go/newEncoding", "utf-8") globalPrefs.setLongPref("Go/indentWidth", 8) globalPrefs.setBooleanPref("Go/useTabs", True) #TODO: Add formatter prefs along the lines of: # <!-- Go formatter --> # <preference-set > # <string id="formatter_name">generic</string> # <string id="lang">Go</string> # <string id="name">Go Reformatter</string> # <string id="uuid">{286d5b45-a54e-4317-b3c8-da4dc35673a4}</string> # </preference-set> def getLanguageService(self, iid): return KoLanguageBase.getLanguageService(self, iid) def get_lexer(self): if self._lexer is None: self._lexer = KoLexerLanguageService() self._lexer.setLexer(components.interfaces.ISciMoz.SCLEX_CPP) self._lexer.supportsFolding = 1 self._lexer.setProperty('lexer.cpp.allow.dollars', '0') self._lexer.setProperty('fold.cpp.syntax.based', '1') self._lexer.setProperty('lexer.cpp.backquoted.strings', '1') self._lexer.setKeywords(0, GoLangInfo.reserved_keywords) # The CPP lexer reserves keywords(2) for comment doc keywords and # keywords(3) for "SCE_C_GLOBALCLASS", so treat the # predeclared_identifiers (like 'bool') and # the predefined_functions (like 'append') as the same. other_words = (GoLangInfo.predeclared_identifiers. union(GoLangInfo.predeclared_functions)) self._lexer.setKeywords(1, other_words) return self._lexer
class koGoLanguage(KoLanguageBase, KoLanguageBaseDedentMixin): name = "Go" _reg_desc_ = "%s Language" % name _reg_contractid_ = "@activestate.com/koLanguage?language=%s;1" \ % (name) _reg_clsid_ = "{2d6ed8b6-f079-441a-8b5a-10ef781cb989}" _reg_categories_ = [("komodo-language", name)] # Copy the base interfaces. _com_interfaces_ = KoLanguageBase._com_interfaces_[:] # Add koIInterpolationCallback - but it's only available in version 9 and # above - so catch the exception for earlier versions. try: _com_interfaces_.append(components.interfaces.koIInterpolationCallback) except: log.warn("koIInterpolationCallback does not exist") modeNames = ['go'] primary = 1 internal = 0 accessKey = 'g' defaultExtension = ".go" commentDelimiterInfo = { "line": ["//"], "block": [("/*", "*/")], "markup": "*", } _dedenting_statements = [u'goto', u'return', u'break', u'continue'] namedBlockRE = "^[ \t]*?(func\s+(?:\(.*?\)\s*)?\w|package\s+\w)" namedBlockDescription = 'Go functions, methods and packages' supportsSmartIndent = "brace" # The following sample contains embedded tabs because that's the Go way. sample = r"""\ package commands import ( "encoding/json" ) type Filters []string func (f *Filters) String() string { a := "a string" b := 'c' // a char c := 43 // a num return fmt.Sprint(*f) } /* Block comment on these two lines */ """ def __init__(self): KoLanguageBase.__init__(self) self._style_info.update( _block_comment_styles=[ sci_constants.SCE_C_COMMENT, sci_constants.SCE_C_COMMENTDOC, sci_constants.SCE_C_COMMENTDOCKEYWORD, sci_constants.SCE_C_COMMENTDOCKEYWORDERROR ], _variable_styles=[components.interfaces.ISciMoz.SCE_C_IDENTIFIER]) self._setupIndentCheckSoftChar() self._fastCharData = \ FastCharData(trigger_char=";", style_list=(sci_constants.SCE_C_OPERATOR,), skippable_chars_by_style={ sci_constants.SCE_C_OPERATOR : "])",}, for_check=True) # Add extensible items (available in komodo 9 and higher). if 'koIInterpolationService' in components.interfaces.keys(): interpolateSvc = components.classes["@activestate.com/koInterpolationService;1"].\ getService(components.interfaces.koIInterpolationService) try: interpolateSvc.addCode('go', self) except Exception: log.warn("Unable to add 'go' interpolation shortcut") def interpolationCallback(self, code, fileName, lineNum, word, selection, projectFile, prefs): if code == 'go': golangInfoEx = components.classes["@activestate.com/koAppInfoEx?app=Go;1"].\ getService(components.interfaces.koIAppInfoEx) return golangInfoEx.executablePath raise RuntimeError("Unexpected go code %r" % (code, )) def getLanguageService(self, iid): return KoLanguageBase.getLanguageService(self, iid) def get_lexer(self): if self._lexer is None: self._lexer = KoLexerLanguageService() self._lexer.setLexer(components.interfaces.ISciMoz.SCLEX_CPP) self._lexer.supportsFolding = 1 self._lexer.setProperty('lexer.cpp.allow.dollars', '0') self._lexer.setProperty('fold.cpp.syntax.based', '1') self._lexer.setProperty('lexer.cpp.backquoted.strings', '1') self._lexer.setKeywords(0, GoLangInfo.reserved_keywords) # The CPP lexer reserves keywords(2) for comment doc keywords and # keywords(3) for "SCE_C_GLOBALCLASS", so treat the # predeclared_identifiers (like 'bool') and # the predefined_functions (like 'append') as the same. other_words = (GoLangInfo.predeclared_identifiers.union( GoLangInfo.predeclared_functions)) self._lexer.setKeywords(1, other_words) return self._lexer
class koGoLanguage(KoLanguageBase, KoLanguageBaseDedentMixin): name = "Go" _reg_desc_ = "%s Language" % name _reg_contractid_ = "@activestate.com/koLanguage?language=%s;1" % (name) _reg_clsid_ = "{2d6ed8b6-f079-441a-8b5a-10ef781cb989}" _reg_categories_ = [("komodo-language", name)] # Copy the base interfaces. _com_interfaces_ = KoLanguageBase._com_interfaces_[:] # Add koIInterpolationCallback - but it's only available in version 9 and # above - so catch the exception for earlier versions. try: _com_interfaces_.append(components.interfaces.koIInterpolationCallback) except: log.warn("koIInterpolationCallback does not exist") modeNames = ["go"] primary = 1 internal = 0 accessKey = "g" defaultExtension = ".go" commentDelimiterInfo = {"line": ["//"], "block": [("/*", "*/")], "markup": "*"} _dedenting_statements = [u"goto", u"return", u"break", u"continue"] namedBlockRE = "^[ \t]*?(func\s+(?:\(.*?\)\s*)?\w|package\s+\w)" namedBlockDescription = "Go functions, methods and packages" supportsSmartIndent = "brace" # The following sample contains embedded tabs because that's the Go way. sample = r"""\ package commands import ( "encoding/json" ) type Filters []string func (f *Filters) String() string { a := "a string" b := 'c' // a char c := 43 // a num return fmt.Sprint(*f) } /* Block comment on these two lines */ """ def __init__(self): KoLanguageBase.__init__(self) self._style_info.update( _block_comment_styles=[ sci_constants.SCE_C_COMMENT, sci_constants.SCE_C_COMMENTDOC, sci_constants.SCE_C_COMMENTDOCKEYWORD, sci_constants.SCE_C_COMMENTDOCKEYWORDERROR, ], _variable_styles=[components.interfaces.ISciMoz.SCE_C_IDENTIFIER], ) self._setupIndentCheckSoftChar() self._fastCharData = FastCharData( trigger_char=";", style_list=(sci_constants.SCE_C_OPERATOR,), skippable_chars_by_style={sci_constants.SCE_C_OPERATOR: "])"}, for_check=True, ) # And add the new default prefs if they don't exist globalPrefs = ( components.classes["@activestate.com/koPrefService;1"] .getService(components.interfaces.koIPrefService) .prefs ) # Chunk adding prefs based on which ones they were added with. if not globalPrefs.hasPref("gocodeDefaultLocation"): globalPrefs.setStringPref("gocodeDefaultLocation", "") if not globalPrefs.hasPref("godefDefaultLocation"): globalPrefs.setStringPref("godefDefaultLocation", "") if not globalPrefs.hasPref("golangDefaultLocation"): globalPrefs.setStringPref("golangDefaultLocation", "") globalPrefs.setStringPref("Go/newEncoding", "utf-8") globalPrefs.setLongPref("Go/indentWidth", 8) globalPrefs.setBooleanPref("Go/useTabs", True) # Add the go formatter. if not globalPrefs.getBoolean("haveInstalledGoFormatter", False): if globalPrefs.hasPref("configuredFormatters"): formatters = globalPrefs.getPref("configuredFormatters") go_formatter_prefset = components.classes["@activestate.com/koPreferenceSet;1"].createInstance( components.interfaces.koIPreferenceSet ) uuid = "{cf500001-ec59-4047-86e7-369d257f4b80}" go_formatter_prefset.id = uuid go_formatter_prefset.setStringPref("lang", "Go") go_formatter_prefset.setStringPref("name", "GoFmt") go_formatter_prefset.setStringPref("uuid", uuid) go_formatter_prefset.setStringPref("formatter_name", "generic") args_prefset = components.classes["@activestate.com/koPreferenceSet;1"].createInstance( components.interfaces.koIPreferenceSet ) args_prefset.id = "genericFormatterPrefs" args_prefset.setStringPref("executable", "%(go)fmt") args_prefset.setStringPref("arguments", "-w=false") go_formatter_prefset.setPref("genericFormatterPrefs", args_prefset) formatters.appendString(uuid) globalPrefs.setPref(uuid, go_formatter_prefset) globalPrefs.setBoolean("haveInstalledGoFormatter", True) # Add extensible items (available in komodo 9 and higher). if "koIInterpolationService" in components.interfaces.keys(): interpolateSvc = components.classes["@activestate.com/koInterpolationService;1"].getService( components.interfaces.koIInterpolationService ) try: interpolateSvc.addCode("go", self) except Exception: log.warn("Unable to add 'go' interpolation shortcut") def interpolationCallback(self, code, fileName, lineNum, word, selection, projectFile, prefs): if code == "go": golangInfoEx = components.classes["@activestate.com/koAppInfoEx?app=Go;1"].getService( components.interfaces.koIAppInfoEx ) return golangInfoEx.executablePath raise RuntimeError("Unexpected go code %r" % (code,)) def getLanguageService(self, iid): return KoLanguageBase.getLanguageService(self, iid) def get_lexer(self): if self._lexer is None: self._lexer = KoLexerLanguageService() self._lexer.setLexer(components.interfaces.ISciMoz.SCLEX_CPP) self._lexer.supportsFolding = 1 self._lexer.setProperty("lexer.cpp.allow.dollars", "0") self._lexer.setProperty("fold.cpp.syntax.based", "1") self._lexer.setProperty("lexer.cpp.backquoted.strings", "1") self._lexer.setKeywords(0, GoLangInfo.reserved_keywords) # The CPP lexer reserves keywords(2) for comment doc keywords and # keywords(3) for "SCE_C_GLOBALCLASS", so treat the # predeclared_identifiers (like 'bool') and # the predefined_functions (like 'append') as the same. other_words = GoLangInfo.predeclared_identifiers.union(GoLangInfo.predeclared_functions) self._lexer.setKeywords(1, other_words) return self._lexer
class koGoLanguage(KoLanguageBase, KoLanguageBaseDedentMixin): name = "Go" _reg_desc_ = "%s Language" % name _reg_contractid_ = "@activestate.com/koLanguage?language=%s;1" % (name) _reg_clsid_ = "{2d6ed8b6-f079-441a-8b5a-10ef781cb989}" _reg_categories_ = [("komodo-language", name)] modeNames = ["go"] primary = 1 internal = 0 accessKey = "g" defaultExtension = ".go" commentDelimiterInfo = {"line": ["//"], "block": [("/*", "*/")], "markup": "*"} _dedenting_statements = [u"goto", u"return", u"break", u"continue"] namedBlockRE = "^[ \t]*?(func\s+(?:\(.*?\)\s*)?\w|package\s+\w)" namedBlockDescription = "Go functions, methods and packages" supportsSmartIndent = "brace" # The following sample contains embedded tabs because that's the Go way. sample = r"""\ package commands import ( "encoding/json" ) type Filters []string func (f *Filters) String() string { a := "a string" b := 'c' // a char c := 43 // a num return fmt.Sprint(*f) } /* Block comment on these two lines */ """ def __init__(self): KoLanguageBase.__init__(self) self._style_info.update( _block_comment_styles=[ sci_constants.SCE_C_COMMENT, sci_constants.SCE_C_COMMENTDOC, sci_constants.SCE_C_COMMENTDOCKEYWORD, sci_constants.SCE_C_COMMENTDOCKEYWORDERROR, ], _variable_styles=[components.interfaces.ISciMoz.SCE_C_IDENTIFIER], ) self._setupIndentCheckSoftChar() self._fastCharData = FastCharData( trigger_char=";", style_list=(sci_constants.SCE_C_OPERATOR,), skippable_chars_by_style={sci_constants.SCE_C_OPERATOR: "])"}, for_check=True, ) # And add the new default prefs if they don't exist globalPrefs = ( components.classes["@activestate.com/koPrefService;1"] .getService(components.interfaces.koIPrefService) .prefs ) # Chunk adding prefs based on which ones they were added with. if not globalPrefs.hasPref("gocodeDefaultLocation"): globalPrefs.setStringPref("gocodeDefaultLocation", "") if not globalPrefs.hasPref("godefDefaultLocation"): globalPrefs.setStringPref("godefDefaultLocation", "") if not globalPrefs.hasPref("golangDefaultLocation"): globalPrefs.setStringPref("golangDefaultLocation", "") globalPrefs.setStringPref("Go/newEncoding", "utf-8") globalPrefs.setLongPref("Go/indentWidth", 8) globalPrefs.setBooleanPref("Go/useTabs", True) # TODO: Add formatter prefs along the lines of: # <!-- Go formatter --> # <preference-set > # <string id="formatter_name">generic</string> # <string id="lang">Go</string> # <string id="name">Go Reformatter</string> # <string id="uuid">{286d5b45-a54e-4317-b3c8-da4dc35673a4}</string> # </preference-set> def getLanguageService(self, iid): return KoLanguageBase.getLanguageService(self, iid) def get_lexer(self): if self._lexer is None: self._lexer = KoLexerLanguageService() self._lexer.setLexer(components.interfaces.ISciMoz.SCLEX_CPP) self._lexer.supportsFolding = 1 self._lexer.setProperty("lexer.cpp.allow.dollars", "0") self._lexer.setProperty("fold.cpp.syntax.based", "1") self._lexer.setProperty("lexer.cpp.backquoted.strings", "1") self._lexer.setKeywords(0, GoLangInfo.reserved_keywords) # The CPP lexer reserves keywords(2) for comment doc keywords and # keywords(3) for "SCE_C_GLOBALCLASS", so treat the # predeclared_identifiers (like 'bool') and # the predefined_functions (like 'append') as the same. other_words = GoLangInfo.predeclared_identifiers.union(GoLangInfo.predeclared_functions) self._lexer.setKeywords(1, other_words) return self._lexer
class koHLSLLanguage(KoLanguageBase): name = "HLSL" _reg_desc_ = "%s Language" % name _reg_contractid_ = "@activestate.com/koLanguage?language=%s;1" \ % (name) _reg_clsid_ = "{fd0846b3-ff7f-41af-b324-179783084469}" _reg_categories_ = [("komodo-language", name)] primary = 0 defaultExtension = ".hlsl" commentDelimiterInfo = { "line": ["//"], "block": [("/*", "*/")], "markup": "*", } _dedenting_statements = [u'throw', u'return', u'break', u'continue'] _indenting_statements = [u'case'] searchURL = "http://www.google.com/search?q=hlsl+site%3Amicrosoft.com%2F+%W" # matches: # function name # name: function # name = function # class.prototype.name = function namedBlockDescription = 'HLSL functions and classes' namedBlockRE = r'^[ |\t]*?(?:([\w|\.|_]*?)\s*=\s*function|function\s*([\w|\_]*?)|([\w|\_]*?)\s*:\s*function).*?$' supportsSmartIndent = "brace" sample = """ float4 normal = mul(IN.Normal, ModelViewIT); normal.w = 0.0; normal = normalize(normal); float4 light = normalize(LightVec); float4 eye = float4(1.0, 1.0, 1.0, 0.0); float4 vhalf = normalize(light + eye); """ styleStdin = sci_constants.SCE_C_STDIN styleStdout = sci_constants.SCE_C_STDOUT styleStderr = sci_constants.SCE_C_STDERR def __init__(self): # Same as JavaScript's KoLanguageBase.__init__(self) self._style_info.update( _block_comment_styles=[ sci_constants.SCE_C_COMMENT, sci_constants.SCE_C_COMMENTDOC, sci_constants.SCE_C_COMMENTDOCKEYWORD, sci_constants.SCE_C_COMMENTDOCKEYWORDERROR ], _variable_styles=[sci_constants.SCE_C_IDENTIFIER]) self._setupIndentCheckSoftChar() def getVariableStyles(self): # Same as JavaScript's return self._style_info._variable_styles def get_lexer(self): if self._lexer is None: self._lexer = KoLexerLanguageService() self._lexer.setLexer(sci_constants.SCLEX_CPP) self._lexer.setKeywords(0, HLSLLangInfo.keywords) self._lexer.setProperty('fold.cpp.syntax.based', '1') self._lexer.supportsFolding = 1 return self._lexer
class koGoLanguage(KoLanguageBase, KoLanguageBaseDedentMixin): name = "Go" _reg_desc_ = "%s Language" % name _reg_contractid_ = "@activestate.com/koLanguage?language=%s;1" \ % (name) _reg_clsid_ = "{2d6ed8b6-f079-441a-8b5a-10ef781cb989}" _reg_categories_ = [("komodo-language", name)] # Copy the base interfaces. _com_interfaces_ = KoLanguageBase._com_interfaces_[:] # Add koIInterpolationCallback - but it's only available in version 9 and # above - so catch the exception for earlier versions. try: _com_interfaces_.append(components.interfaces.koIInterpolationCallback) except: log.warn("koIInterpolationCallback does not exist") modeNames = ['go'] primary = 1 internal = 0 accessKey = 'g' defaultExtension = ".go" commentDelimiterInfo = { "line": [ "//" ], "block": [ ("/*", "*/") ], "markup": "*", } _dedenting_statements = [u'goto', u'return', u'break', u'continue'] namedBlockRE = "^[ \t]*?(func\s+(?:\(.*?\)\s*)?\w|package\s+\w)" namedBlockDescription = 'Go functions, methods and packages' supportsSmartIndent = "brace" # The following sample contains embedded tabs because that's the Go way. sample = r"""\ package commands import ( "encoding/json" ) type Filters []string func (f *Filters) String() string { a := "a string" b := 'c' // a char c := 43 // a num return fmt.Sprint(*f) } /* Block comment on these two lines */ """ def __init__(self): KoLanguageBase.__init__(self) self._style_info.update( _block_comment_styles = [sci_constants.SCE_C_COMMENT, sci_constants.SCE_C_COMMENTDOC, sci_constants.SCE_C_COMMENTDOCKEYWORD, sci_constants.SCE_C_COMMENTDOCKEYWORDERROR], _variable_styles = [components.interfaces.ISciMoz.SCE_C_IDENTIFIER] ) self._setupIndentCheckSoftChar() self._fastCharData = \ FastCharData(trigger_char=";", style_list=(sci_constants.SCE_C_OPERATOR,), skippable_chars_by_style={ sci_constants.SCE_C_OPERATOR : "])",}, for_check=True) # Add extensible items (available in komodo 9 and higher). if 'koIInterpolationService' in components.interfaces.keys(): interpolateSvc = components.classes["@activestate.com/koInterpolationService;1"].\ getService(components.interfaces.koIInterpolationService) try: interpolateSvc.addCode('go', self) except Exception: log.warn("Unable to add 'go' interpolation shortcut") def interpolationCallback(self, code, fileName, lineNum, word, selection, projectFile, prefs): if code == 'go': golangInfoEx = components.classes["@activestate.com/koAppInfoEx?app=Go;1"].\ getService(components.interfaces.koIAppInfoEx) return golangInfoEx.executablePath raise RuntimeError("Unexpected go code %r" % (code, )) def getLanguageService(self, iid): return KoLanguageBase.getLanguageService(self, iid) def get_lexer(self): if self._lexer is None: self._lexer = KoLexerLanguageService() self._lexer.setLexer(components.interfaces.ISciMoz.SCLEX_CPP) self._lexer.supportsFolding = 1 self._lexer.setProperty('lexer.cpp.allow.dollars', '0') self._lexer.setProperty('fold.cpp.syntax.based', '1') self._lexer.setProperty('lexer.cpp.backquoted.strings', '1') self._lexer.setKeywords(0, GoLangInfo.reserved_keywords) # The CPP lexer reserves keywords(2) for comment doc keywords and # keywords(3) for "SCE_C_GLOBALCLASS", so treat the # predeclared_identifiers (like 'bool') and # the predefined_functions (like 'append') as the same. other_words = (GoLangInfo.predeclared_identifiers. union(GoLangInfo.predeclared_functions)) self._lexer.setKeywords(1, other_words) return self._lexer