diff options
Diffstat (limited to 'pygments/lexers')
-rw-r--r-- | pygments/lexers/asm.py | 80 | ||||
-rw-r--r-- | pygments/lexers/inferno.py | 11 | ||||
-rw-r--r-- | pygments/lexers/math.py | 8 | ||||
-rw-r--r-- | pygments/lexers/other.py | 2 | ||||
-rw-r--r-- | pygments/lexers/rdf.py | 5 | ||||
-rw-r--r-- | pygments/lexers/templates.py | 10 | ||||
-rw-r--r-- | pygments/lexers/text.py | 20 | ||||
-rw-r--r-- | pygments/lexers/web.py | 10 |
8 files changed, 72 insertions, 74 deletions
diff --git a/pygments/lexers/asm.py b/pygments/lexers/asm.py index 2727a55d..fc361e2f 100644 --- a/pygments/lexers/asm.py +++ b/pygments/lexers/asm.py @@ -102,46 +102,46 @@ def _objdump_lexer_tokens(asm_lexer): """ hex_re = r'[0-9A-Za-z]' return { - 'root': [ - # File name & format: - ('(.*?)(:)( +file format )(.*?)$', - bygroups(Name.Label, Punctuation, Text, String)), - # Section header - ('(Disassembly of section )(.*?)(:)$', - bygroups(Text, Name.Label, Punctuation)), - # Function labels - # (With offset) - ('('+hex_re+'+)( )(<)(.*?)([-+])(0[xX][A-Za-z0-9]+)(>:)$', - bygroups(Number.Hex, Text, Punctuation, Name.Function, - Punctuation, Number.Hex, Punctuation)), - # (Without offset) - ('('+hex_re+'+)( )(<)(.*?)(>:)$', - bygroups(Number.Hex, Text, Punctuation, Name.Function, - Punctuation)), - # Code line with disassembled instructions - ('( *)('+hex_re+r'+:)(\t)((?:'+hex_re+hex_re+' )+)( *\t)([a-zA-Z].*?)$', - bygroups(Text, Name.Label, Text, Number.Hex, Text, - using(asm_lexer))), - # Code line with ascii - ('( *)('+hex_re+r'+:)(\t)((?:'+hex_re+hex_re+' )+)( *)(.*?)$', - bygroups(Text, Name.Label, Text, Number.Hex, Text, String)), - # Continued code line, only raw opcodes without disassembled - # instruction - ('( *)('+hex_re+r'+:)(\t)((?:'+hex_re+hex_re+' )+)$', - bygroups(Text, Name.Label, Text, Number.Hex)), - # Skipped a few bytes - (r'\t\.\.\.$', Text), - # Relocation line - # (With offset) - (r'(\t\t\t)('+hex_re+r'+:)( )([^\t]+)(\t)(.*?)([-+])(0x'+hex_re+'+)$', - bygroups(Text, Name.Label, Text, Name.Property, Text, - Name.Constant, Punctuation, Number.Hex)), - # (Without offset) - (r'(\t\t\t)('+hex_re+r'+:)( )([^\t]+)(\t)(.*?)$', - bygroups(Text, Name.Label, Text, Name.Property, Text, - Name.Constant)), - (r'[^\n]+\n', Other) - ] + 'root': [ + # File name & format: + ('(.*?)(:)( +file format )(.*?)$', + bygroups(Name.Label, Punctuation, Text, String)), + # Section header + ('(Disassembly of section )(.*?)(:)$', + bygroups(Text, Name.Label, Punctuation)), + # Function labels + # (With offset) + ('('+hex_re+'+)( )(<)(.*?)([-+])(0[xX][A-Za-z0-9]+)(>:)$', + bygroups(Number.Hex, Text, Punctuation, Name.Function, + Punctuation, Number.Hex, Punctuation)), + # (Without offset) + ('('+hex_re+'+)( )(<)(.*?)(>:)$', + bygroups(Number.Hex, Text, Punctuation, Name.Function, + Punctuation)), + # Code line with disassembled instructions + ('( *)('+hex_re+r'+:)(\t)((?:'+hex_re+hex_re+' )+)( *\t)([a-zA-Z].*?)$', + bygroups(Text, Name.Label, Text, Number.Hex, Text, + using(asm_lexer))), + # Code line with ascii + ('( *)('+hex_re+r'+:)(\t)((?:'+hex_re+hex_re+' )+)( *)(.*?)$', + bygroups(Text, Name.Label, Text, Number.Hex, Text, String)), + # Continued code line, only raw opcodes without disassembled + # instruction + ('( *)('+hex_re+r'+:)(\t)((?:'+hex_re+hex_re+' )+)$', + bygroups(Text, Name.Label, Text, Number.Hex)), + # Skipped a few bytes + (r'\t\.\.\.$', Text), + # Relocation line + # (With offset) + (r'(\t\t\t)('+hex_re+r'+:)( )([^\t]+)(\t)(.*?)([-+])(0x'+hex_re+'+)$', + bygroups(Text, Name.Label, Text, Name.Property, Text, + Name.Constant, Punctuation, Number.Hex)), + # (Without offset) + (r'(\t\t\t)('+hex_re+r'+:)( )([^\t]+)(\t)(.*?)$', + bygroups(Text, Name.Label, Text, Name.Property, Text, + Name.Constant)), + (r'[^\n]+\n', Other) + ] } diff --git a/pygments/lexers/inferno.py b/pygments/lexers/inferno.py index 16a7014b..56f02b98 100644 --- a/pygments/lexers/inferno.py +++ b/pygments/lexers/inferno.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ pygments.lexers.inferno - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~ Lexers for Inferno os and all the related stuff. @@ -11,12 +11,9 @@ import re -from pygments.lexer import RegexLexer, include, bygroups, using, \ - this, combined, ExtendedRegexLexer -from pygments.token import Error, Punctuation, Literal, Token, \ - Text, Comment, Operator, Keyword, Name, String, Number, Generic, \ - Whitespace -from pygments.util import get_bool_opt +from pygments.lexer import RegexLexer, include, bygroups +from pygments.token import Punctuation, Text, Comment, Operator, Keyword, \ + Name, String, Number __all__ = ['LimboLexer'] diff --git a/pygments/lexers/math.py b/pygments/lexers/math.py index c587ca93..cfbfc432 100644 --- a/pygments/lexers/math.py +++ b/pygments/lexers/math.py @@ -1051,7 +1051,7 @@ class SLexer(RegexLexer): mimetypes = ['text/S-plus', 'text/S', 'text/x-r-source', 'text/x-r', 'text/x-R', 'text/x-r-history', 'text/x-r-profile'] - builtins_base = [ + builtins_base = [ 'Arg', 'Conj', 'Cstack_info', 'Encoding', 'FALSE', 'Filter', 'Find', 'I', 'ISOdate', 'ISOdatetime', 'Im', 'Inf', 'La\.svd', 'Map', 'Math\.Date', 'Math\.POSIXt', 'Math\.data\.frame', @@ -1171,8 +1171,8 @@ class SLexer(RegexLexer): 'getNativeSymbolInfo', 'getOption', 'getRversion', 'getSrcLines', 'getTaskCallbackNames', 'geterrmessage', 'gettext', 'gettextf', 'getwd', 'gl', 'globalenv', 'gregexpr', 'grep', 'grepRaw', 'grepl', - 'gsub', 'gzcon', 'gzfile', 'head', 'iconv', 'iconvlist', - 'icuSetCollate', 'identical', 'identity', 'ifelse', 'importIntoEnv', + 'gsub', 'gzcon', 'gzfile', 'head', 'iconv', 'iconvlist', + 'icuSetCollate', 'identical', 'identity', 'ifelse', 'importIntoEnv', 'in', 'inherits', 'intToBits', 'intToUtf8', 'interaction', 'interactive', 'intersect', 'inverse\.rle', 'invisible', 'invokeRestart', 'invokeRestartInteractively', 'is\.R', 'is\.array', 'is\.atomic', @@ -1317,7 +1317,7 @@ class SLexer(RegexLexer): 'keywords': [ (r'(' + r'|'.join(builtins_base) + r')' r'(?![\w\. =])', - Keyword.Pseudo), + Keyword.Pseudo), (r'(if|else|for|while|repeat|in|next|break|return|switch|function)' r'(?![\w\.])', Keyword.Reserved), diff --git a/pygments/lexers/other.py b/pygments/lexers/other.py index ddfe645c..c308c884 100644 --- a/pygments/lexers/other.py +++ b/pygments/lexers/other.py @@ -4030,7 +4030,7 @@ class PawnLexer(RegexLexer): """ For Pawn source code """ - + name = 'Pawn' aliases = ['pawn'] filenames = ['*.p', '*.pwn', '*.inc'] diff --git a/pygments/lexers/rdf.py b/pygments/lexers/rdf.py index bd3c06c1..f270cf44 100644 --- a/pygments/lexers/rdf.py +++ b/pygments/lexers/rdf.py @@ -5,12 +5,13 @@ Lexers for semantic web and RDF query languages and markup. - :copyright: Copyright 2012-2014 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ + import re -from pygments.lexer import RegexLexer, include, this, bygroups, include +from pygments.lexer import RegexLexer, bygroups from pygments.token import Keyword, Punctuation, String, Number, Operator, \ Whitespace, Name, Literal, Comment, Text diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py index a2de2f9c..d06ea288 100644 --- a/pygments/lexers/templates.py +++ b/pygments/lexers/templates.py @@ -36,9 +36,9 @@ __all__ = ['HtmlPhpLexer', 'XmlPhpLexer', 'CssPhpLexer', 'MakoCssLexer', 'JspLexer', 'CheetahLexer', 'CheetahHtmlLexer', 'CheetahXmlLexer', 'CheetahJavascriptLexer', 'EvoqueLexer', 'EvoqueHtmlLexer', 'EvoqueXmlLexer', 'ColdfusionLexer', - 'ColdfusionHtmlLexer', 'ColdfusionCFCLexer', 'VelocityLexer', - 'VelocityHtmlLexer', 'VelocityXmlLexer', 'SspLexer', - 'TeaTemplateLexer', 'LassoHtmlLexer', 'LassoXmlLexer', + 'ColdfusionHtmlLexer', 'ColdfusionCFCLexer', 'VelocityLexer', + 'VelocityHtmlLexer', 'VelocityXmlLexer', 'SspLexer', + 'TeaTemplateLexer', 'LassoHtmlLexer', 'LassoXmlLexer', 'LassoCssLexer', 'LassoJavascriptLexer', 'HandlebarsLexer', 'HandlebarsHtmlLexer'] @@ -1791,7 +1791,7 @@ class HandlebarsLexer(RegexLexer): (r'\}\}', Comment.Preproc, '#pop'), # Handlebars - (r'([\#/]*)(each|if|unless|else|with|log|in)', bygroups(Keyword, + (r'([\#/]*)(each|if|unless|else|with|log|in)', bygroups(Keyword, Keyword)), # General {{#block}} @@ -1813,7 +1813,7 @@ class HandlebarsLexer(RegexLexer): class HandlebarsHtmlLexer(DelegatingLexer): """ - Subclass of the `HandlebarsLexer` that highlights unlexed data with the + Subclass of the `HandlebarsLexer` that highlights unlexed data with the `HtmlLexer`. """ diff --git a/pygments/lexers/text.py b/pygments/lexers/text.py index c0679aa6..db3200b3 100644 --- a/pygments/lexers/text.py +++ b/pygments/lexers/text.py @@ -1919,7 +1919,7 @@ class TodotxtLexer(RegexLexer): .. versionadded:: 2.0 """ - + name = 'Todotxt' aliases = ['todotxt'] # *.todotxt is not a standard extension for Todo.txt files; including it @@ -1929,31 +1929,31 @@ class TodotxtLexer(RegexLexer): ## Aliases mapping standard token types of Todo.txt format concepts CompleteTaskText = Operator # Chosen to de-emphasize complete tasks - IncompleteTaskText = Text # Incomplete tasks should look like plain text - + IncompleteTaskText = Text # Incomplete tasks should look like plain text + # Priority should have most emphasis to indicate importance of tasks Priority = Generic.Heading # Dates should have next most emphasis because time is important Date = Generic.Subheading - + # Project and context should have equal weight, and be in different colors - Project = Generic.Error + Project = Generic.Error Context = String - + # If tag functionality is added, it should have the same weight as Project # and Context, and a different color. Generic.Traceback would work well. # Regex patterns for building up rules; dates, priorities, projects, and # contexts are all atomic # TODO: Make date regex more ISO 8601 compliant - date_regex = r'\d{4,}-\d{2}-\d{2}' + date_regex = r'\d{4,}-\d{2}-\d{2}' priority_regex = r'\([A-Z]\)' project_regex = r'\+\S+' context_regex = r'@\S+' # Compound regex expressions complete_one_date_regex = r'(x )(' + date_regex + r')' - complete_two_date_regex = (complete_one_date_regex + r'( )(' + + complete_two_date_regex = (complete_one_date_regex + r'( )(' + date_regex + r')') priority_date_regex = r'(' + priority_regex + r')( )(' + date_regex + r')' @@ -1968,7 +1968,7 @@ class TodotxtLexer(RegexLexer): # 2. Complete task with one date (complete_one_date_regex, bygroups(CompleteTaskText, Date), 'complete'), - + ## Incomplete task entry points: six total: # 1. Priority plus date (priority_date_regex, bygroups(Priority, IncompleteTaskText, Date), @@ -1984,7 +1984,7 @@ class TodotxtLexer(RegexLexer): # 6. Non-whitespace catch-all ('\S+', IncompleteTaskText, 'incomplete'), ], - + # Parse a complete task 'complete': [ # Newline indicates end of task, should return to root diff --git a/pygments/lexers/web.py b/pygments/lexers/web.py index f388f611..f8c89204 100644 --- a/pygments/lexers/web.py +++ b/pygments/lexers/web.py @@ -4262,12 +4262,12 @@ class MaskLexer(RegexLexer): 'string-base': [ (r'\\.', String.Escape), (r'~\[', String.Interpol, 'interpolation'), - (r'.', String.Single), + (r'.', String.Single), ], 'string-single':[ (r"'", String.Single, '#pop'), include('string-base') - ], + ], 'string-double':[ (r'"', String.Single, '#pop'), include('string-base') @@ -4288,7 +4288,7 @@ class MaskLexer(RegexLexer): ], 'expression': [ (r'[^\]]+', using(JavascriptLexer), '#pop') - ], + ], 'node': [ (r'\s+', Text), (r'\.', Name.Variable.Class, 'node-class'), @@ -4297,7 +4297,7 @@ class MaskLexer(RegexLexer): (r'[\w_:-]+[ \t]*=', Name.Attribute, 'node-attr-value'), (r'[\w_:-]+', Name.Attribute), (r'[>{;]', Punctuation, '#pop') - ], + ], 'node-class': [ (r'[\w-]+', Name.Variable.Class), (r'~\[', String.Interpol, 'interpolation'), @@ -4335,7 +4335,7 @@ class MaskLexer(RegexLexer): include('css-base'), (r'"', String.Single, '#pop:2'), (r"[^;\"]+", Name.Entity) - ], + ], 'string-single-pop2':[ (r"'", String.Single, '#pop:2'), include('string-base') |