Skip to content

Commit aa98c4c

Browse files
feat(config): deep code analysis engine with 6 supporting modules
changes: - file: parsers.py area: analyzer added: [_find_matching_brace, _get_or_create_class, _parse_rust_fn] modified: [_parse_rust, UniversalParser] - file: test_formats.py area: test added: [rust_sample_project, TestRustSupport] new_tests: 2 testing: new_tests: 2 scenarios: - rust_shows_up_in_toon_and_function_logic - rust_parsing_finds_top_level_and_impl_methods stats: lines: "+186/-47 (net +139)" files: 3 complexity: "Large structural change (normalized)"
1 parent cdf0238 commit aa98c4c

File tree

13 files changed

+215
-54
lines changed

13 files changed

+215
-54
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
## [1.0.33] - 2026-02-23
2+
3+
### Summary
4+
5+
feat(config): deep code analysis engine with 6 supporting modules
6+
7+
### Test
8+
9+
- update tests/test_formats.py
10+
11+
### Build
12+
13+
- update pyproject.toml
14+
15+
### Other
16+
17+
- update code2logic/parsers.py
18+
- update logic2code/pyproject.toml
19+
- update logic2test/pyproject.toml
20+
- update lolm/pyproject.toml
21+
22+
123
## [1.0.32] - 2026-02-15
224

325
### Summary

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.32
1+
1.0.33

