feat: ж/д слой + cant_swim в скоринг + профили вне модели
Определение специфических рекомендаций (матрица профилей §8):
1. Ж/д слой (закрыт мёртвый railway ×2.5 у РАС):
- /api/v1/water/{case_id} отдаёт railway=rail как LineString
(без service/industrial/military веток), кэш общий v2;
- railway_warning «перекрыть/проверить немедленно» по профилям;
- SearchMap: Polyline слой ж/д (тёмно-красный), счётчики 💧/🚂.
2. cant_swim → профиль не_умеет_плавать (water ×3.0, без изменения
радиуса, critical_warning «обследовать водоёмы НЕМЕДЛЕННО»):
- раньше чекбокс влиял только на текст, в скоринге был пробел;
- derive в analyze._derive_profiles — работает и для closed_cases.
3. unmodeled_profiles: ДЦП/слабое зрение/слух — честная пометка
«вне поведенческой модели» с пояснением (vector_tasks B12:
профили без аналога не выдавать за учтённые); блок на фронте
в карточке здоровья.
Площадь воды: сферический эксцесс, проверен на квадрате 53° (744017 м²
vs 743272 точного). Тесты: 202 passed (новый test_cant_swim_profile).
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
"""
|
||||
pygments.lexers.verification
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Lexer for Intermediate Verification Languages (IVLs).
|
||||
|
||||
:copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
from pygments.lexer import RegexLexer, include, words
|
||||
from pygments.token import Comment, Operator, Keyword, Name, Number, \
|
||||
Punctuation, Text, Generic
|
||||
|
||||
__all__ = ['BoogieLexer', 'SilverLexer']
|
||||
|
||||
|
||||
class BoogieLexer(RegexLexer):
|
||||
"""
|
||||
For Boogie source code.
|
||||
"""
|
||||
name = 'Boogie'
|
||||
url = 'https://github.com/boogie-org/boogie/blob/master/Source/Core/BoogiePL.atg'
|
||||
aliases = ['boogie']
|
||||
filenames = ['*.bpl']
|
||||
version_added = '2.1'
|
||||
|
||||
tokens = {
|
||||
'root': [
|
||||
# Whitespace and Comments
|
||||
(r'\n', Text),
|
||||
(r'\s+', Text),
|
||||
(r'\\\n', Text), # line continuation
|
||||
(r'//[/!](.*?)\n', Comment.Doc),
|
||||
(r'//(.*?)\n', Comment.Single),
|
||||
(r'/\*', Comment.Multiline, 'comment'),
|
||||
|
||||
(words((
|
||||
'action', 'assert', 'asserts', 'assume', 'async', 'atomic',
|
||||
'axiom', 'break', 'call', 'else', 'ensures', 'exists',
|
||||
'false', 'forall', 'free', 'function', 'goto', 'havoc', 'if',
|
||||
'implementation', 'invariant', 'lambda', 'left', 'measure', 'modifies',
|
||||
'old', 'preserves', 'procedure', 'public', 'requires', 'return', 'returns',
|
||||
'right', 'then', 'true', 'type', 'unique', 'var', 'while', 'yield'),
|
||||
suffix=r'\b'), Keyword),
|
||||
(words(('const',), suffix=r'\b'), Keyword.Reserved),
|
||||
|
||||
(words(('bool', 'int', 'real', 'ref'), suffix=r'\b'), Keyword.Type),
|
||||
include('numbers'),
|
||||
(r"(>=|<=|:=|!=|==>|&&|\|\||[+/\-=>*<\[\]])", Operator),
|
||||
(r'\{.*?\}', Generic.Emph), #triggers
|
||||
(r"([{}():;,.])", Punctuation),
|
||||
# Identifier
|
||||
(r'[a-zA-Z_]\w*', Name),
|
||||
],
|
||||
'comment': [
|
||||
(r'[^*/]+', Comment.Multiline),
|
||||
(r'/\*', Comment.Multiline, '#push'),
|
||||
(r'\*/', Comment.Multiline, '#pop'),
|
||||
(r'[*/]', Comment.Multiline),
|
||||
],
|
||||
'numbers': [
|
||||
(r'[0-9]+', Number.Integer),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
class SilverLexer(RegexLexer):
|
||||
"""
|
||||
For Silver source code.
|
||||
"""
|
||||
name = 'Silver'
|
||||
aliases = ['silver']
|
||||
filenames = ['*.sil', '*.vpr']
|
||||
url = 'https://github.com/viperproject/silver'
|
||||
version_added = '2.2'
|
||||
|
||||
tokens = {
|
||||
'root': [
|
||||
# Whitespace and Comments
|
||||
(r'\n', Text),
|
||||
(r'\s+', Text),
|
||||
(r'\\\n', Text), # line continuation
|
||||
(r'//[/!](.*?)\n', Comment.Doc),
|
||||
(r'//(.*?)\n', Comment.Single),
|
||||
(r'/\*', Comment.Multiline, 'comment'),
|
||||
|
||||
(words((
|
||||
'result', 'true', 'false', 'null', 'method', 'function',
|
||||
'predicate', 'program', 'domain', 'axiom', 'var', 'returns',
|
||||
'field', 'define', 'fold', 'unfold', 'inhale', 'exhale', 'new', 'assert',
|
||||
'assume', 'goto', 'while', 'if', 'elseif', 'else', 'fresh',
|
||||
'constraining', 'Seq', 'Set', 'Multiset', 'union', 'intersection',
|
||||
'setminus', 'subset', 'unfolding', 'in', 'old', 'forall', 'exists',
|
||||
'acc', 'wildcard', 'write', 'none', 'epsilon', 'perm', 'unique',
|
||||
'apply', 'package', 'folding', 'label', 'forperm'),
|
||||
suffix=r'\b'), Keyword),
|
||||
(words(('requires', 'ensures', 'invariant'), suffix=r'\b'), Name.Decorator),
|
||||
(words(('Int', 'Perm', 'Bool', 'Ref', 'Rational'), suffix=r'\b'), Keyword.Type),
|
||||
include('numbers'),
|
||||
(r'[!%&*+=|?:<>/\-\[\]]', Operator),
|
||||
(r'\{.*?\}', Generic.Emph), #triggers
|
||||
(r'([{}():;,.])', Punctuation),
|
||||
# Identifier
|
||||
(r'[\w$]\w*', Name),
|
||||
],
|
||||
'comment': [
|
||||
(r'[^*/]+', Comment.Multiline),
|
||||
(r'/\*', Comment.Multiline, '#push'),
|
||||
(r'\*/', Comment.Multiline, '#pop'),
|
||||
(r'[*/]', Comment.Multiline),
|
||||
],
|
||||
'numbers': [
|
||||
(r'[0-9]+', Number.Integer),
|
||||
],
|
||||
}
|
||||
Reference in New Issue
Block a user