summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authorMatth?us G. Chajdas <dev@anteru.net>2019-04-28 17:14:55 +0200
committerMatth?us G. Chajdas <dev@anteru.net>2019-04-28 17:14:55 +0200
commit075e65ed4e4424c121f7c70e0db9d2ff9e7895f8 (patch)
tree96a0258bb183c47904d10b61d478f51bd9916a64 /pygments
parent373d770eae7682a785fa3417f96979789199393d (diff)
downloadpygments-075e65ed4e4424c121f7c70e0db9d2ff9e7895f8.tar.gz
Add TOML example file and improve the lexer a bit.
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/configs.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/pygments/lexers/configs.py b/pygments/lexers/configs.py
index 7c9bd655..bf9cb0bb 100644
--- a/pygments/lexers/configs.py
+++ b/pygments/lexers/configs.py
@@ -894,12 +894,19 @@ class TOMLLexer(RegexLexer):
# Basics, comments, strings
(r'\s+', Text),
(r'#.*?$', Comment.Single),
+ # Basic string
(r'"(\\\\|\\"|[^"])*"', String),
+ # Literal string
+ (r'\'[^\']*\'', String),
(r'(true|false)$', Keyword.Constant),
('[a-zA-Z_][a-zA-Z0-9_\-]*', Name),
+ (r'\[.*?\]$', Keyword),
+
# Datetime
- (r'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z', Number.Integer),
+ # TODO this needs to be expanded, as TOML is rather flexible:
+ # https://github.com/toml-lang/toml#offset-date-time
+ (r'\d{4}-\d{2}-\d{2}(?:T| )\d{2}:\d{2}:\d{2}(?:Z|[-+]\d{2}:\d{2})', Number.Integer),
# Numbers
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float),