943acbc573
Durcit la convention de nommage des projets (dérive constatée : 'Sliding Automation', 'code_versioning'... au lieu des formes canoniques). - trilium_api.py : projets_canoniques() lit le référentiel = valeurs du label projet sur les notes de type=projet (source unique, pas de constante en dur). Note-projet CodeVersioning créée (manquait). - mcp_server.py : _valider_projet() branché dans les 6 tools de création (add_decision/history/backlog, new_conversation, create_entite, add_skill). Refuse un projet non canonique (suggestion si faute) ou inconnu (renvoi au processus de création de projet). Ne verrouille pas si référentiel illisible. - lint_audit.py : VAL-nommage aligné sur le référentiel (attrape casse, espace ET snake_case ; l'ancien 'contient un espace' ratait code_versioning). - Données : 79 notes ré-étiquetées vers les 3 formes canoniques. Quality by design : l'erreur de nommage devient impossible à l'écriture, le Lint n'est plus que le filet de sécurité.
78 lines
2.6 KiB
Python
78 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),
|
|
]
|
|
}
|