pygments.rb 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lexers
CHANGED
Binary file
|
data/lib/pygments/version.rb
CHANGED
@@ -14,7 +14,7 @@ from pygments.lexer import RegexLexer, include, bygroups, using, DelegatingLexer
|
|
14
14
|
from pygments.token import Text, Name, Number, String, Comment, Punctuation, \
|
15
15
|
Other, Keyword, Operator, Literal
|
16
16
|
|
17
|
-
__all__ = ['Dasm16Lexer', 'PuppetLexer', 'AugeasLexer']
|
17
|
+
__all__ = ['Dasm16Lexer', 'PuppetLexer', 'AugeasLexer', "TOMLLexer"]
|
18
18
|
|
19
19
|
class Dasm16Lexer(RegexLexer):
|
20
20
|
"""
|
@@ -360,3 +360,42 @@ class AugeasLexer(RegexLexer):
|
|
360
360
|
(r'[\*\)]', Comment.Multiline)
|
361
361
|
],
|
362
362
|
}
|
363
|
+
|
364
|
+
class TOMLLexer(RegexLexer):
|
365
|
+
"""
|
366
|
+
Lexer for TOML, a simple language for config files
|
367
|
+
"""
|
368
|
+
|
369
|
+
name = 'TOML'
|
370
|
+
aliases = ['toml']
|
371
|
+
filenames = ['*.toml']
|
372
|
+
|
373
|
+
tokens = {
|
374
|
+
'root': [
|
375
|
+
|
376
|
+
# Basics, comments, strings
|
377
|
+
(r'\s+', Text),
|
378
|
+
(r'#.*?$', Comment.Single),
|
379
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
380
|
+
(r'(true|false)$', Keyword.Constant),
|
381
|
+
('[a-zA-Z_][a-zA-Z0-9_\-]*', Name),
|
382
|
+
|
383
|
+
# Datetime
|
384
|
+
(r'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z', Number.Integer),
|
385
|
+
|
386
|
+
# Numbers
|
387
|
+
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float),
|
388
|
+
(r'\d+[eE][+-]?[0-9]+j?', Number.Float),
|
389
|
+
(r'\-?\d+', Number.Integer),
|
390
|
+
|
391
|
+
# Punctuation
|
392
|
+
(r'[]{}:(),;[]', Punctuation),
|
393
|
+
(r'\.', Punctuation),
|
394
|
+
|
395
|
+
# Operators
|
396
|
+
(r'=', Operator)
|
397
|
+
|
398
|
+
]
|
399
|
+
}
|
400
|
+
|
401
|
+
|
@@ -273,6 +273,7 @@ LEXERS = {
|
|
273
273
|
'SspLexer': ('pygments.lexers.templates', 'Scalate Server Page', ('ssp',), ('*.ssp',), ('application/x-ssp',)),
|
274
274
|
'StanLexer': ('pygments.lexers.math', 'Stan', ('stan',), ('*.stan',), ()),
|
275
275
|
'SystemVerilogLexer': ('pygments.lexers.hdl', 'systemverilog', ('systemverilog', 'sv'), ('*.sv', '*.svh'), ('text/x-systemverilog',)),
|
276
|
+
'TOMLLexer': ('pygments.lexers.github', 'TOML', ('toml',), ('*.toml',), ()),
|
276
277
|
'TclLexer': ('pygments.lexers.agile', 'Tcl', ('tcl',), ('*.tcl',), ('text/x-tcl', 'text/x-script.tcl', 'application/x-tcl')),
|
277
278
|
'TcshLexer': ('pygments.lexers.shell', 'Tcsh', ('tcsh', 'csh'), ('*.tcsh', '*.csh'), ('application/x-csh',)),
|
278
279
|
'TeaTemplateLexer': ('pygments.lexers.templates', 'Tea', ('tea',), ('*.tea',), ('text/x-tea',)),
|
@@ -14,7 +14,7 @@ from pygments.lexer import RegexLexer, include, bygroups, using, DelegatingLexer
|
|
14
14
|
from pygments.token import Text, Name, Number, String, Comment, Punctuation, \
|
15
15
|
Other, Keyword, Operator, Literal
|
16
16
|
|
17
|
-
__all__ = ['Dasm16Lexer', 'PuppetLexer', 'AugeasLexer']
|
17
|
+
__all__ = ['Dasm16Lexer', 'PuppetLexer', 'AugeasLexer', "TOMLLexer"]
|
18
18
|
|
19
19
|
class Dasm16Lexer(RegexLexer):
|
20
20
|
"""
|
@@ -360,3 +360,42 @@ class AugeasLexer(RegexLexer):
|
|
360
360
|
(r'[\*\)]', Comment.Multiline)
|
361
361
|
],
|
362
362
|
}
|
363
|
+
|
364
|
+
class TOMLLexer(RegexLexer):
|
365
|
+
"""
|
366
|
+
Lexer for TOML, a simple language for config files
|
367
|
+
"""
|
368
|
+
|
369
|
+
name = 'TOML'
|
370
|
+
aliases = ['toml']
|
371
|
+
filenames = ['*.toml']
|
372
|
+
|
373
|
+
tokens = {
|
374
|
+
'root': [
|
375
|
+
|
376
|
+
# Basics, comments, strings
|
377
|
+
(r'\s+', Text),
|
378
|
+
(r'#.*?$', Comment.Single),
|
379
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
380
|
+
(r'(true|false)$', Keyword.Constant),
|
381
|
+
('[a-zA-Z_][a-zA-Z0-9_\-]*', Name),
|
382
|
+
|
383
|
+
# Datetime
|
384
|
+
(r'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z', Number.Integer),
|
385
|
+
|
386
|
+
# Numbers
|
387
|
+
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float),
|
388
|
+
(r'\d+[eE][+-]?[0-9]+j?', Number.Float),
|
389
|
+
(r'\-?\d+', Number.Integer),
|
390
|
+
|
391
|
+
# Punctuation
|
392
|
+
(r'[]{}:(),;[]', Punctuation),
|
393
|
+
(r'\.', Punctuation),
|
394
|
+
|
395
|
+
# Operators
|
396
|
+
(r'=', Operator)
|
397
|
+
|
398
|
+
]
|
399
|
+
}
|
400
|
+
|
401
|
+
|