The internal servers have no access to outside package repositories and run Python 3.8/3.9, so the UI moves from hand-drawn curses to Textual 6.2.1 (the last release supporting 3.8.1), vendored with its pure-Python dependencies in vendor/. The launcher puts vendor/ first on sys.path, so a plain checkout runs with no pip and no network. - dsflow/: the single script split into a package (pure moves of the backend sections); action rules moved to ops.py, free of Textual - dsflow/ui/: tabs, detail pane, live sanity-run panel, log viewer, modal dialogs, filter, themes, mouse support - tests/test_ui.py: headless UI tests through Textual's pilot - tools/vendor.py (refresh vendor/), tools/screenshots.py (README images) - README, CLAUDE.md, TODO and the feature doc updated for the new layout, the Python 3.8.1 floor and the vendoring rules Verified: 11 tests green on Python 3.12 and 3.8.20; the shipped file set runs under `python -I -S` on both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
78 lines
2.8 KiB
Python
Vendored
78 lines
2.8 KiB
Python
Vendored
"""
|
|
pygments.lexers.tal
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
Lexer for Uxntal
|
|
|
|
.. versionadded:: 2.12
|
|
|
|
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
|
:license: BSD, see LICENSE for details.
|
|
"""
|
|
|
|
from pygments.lexer import RegexLexer, words
|
|
from pygments.token import Comment, Keyword, Name, String, Number, \
|
|
Punctuation, Whitespace, Literal
|
|
|
|
__all__ = ['TalLexer']
|
|
|
|
|
|
class TalLexer(RegexLexer):
|
|
"""
|
|
For Uxntal source code.
|
|
"""
|
|
|
|
name = 'Tal'
|
|
aliases = ['tal', 'uxntal']
|
|
filenames = ['*.tal']
|
|
mimetypes = ['text/x-uxntal']
|
|
url = 'https://wiki.xxiivv.com/site/uxntal.html'
|
|
version_added = '2.12'
|
|
|
|
instructions = [
|
|
'BRK', 'LIT', 'INC', 'POP', 'DUP', 'NIP', 'SWP', 'OVR', 'ROT',
|
|
'EQU', 'NEQ', 'GTH', 'LTH', 'JMP', 'JCN', 'JSR', 'STH',
|
|
'LDZ', 'STZ', 'LDR', 'STR', 'LDA', 'STA', 'DEI', 'DEO',
|
|
'ADD', 'SUB', 'MUL', 'DIV', 'AND', 'ORA', 'EOR', 'SFT'
|
|
]
|
|
|
|
tokens = {
|
|
# the comment delimiters must not be adjacent to non-space characters.
|
|
# this means ( foo ) is a valid comment but (foo) is not. this also
|
|
# applies to nested comments.
|
|
'comment': [
|
|
(r'(?<!\S)\((?!\S)', Comment.Multiline, '#push'), # nested comments
|
|
(r'(?<!\S)\)(?!\S)', Comment.Multiline, '#pop'), # nested comments
|
|
(r'[^()]+', Comment.Multiline), # comments
|
|
(r'[()]+', Comment.Multiline), # comments
|
|
],
|
|
'root': [
|
|
(r'\s+', Whitespace), # spaces
|
|
(r'(?<!\S)\((?!\S)', Comment.Multiline, 'comment'), # comments
|
|
(words(instructions, prefix=r'(?<!\S)', suffix=r'2?k?r?(?!\S)'),
|
|
Keyword.Reserved), # instructions
|
|
(r'[][{}](?!\S)', Punctuation), # delimiters
|
|
(r'#([0-9a-f]{2}){1,2}(?!\S)', Number.Hex), # integer
|
|
(r'"\S+', String), # raw string
|
|
(r'([0-9a-f]{2}){1,2}(?!\S)', Literal), # raw integer
|
|
(r'[|$][0-9a-f]{1,4}(?!\S)', Keyword.Declaration), # abs/rel pad
|
|
(r'%\S+', Name.Decorator), # macro
|
|
(r'@\S+', Name.Function), # label
|
|
(r'&\S+', Name.Label), # sublabel
|
|
(r'/\S+', Name.Tag), # spacer
|
|
(r'\.\S+', Name.Variable.Magic), # literal zero page addr
|
|
(r',\S+', Name.Variable.Instance), # literal rel addr
|
|
(r';\S+', Name.Variable.Global), # literal abs addr
|
|
(r'-\S+', Literal), # raw zero page addr
|
|
(r'_\S+', Literal), # raw relative addr
|
|
(r'=\S+', Literal), # raw absolute addr
|
|
(r'!\S+', Name.Function), # immediate jump
|
|
(r'\?\S+', Name.Function), # conditional immediate jump
|
|
(r'~\S+', Keyword.Namespace), # include
|
|
(r'\S+', Name.Function), # macro invocation, immediate subroutine
|
|
]
|
|
}
|
|
|
|
def analyse_text(text):
|
|
return '|0100' in text[:500]
|