--- a/QScintilla/Lexers/__init__.py Thu Jan 12 19:26:13 2017 +0100 +++ b/QScintilla/Lexers/__init__.py Sat Jan 14 14:12:42 2017 +0100 @@ -112,6 +112,10 @@ "lexerLua.png"], "Makefile": [QCoreApplication.translate('Lexers', "Makefile"), 'dummy.mak', "lexerMakefile.png"], + "Matlab": [QCoreApplication.translate('Lexers', "Matlab"), + 'dummy.m.matlab', "lexerMatlab.png"], + "Octave": [QCoreApplication.translate('Lexers', "Octave"), + 'dummy.m.octave', "lexerOctave.png"], "Pascal": [QCoreApplication.translate('Lexers', "Pascal"), 'dummy.pas', "lexerPascal.png"], "Perl": [QCoreApplication.translate('Lexers', "Perl"), 'dummy.pl', @@ -144,14 +148,6 @@ "lexerYAML.png"], } - if QSCINTILLA_VERSION() >= 0x020501: - supportedLanguages.update({ - "Matlab": [QCoreApplication.translate('Lexers', "Matlab"), - 'dummy.m.matlab', "lexerMatlab.png"], - "Octave": [QCoreApplication.translate('Lexers', "Octave"), - 'dummy.m.octave', "lexerOctave.png"], - }) - if QSCINTILLA_VERSION() >= 0x020802: supportedLanguages["Gettext"] = \ [QCoreApplication.translate('Lexers', "Gettext"), 'dummy.po', @@ -162,6 +158,11 @@ [QCoreApplication.translate('Lexers', "CoffeeScript"), 'dummy.coffee', "lexerCoffeeScript.png"] + if QSCINTILLA_VERSION() >= 0x020a00: + supportedLanguages["JSON"] = \ + [QCoreApplication.translate('Lexers', "JSON"), + 'dummy.json', "lexerJSON.png"] + for name in LexerRegistry: if not name.startswith("Pygments|"): supportedLanguages[name] = \ @@ -319,6 +320,9 @@ elif language == "CoffeeScript": from .LexerCoffeeScript import LexerCoffeeScript return LexerCoffeeScript(parent) + elif language == "JSON": + from .LexerJSON import LexerJSON + return LexerJSON(parent) elif language in LexerRegistry: return LexerRegistry[language][2](parent) @@ -473,18 +477,14 @@ QCoreApplication.translate( 'Lexers', 'YAML Files (*.yaml *.yml)'), + QCoreApplication.translate( + 'Lexers', + 'Matlab Files (*.m *.m.matlab)'), + QCoreApplication.translate( + 'Lexers', + 'Octave Files (*.m *.m.octave)'), ] - if QSCINTILLA_VERSION() >= 0x020501: - openFileFiltersList.extend([ - QCoreApplication.translate( - 'Lexers', - 'Matlab Files (*.m *.m.matlab)'), - QCoreApplication.translate( - 'Lexers', - 'Octave Files (*.m *.m.octave)'), - ]) - if QSCINTILLA_VERSION() >= 0x020802: openFileFiltersList.append( QCoreApplication.translate( @@ -499,6 +499,13 @@ 'CoffeeScript Files (*.coffee)'), ) + if QSCINTILLA_VERSION() >= 0x020a00: + openFileFiltersList.append( + QCoreApplication.translate( + 'Lexers', + 'JSON Files (*.json)'), + ) + for name in LexerRegistry: openFileFiltersList.extend(LexerRegistry[name][3]) @@ -678,18 +685,14 @@ QCoreApplication.translate( 'Lexers', 'YAML Files (*.yml)'), + QCoreApplication.translate( + 'Lexers', + 'Matlab Files (*.m)'), + QCoreApplication.translate( + 'Lexers', + 'Octave Files (*.m.octave)'), ] - if QSCINTILLA_VERSION() >= 0x020501: - saveFileFiltersList.extend([ - QCoreApplication.translate( - 'Lexers', - 'Matlab Files (*.m)'), - QCoreApplication.translate( - 'Lexers', - 'Octave Files (*.m.octave)'), - ]) - if QSCINTILLA_VERSION() >= 0x020802: saveFileFiltersList.append( QCoreApplication.translate( @@ -704,6 +707,13 @@ 'CoffeeScript Files (*.coffee)'), ) + if QSCINTILLA_VERSION() >= 0x020a00: + saveFileFiltersList.append( + QCoreApplication.translate( + 'Lexers', + 'JSON Files (*.json)'), + ) + for name in LexerRegistry: saveFileFiltersList.extend(LexerRegistry[name][4]) @@ -827,6 +837,9 @@ "*.xul": "XML", "*.yaml": "YAML", "*.yml": "YAML", + '*.m': "Matlab", + '*.m.matlab': "Matlab", + '*.m.octave': "Octave", '*.e4d': "XML", '*.e4k': "XML", '*.e4m': "XML", @@ -850,16 +863,15 @@ '*.e6t': "XML", } - if QSCINTILLA_VERSION() >= 0x020501: - assocs.update({ - '*.m': "Matlab", - '*.m.matlab': "Matlab", - '*.m.octave': "Octave", - }) + if QSCINTILLA_VERSION() >= 0x020802: + assocs['*.po'] = "Gettext" if QSCINTILLA_VERSION() >= 0x020803: assocs['*.coffee'] = "CoffeeScript" + if QSCINTILLA_VERSION() >= 0x020a00: + assocs['*.json'] = "JSON" + for name in LexerRegistry: for pattern in LexerRegistry[name][5]: assocs[pattern] = name