summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-01-10 10:58:11 +0100
committerGeorg Brandl <georg@python.org>2014-01-10 10:58:11 +0100
commit235425acf143fdb6b5c6ad6b0711ff416d9c005e (patch)
tree84c739837b1879ec6ba82c0cefe8f411aba4f423
parent4a1bb02e0d644f50a009fefddb14b470d61ce870 (diff)
parent124cb233fdc3e9bde8c20e89de6e31c56c704eb1 (diff)
downloadpygments-235425acf143fdb6b5c6ad6b0711ff416d9c005e.tar.gz
merge with Igor enhancements from t-b/pygments-main/igor-pro-changes-v2 (pull request #250)
-rw-r--r--CHANGES3
-rw-r--r--pygments/lexers/math.py20
-rw-r--r--pygments/styles/__init__.py1
-rw-r--r--pygments/styles/igor.py29
4 files changed, 46 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index da842773..271c447d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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'
+ }