summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authorMatthäus G. Chajdas <dev@anteru.net>2022-12-31 16:29:56 +0100
committerMatthäus G. Chajdas <dev@anteru.net>2022-12-31 16:38:28 +0100
commitdd52102c38ebe78cd57748e09f38929fd283ad04 (patch)
tree4483b20252f0955d14c843927763fc62be2a7d9c /pygments
parent92b77b268178721b69531113afd933d1900984d3 (diff)
downloadpygments-git-dd52102c38ebe78cd57748e09f38929fd283ad04.tar.gz
Improve the Smithy metadata matcher.
Previously, metadata foo bar baz = 23 was accepted, but according to the definition https://smithy.io/2.0/spec/idl.html#grammar-token-smithy-MetadataSection it should be "metadata"<whitespace>Identifier/String<optional whitespace>.
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/smithy.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pygments/lexers/smithy.py b/pygments/lexers/smithy.py
index 5f2f76cd..69b576e4 100644
--- a/pygments/lexers/smithy.py
+++ b/pygments/lexers/smithy.py
@@ -56,8 +56,9 @@ class SmithyLexer(RegexLexer):
(words(aggregate_shapes,
prefix=r'^', suffix=r'(\s+' + identifier + r')'),
bygroups(Keyword.Declaration, Name.Class)),
- (r'^(metadata)(\s+.+)(\s*)(=)',
- bygroups(Keyword.Declaration, Name.Class, Whitespace, Name.Decorator)),
+ (r'^(metadata)(\s+)((?:\S+)|(?:\"[^"]+\"))(\s*)(=)',
+ bygroups(Keyword.Declaration, Whitespace, Name.Class,
+ Whitespace, Name.Decorator)),
(r"(true|false|null)", Keyword.Constant),
(r"(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)", Number),
(identifier + ":", Name.Label),