summaryrefslogtreecommitdiff
path: root/pygments/lexers/data.py
diff options
context:
space:
mode:
authorAnteru <bitbucket@ca.sh13.net>2019-04-30 15:52:31 +0000
committerAnteru <bitbucket@ca.sh13.net>2019-04-30 15:52:31 +0000
commit28a21bdafa1b73d5515de18bd263797af61c2471 (patch)
tree3436c730359d89153f04ef572368abfcde1d3fcb /pygments/lexers/data.py
parente3872ea8f65ac2c3c40046a7a3acf4f0541f0e56 (diff)
parent601e6e86e45f31e23a7b29e1265d68aeba5e1366 (diff)
downloadpygments-28a21bdafa1b73d5515de18bd263797af61c2471.tar.gz
Merged in andrescarrasco/pygments-main/boa (pull request #756)
Add a lexer for the Boa Domain-Specific Langauge.
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..7593b487 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