code2logic/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
>>> print(output)
1919
"""
2020

21-
__version__ = "1.0.30"
21+
__version__ = "1.0.33"
2222
__author__ = "Softreck"
2323
__email__ = "info@softreck.dev"
2424
__license__ = "MIT"

code2logic/parsers.py

Lines changed: 122 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2039,12 +2039,81 @@ def _parse_rust(self, filepath: str, content: str) -> ModuleInfo:
20392039
constants: List[str] = []
20402040
exports: List[str] = []
20412041

2042+
def _get_or_create_class(name: str) -> ClassInfo:
2043+
for c in classes:
2044+
if c.name == name:
2045+
return c
2046+
c = ClassInfo(name=name)
2047+
classes.append(c)
2048+
return c
2049+
2050+
def _find_matching_brace(src: str, start_idx: int) -> int:
2051+
depth = 0
2052+
in_str = False
2053+
str_ch = ''
2054+
i = start_idx
2055+
while i < len(src):
2056+
ch = src[i]
2057+
if in_str:
2058+
if ch == '\\' and i + 1 < len(src):
2059+
i += 2
2060+
continue
2061+
if ch == str_ch:
2062+
in_str = False
2063+
str_ch = ''
2064+
i += 1
2065+
continue
2066+
if ch in ('\"', "'"):
2067+
in_str = True
2068+
str_ch = ch
2069+
i += 1
2070+
continue
2071+
if ch == '{':
2072+
depth += 1
2073+
elif ch == '}':
2074+
depth -= 1
2075+
if depth == 0:
2076+
return i
2077+
i += 1
2078+
return -1
2079+
2080+
def _parse_rust_fn(match: re.Match, *, is_method: bool) -> FunctionInfo:
2081+
name = match.group('name')
2082+
params_raw = (match.group('params') or '').strip()
2083+
ret = (match.group('ret') or '').strip()
2084+
sig = (match.group(0) or '')
2085+
2086+
params = [p.strip() for p in params_raw.split(',') if p.strip()]
2087+
params = params[:8]
2088+
2089+
is_pub = bool(re.search(r'\bpub\b', sig))
2090+
return FunctionInfo(
2091+
name=name,
2092+
params=params,
2093+
return_type=ret,
2094+
docstring=None,
2095+
docstring_full=None,
2096+
calls=[],
2097+
raises=[],
2098+
decorators=[],
2099+
complexity=1,
2100+
lines=1,
2101+
is_async=False,
2102+
is_static=False,
2103+
is_classmethod=False,
2104+
is_property=False,
2105+
intent=self.intent_gen.generate(name),
2106+
start_line=0,
2107+
end_line=0,
2108+
is_private=not is_pub,
2109+
)
2110+
20422111
for m in re.finditer(r'^use\s+([^;]+);', content, re.MULTILINE):
20432112
imports.append(m.group(1).strip())
20442113

20452114
for m in re.finditer(r'^(?:pub\s+)?struct\s+(\w+)', content, re.MULTILINE):
20462115
name = m.group(1)
2047-
classes.append(ClassInfo(name=name))
2116+
_get_or_create_class(name)
20482117
types.append(TypeInfo(name=name, kind='struct', definition=''))
20492118
exports.append(name)
20502119

@@ -2058,35 +2127,64 @@ def _parse_rust(self, filepath: str, content: str) -> ModuleInfo:
20582127
types.append(TypeInfo(name=name, kind='trait', definition=''))
20592128
exports.append(name)
20602129

2061-
for m in re.finditer(r'^(?:pub\s+)?fn\s+(\w+)\s*\(([^)]*)\)\s*(?:->\s*([^\s{]+))?', content, re.MULTILINE):
2130+
for m in re.finditer(r'^(?:pub\s+)?type\s+(\w+)\s*=', content, re.MULTILINE):
20622131
name = m.group(1)
2063-
params = [p.strip() for p in (m.group(2) or '').split(',') if p.strip()][:8]
2064-
ret = (m.group(3) or '').strip()
2065-
functions.append(FunctionInfo(
2066-
name=name,
2067-
params=params,
2068-
return_type=ret,
2069-
docstring=None,
2070-
docstring_full=None,
2071-
calls=[],
2072-
raises=[],
2073-
decorators=[],
2074-
complexity=1,
2075-
lines=1,
2076-
is_async='async' in m.group(0),
2077-
is_static=False,
2078-
is_classmethod=False,
2079-
is_property=False,
2080-
intent=self.intent_gen.generate(name),
2081-
start_line=0,
2082-
end_line=0,
2083-
is_private=False,
2084-
))
2132+
types.append(TypeInfo(name=name, kind='type', definition=''))
2133+
exports.append(name)
2134+
2135+
for m in re.finditer(r'^(?:pub\s+)?mod\s+(\w+)\s*;', content, re.MULTILINE):
2136+
name = m.group(1)
2137+
types.append(TypeInfo(name=name, kind='module', definition=''))
20852138
exports.append(name)
20862139

2140+
fn_pat = re.compile(
2141+
r'^\s*(?P<sig>(?:pub(?:\([^)]*\))?\s+)?fn)\s+(?P<name>\w+)\s*\((?P<params>[^)]*)\)\s*(?:->\s*(?P<ret>[^\s{]+))?',
2142+
re.MULTILINE,
2143+
)
2144+
2145+
for m in fn_pat.finditer(content):
2146+
functions.append(_parse_rust_fn(m, is_method=False))
2147+
exports.append(m.group('name'))
2148+
2149+
impl_pat = re.compile(
2150+
r'^impl\b[^\{]*\{',
2151+
re.MULTILINE,
2152+
)
2153+
2154+
for m in impl_pat.finditer(content):
2155+
hdr = content[m.start():m.end()]
2156+
type_name = ''
2157+
m_for = re.search(r'\bfor\s+(\w+)\b', hdr)
2158+
if m_for:
2159+
type_name = m_for.group(1)
2160+
else:
2161+
m_type = re.search(r'^impl\b[^\{]*?\b(\w+)\b\s*\{', hdr)
2162+
if m_type:
2163+
type_name = m_type.group(1)
2164+
2165+
if not type_name:
2166+
continue
2167+
2168+
open_idx = content.find('{', m.start(), m.end())
2169+
if open_idx < 0:
2170+
continue
2171+
close_idx = _find_matching_brace(content, open_idx)
2172+
if close_idx < 0:
2173+
continue
2174+
2175+
body = content[open_idx + 1:close_idx]
2176+
cls = _get_or_create_class(type_name)
2177+
for fm in fn_pat.finditer(body):
2178+
cls.methods.append(_parse_rust_fn(fm, is_method=True))
2179+
2180+
exports.append(type_name)
2181+
20872182
for m in re.finditer(r'^(?:pub\s+)?const\s+([A-Z][A-Z0-9_]*)\b', content, re.MULTILINE):
20882183
constants.append(m.group(1))
20892184

2185+
for m in re.finditer(r'^(?:pub\s+)?static\s+(?:mut\s+)?([A-Z][A-Z0-9_]*)\b', content, re.MULTILINE):
2186+
constants.append(m.group(1))
2187+
20902188
lines = content.split('\n')
20912189
return ModuleInfo(
20922190
path=filepath,

logic2code/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
from .generator import CodeGenerator, GeneratorConfig, GenerationResult
1515
from .renderers import PythonRenderer
1616

17-
__version__ = '0.1.9'
17+
__version__ = '1.0.33'
1818
__all__ = ['CodeGenerator', 'GeneratorConfig', 'GenerationResult', 'PythonRenderer']

logic2code/pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "logic2code"
77
version = "0.1.9"
88
description = "Generate source code from Code2Logic output files"
99
readme = "README.md"
10-
license = {text = "Apache-2.0"}
10+
license = "Apache-2.0"
1111
requires-python = ">=3.9"
1212
authors = [
1313
{name = "WronAI", email = "contact@wronai.com"}
@@ -23,7 +23,6 @@ keywords = [
2323
classifiers = [
2424
"Development Status :: 4 - Beta",
2525
"Intended Audience :: Developers",
26-
"License :: OSI Approved :: Apache Software License",
2726
"Operating System :: OS Independent",
2827
"Programming Language :: Python :: 3",
2928
"Programming Language :: Python :: 3.9",

logic2test/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
from .parsers import LogicParser
1616
from .templates import TestTemplate
1717

18-
__version__ = '0.1.10'
18+
__version__ = '1.0.33'
1919
__all__ = ['TestGenerator', 'GeneratorConfig', 'GenerationResult', 'LogicParser', 'TestTemplate']

logic2test/pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "logic2test"
77
version = "0.1.10"
88
description = "Generate test scaffolds from Code2Logic output files"
99
readme = "README.md"
10-
license = {text = "Apache-2.0"}
10+
license = "Apache-2.0"
1111
requires-python = ">=3.9"
1212
authors = [
1313
{name = "WronAI", email = "contact@wronai.com"}
@@ -23,7 +23,6 @@ keywords = [
2323
classifiers = [
2424
"Development Status :: 4 - Beta",
2525
"Intended Audience :: Developers",
26-
"License :: OSI Approved :: Apache Software License",
2726
"Operating System :: OS Independent",
2827
"Programming Language :: Python :: 3",
2928
"Programming Language :: Python :: 3.9",

lolm/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
)
7777
from .clients import LLMRateLimitError
7878

79-
__version__ = '0.1.10'
79+
__version__ = '1.0.33'
8080
__all__ = [
8181
# Config
8282
'LLMConfig',

lolm/pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "lolm"
77
version = "0.1.10"
88
description = "Lightweight Orchestrated LLM Manager - Multi-provider LLM configuration and management"
99
readme = "README.md"
10-
license = {text = "Apache-2.0"}
10+
license = "Apache-2.0"
1111
requires-python = ">=3.9"
1212
authors = [
1313
{name = "WronAI", email = "contact@wronai.com"}
@@ -25,7 +25,6 @@ keywords = [
2525
classifiers = [
2626
"Development Status :: 4 - Beta",
2727
"Intended Audience :: Developers",
28-
"License :: OSI Approved :: Apache Software License",
2928
"Operating System :: OS Independent",
3029
"Programming Language :: Python :: 3",
3130
"Programming Language :: Python :: 3.9",

0 commit comments

Comments
 (0)