summaryrefslogtreecommitdiff
path: root/pygments/lexers/data.py
diff options
context:
space:
mode:
authorAnteru <bitbucket@ca.sh13.net>2018-12-13 19:16:45 +0000
committerAnteru <bitbucket@ca.sh13.net>2018-12-13 19:16:45 +0000
commit556880c5ebdcfc9b05c599d92ee78dc20dfbd396 (patch)
treee9bd357ba79c132d0c3ef5905813fa8e9b4f4762 /pygments/lexers/data.py
parent2934045c9ea5c20870f913e2d03f62a3a757d1be (diff)
parente3d894c5b82644ca248f8840638cb48017080e8e (diff)
downloadpygments-556880c5ebdcfc9b05c599d92ee78dc20dfbd396.tar.gz
Merged in takenobu-hs/pygments-main/lexer-haskell-modify (pull request #745)
Fix Haskell lexer for numeric literals.
Diffstat (limited to 'pygments/lexers/data.py')
-rw-r--r--pygments/lexers/data.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/pygments/lexers/data.py b/pygments/lexers/data.py
index 296366c2..a67d084e 100644
--- a/pygments/lexers/data.py
+++ b/pygments/lexers/data.py
@@ -205,7 +205,7 @@ class YamlLexer(ExtendedRegexLexer):
bygroups(Text, Number), 'ignored-line'),
],
- # the %YAG directive
+ # the %TAG directive
'tag-directive': [
# a tag handle and the corresponding prefix
(r'([ ]+)(!|![\w-]*!)'
@@ -218,7 +218,7 @@ class YamlLexer(ExtendedRegexLexer):
'indentation': [
# trailing whitespaces are ignored
(r'[ ]*$', something(Text), '#pop:2'),
- # whitespaces preceeding block collection indicators
+ # whitespaces preceding block collection indicators
(r'[ ]+(?=[?:-](?:[ ]|$))', save_indent(Text)),
# block collection indicators
(r'[?:-](?=[ ]|$)', set_indent(Punctuation.Indicator)),
@@ -232,6 +232,9 @@ class YamlLexer(ExtendedRegexLexer):
(r'[ ]*(?=#|$)', something(Text), '#pop'),
# whitespaces separating tokens
(r'[ ]+', Text),
+ # key with colon
+ (r'([^,:?\[\]{}\n]+)(:)(?=[ ]|$)',
+ bygroups(Name.Tag, set_indent(Punctuation, implicit=True))),
# tags, anchors and aliases,
include('descriptors'),
# block collections and scalars
@@ -250,7 +253,7 @@ class YamlLexer(ExtendedRegexLexer):
(r'!<[\w#;/?:@&=+$,.!~*\'()\[\]%-]+>', Keyword.Type),
# a tag in the form '!', '!suffix' or '!handle!suffix'
(r'!(?:[\w-]+!)?'
- r'[\w#;/?:@&=+$,.!~*\'()\[\]%-]+', Keyword.Type),
+ r'[\w#;/?:@&=+$,.!~*\'()\[\]%-]*', Keyword.Type),
# an anchor
(r'&[\w-]+', Name.Label),
# an alias
@@ -308,6 +311,9 @@ class YamlLexer(ExtendedRegexLexer):
# a flow mapping indicated by '{' and '}'
'flow-mapping': [
+ # key with colon
+ (r'([^,:?\[\]{}\n]+)(:)(?=[ ]|$)',
+ bygroups(Name.Tag, Punctuation)),
# include flow collection rules
include('flow-collection'),
# the closing indicator