diff options
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | pygments/lexers/math.py | 20 | ||||
-rw-r--r-- | pygments/styles/__init__.py | 1 | ||||
-rw-r--r-- | pygments/styles/igor.py | 29 |
4 files changed, 46 insertions, 7 deletions
@@ -31,6 +31,9 @@ Version 1.7 * Kal (PR#233) * Eiffel (PR#273) +- New styles: "xcode" and "igor", similar to the default highlighting of + the respective IDEs. + - Lexer aliases passed to ``get_lexer_by_name()`` are now case-insensitive. - File name matching in lexers and formatters will now use a regex cache diff --git a/pygments/lexers/math.py b/pygments/lexers/math.py index e7585345..93c7cbd6 100644 --- a/pygments/lexers/math.py +++ b/pygments/lexers/math.py @@ -1675,18 +1675,22 @@ class IgorLexer(RegexLexer): filenames = ['*.ipf'] mimetypes = ['text/ipf'] - flags = re.IGNORECASE + flags = re.IGNORECASE | re.MULTILINE flowControl = [ 'if', 'else', 'elseif', 'endif', 'for', 'endfor', 'strswitch', 'switch', - 'case', 'endswitch', 'do', 'while', 'try', 'catch', 'endtry', 'break', - 'continue', 'return', + 'case', 'default', 'endswitch', 'do', 'while', 'try', 'catch', 'endtry', + 'break', 'continue', 'return', ] types = [ 'variable', 'string', 'constant', 'strconstant', 'NVAR', 'SVAR', 'WAVE', - 'STRUCT', 'ThreadSafe', 'function', 'end', 'static', 'macro', 'window', - 'graph', 'Structure', 'EndStructure', 'EndMacro', 'FuncFit', 'Proc', - 'Picture', 'Menu', 'SubMenu', 'Prompt', 'DoPrompt', + 'STRUCT', 'dfref' + ] + keywords = [ + 'override', 'ThreadSafe', 'static', 'FuncFit', 'Proc', 'Picture', + 'Prompt', 'DoPrompt', 'macro', 'window', 'graph', 'function', 'end', + 'Structure', 'EndStructure', 'EndMacro', 'Menu', 'SubMenu', 'Prompt', + 'DoPrompt', ] operations = [ 'Abort', 'AddFIFOData', 'AddFIFOVectData', 'AddMovieAudio', @@ -1906,6 +1910,8 @@ class IgorLexer(RegexLexer): (r'\b(%s)\b' % '|'.join(flowControl), Keyword), # Types. (r'\b(%s)\b' % '|'.join(types), Keyword.Type), + # Keywords. + (r'\b(%s)\b' % '|'.join(keywords), Keyword.Reserved), # Built-in operations. (r'\b(%s)\b' % '|'.join(operations), Name.Class), # Built-in functions. @@ -1913,7 +1919,7 @@ class IgorLexer(RegexLexer): # Compiler directives. (r'^#(include|pragma|define|ifdef|ifndef|endif)', Name.Decorator), - (r'[^a-zA-Z"/]+', Text), + (r'[^a-zA-Z"/]+$', Text), (r'.', Text), ], } diff --git a/pygments/styles/__init__.py b/pygments/styles/__init__.py index 20f88574..04c2e70a 100644 --- a/pygments/styles/__init__.py +++ b/pygments/styles/__init__.py @@ -35,6 +35,7 @@ STYLE_MAP = { 'tango': 'tango::TangoStyle', 'rrt': 'rrt::RrtStyle', 'xcode': 'xcode::XcodeStyle', + 'igor': 'igor::IgorStyle', } diff --git a/pygments/styles/igor.py b/pygments/styles/igor.py new file mode 100644 index 00000000..05dae1bc --- /dev/null +++ b/pygments/styles/igor.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +""" + pygments.styles.igor + ~~~~~~~~~~~~~~~~~~~~ + + Igor Pro default style. + + :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.style import Style +from pygments.token import Keyword, Name, Comment, String + + +class IgorStyle(Style): + """ + Pygments version of the official colors for Igor Pro procedures. + """ + default_style = "" + + styles = { + Comment: 'italic #FF0000', + Keyword: '#0000FF', + Name.Function: '#C34E00', + Name.Decorator: '#CC00A3', + Name.Class: '#007575', + String: '#009C00' + } |