python-fragments 0.8__tar.gz → 0.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_fragments-0.8 → python_fragments-0.10}/PKG-INFO +1 -1
- {python_fragments-0.8 → python_fragments-0.10}/fragments/grammar.py +23 -3
- {python_fragments-0.8 → python_fragments-0.10}/pyproject.toml +1 -1
- {python_fragments-0.8 → python_fragments-0.10}/python_fragments.egg-info/PKG-INFO +1 -1
- {python_fragments-0.8 → python_fragments-0.10}/README.md +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/__init__.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/ast_nodes.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/cli.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/html/__init__.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/html/elements.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/loader.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/__init__.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/based_proxy.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/__init__.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/code_actions.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/completion.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/definition.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/diagnostics.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/document_highlight.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/document_symbols.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/folding_range.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/hover.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/inlay_hints.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/lifecycle.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/references.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/rename.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/semantic_tokens.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/signature_help.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/file_state.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/message_queue.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/pyright_notification_handlers/__init__.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/pyright_notification_handlers/capability.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/pyright_notification_handlers/configuration.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/pyright_notification_handlers/diagnostics.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/types.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/source.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/fragments/transpiler.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/python_fragments.egg-info/SOURCES.txt +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/python_fragments.egg-info/dependency_links.txt +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/python_fragments.egg-info/entry_points.txt +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/python_fragments.egg-info/requires.txt +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/python_fragments.egg-info/top_level.txt +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/setup.cfg +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/tests/test_grammar.py +0 -0
- {python_fragments-0.8 → python_fragments-0.10}/tests/test_source_map.py +0 -0
|
@@ -4,11 +4,10 @@ import re
|
|
|
4
4
|
from fragments.ast_nodes import ASTFragment, ASTHTMLAttribute, ASTHTMLComment, ASTHTMLElement, ASTHTMLText, ASTInterpolation, ASTModule, ASTPython
|
|
5
5
|
from fragments.source import Source
|
|
6
6
|
|
|
7
|
-
PYTHON = r"([\s\S]*?)(?=<>)|[\s\S]*$"
|
|
8
7
|
IDENTIFIER = r"[a-zA-Z_][a-zA-Z0-9_]*"
|
|
9
8
|
STRING_CONTENTS = r"(.*?)(?=\")"
|
|
10
9
|
HTML_IDENTIFIER = r"[a-zA-Z][a-zA-Z0-9_-]*"
|
|
11
|
-
HTML_TEXT = r"(.*?)(
|
|
10
|
+
HTML_TEXT = r"(.*?)(?=<|{{)"
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
class ParsingError(Exception):
|
|
@@ -56,8 +55,29 @@ def expect_module(source: Source) -> tuple[Source, ASTModule]:
|
|
|
56
55
|
|
|
57
56
|
def expect_python(source: Source) -> tuple[Source, ASTPython]:
|
|
58
57
|
"""Vanilla Python code."""
|
|
58
|
+
PYTHON = r"([\s\S]*?)(?=<>|'''|\"\"\"|'|\"|#)|[\s\S]*$"
|
|
59
59
|
source_start: int = source.offset
|
|
60
|
-
|
|
60
|
+
python: str = ""
|
|
61
|
+
|
|
62
|
+
while not source.remaining().startswith("<>") and not source.at_end():
|
|
63
|
+
source, next_python = expect_regex(source, PYTHON, "python source")
|
|
64
|
+
python += next_python
|
|
65
|
+
if source.remaining().startswith('"""'):
|
|
66
|
+
source, next_python = expect_regex(source, r'"""([\s\S]*?)(?:"""|$)', "python source")
|
|
67
|
+
python += next_python
|
|
68
|
+
elif source.remaining().startswith("'''"):
|
|
69
|
+
source, next_python = expect_regex(source, r"'''([\s\S]*?)(?:'''|$)", "python source")
|
|
70
|
+
python += next_python
|
|
71
|
+
elif source.remaining().startswith("'"):
|
|
72
|
+
source, next_python = expect_regex(source, r"'(?:[^'\\]|\\.)*(?:'|$)", "python source")
|
|
73
|
+
python += next_python
|
|
74
|
+
elif source.remaining().startswith('"'):
|
|
75
|
+
source, next_python = expect_regex(source, r'"(?:[^"\\]|\\.)*(?:"|$)', "python source")
|
|
76
|
+
python += next_python
|
|
77
|
+
elif source.remaining().startswith("#"):
|
|
78
|
+
source, next_python = expect_regex(source, r"#[^\n]*", "python source")
|
|
79
|
+
python += next_python
|
|
80
|
+
|
|
61
81
|
return source, ASTPython(source_start, source.offset, python)
|
|
62
82
|
|
|
63
83
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python-fragments"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.10"
|
|
8
8
|
description = "Modern HTML template rendering in Python"
|
|
9
9
|
authors = [{ name = "The Running Algorithm", email = "services@therunningalgorithm.info" }]
|
|
10
10
|
readme = "README.md"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/__init__.py
RENAMED
|
File without changes
|
{python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/code_actions.py
RENAMED
|
File without changes
|
{python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/completion.py
RENAMED
|
File without changes
|
{python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/definition.py
RENAMED
|
File without changes
|
{python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/diagnostics.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/hover.py
RENAMED
|
File without changes
|
{python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/inlay_hints.py
RENAMED
|
File without changes
|
{python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/lifecycle.py
RENAMED
|
File without changes
|
{python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/references.py
RENAMED
|
File without changes
|
{python_fragments-0.8 → python_fragments-0.10}/fragments/lsp/client_message_handlers/rename.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_fragments-0.8 → python_fragments-0.10}/python_fragments.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|