C-6: ConnectorRuntime enforces capability_mask per operation.
READ-only ACs cannot invoke MUTATE operations (wipe, lock, retire).
C-7: AC validated against database (exists, active, not expired)
before connector invocation.
C-9: Delegated AC capability bounded by delegator's capability.
C-10: Command counter uses atomic SQL increment with limit check.
M-23: expire_stale() uses same atomic SQL pattern.
H-1: Sensitive credential fields hidden from repr/logs via repr=False.
H-2: Stub backend requires ALLOW_STUB_CREDENTIALS=true to activate.
H-3: Kerberos backend raises CredentialResolutionError instead of
returning stub ticket.
H-4: Chronicle INTENT emitted before execution, RESULT after.
H-5: device_id validated as UUID before Graph API URL interpolation.
H-8: ConnectorRuntime enforces governance for all connector invocations.
Signed-off-by: Tyler King <tking@guildhouse.dev>
77 lines
2.6 KiB
Python
77 lines
2.6 KiB
Python
"""
|
|
pygments.lexers.smithy
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Lexers for the Smithy IDL.
|
|
|
|
:copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
|
|
:license: BSD, see LICENSE for details.
|
|
"""
|
|
|
|
from pygments.lexer import RegexLexer, bygroups, words
|
|
from pygments.token import Text, Comment, Keyword, Name, String, \
|
|
Number, Whitespace, Punctuation
|
|
|
|
__all__ = ['SmithyLexer']
|
|
|
|
|
|
class SmithyLexer(RegexLexer):
|
|
"""
|
|
For Smithy IDL
|
|
"""
|
|
name = 'Smithy'
|
|
url = 'https://awslabs.github.io/smithy/'
|
|
filenames = ['*.smithy']
|
|
aliases = ['smithy']
|
|
version_added = '2.10'
|
|
|
|
unquoted = r'[A-Za-z0-9_\.#$-]+'
|
|
identifier = r"[A-Za-z0-9_\.#$-]+"
|
|
|
|
simple_shapes = (
|
|
'use', 'byte', 'short', 'integer', 'long', 'float', 'document',
|
|
'double', 'bigInteger', 'bigDecimal', 'boolean', 'blob', 'string',
|
|
'timestamp',
|
|
)
|
|
|
|
aggregate_shapes = (
|
|
'apply', 'list', 'map', 'set', 'structure', 'union', 'resource',
|
|
'operation', 'service', 'trait'
|
|
)
|
|
|
|
tokens = {
|
|
'root': [
|
|
(r'///.*$', Comment.Multiline),
|
|
(r'//.*$', Comment),
|
|
(r'@[0-9a-zA-Z\.#-]*', Name.Decorator),
|
|
(r'(=)', Name.Decorator),
|
|
(r'^(\$version)(:)(.+)',
|
|
bygroups(Keyword.Declaration, Name.Decorator, Name.Class)),
|
|
(r'^(namespace)(\s+' + identifier + r')\b',
|
|
bygroups(Keyword.Declaration, Name.Class)),
|
|
(words(simple_shapes,
|
|
prefix=r'^', suffix=r'(\s+' + identifier + r')\b'),
|
|
bygroups(Keyword.Declaration, Name.Class)),
|
|
(words(aggregate_shapes,
|
|
prefix=r'^', suffix=r'(\s+' + identifier + r')'),
|
|
bygroups(Keyword.Declaration, Name.Class)),
|
|
(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),
|
|
(identifier, Name.Variable.Class),
|
|
(r'\[', Text, "#push"),
|
|
(r'\]', Text, "#pop"),
|
|
(r'\(', Text, "#push"),
|
|
(r'\)', Text, "#pop"),
|
|
(r'\{', Text, "#push"),
|
|
(r'\}', Text, "#pop"),
|
|
(r'"{3}(\\\\|\n|\\")*"{3}', String.Doc),
|
|
(r'"(\\\\|\n|\\"|[^"])*"', String.Double),
|
|
(r"'(\\\\|\n|\\'|[^'])*'", String.Single),
|
|
(r'[:,]+', Punctuation),
|
|
(r'\s+', Whitespace),
|
|
]
|
|
}
|