diff options
| author | Matthäus G. Chajdas <dev@anteru.net> | 2022-12-31 16:29:56 +0100 |
|---|---|---|
| committer | Matthäus G. Chajdas <dev@anteru.net> | 2022-12-31 16:38:28 +0100 |
| commit | dd52102c38ebe78cd57748e09f38929fd283ad04 (patch) | |
| tree | 4483b20252f0955d14c843927763fc62be2a7d9c /pygments | |
| parent | 92b77b268178721b69531113afd933d1900984d3 (diff) | |
| download | pygments-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.py | 5 |
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), |
