wip: preserve local engine and agent workflow changes before ganjihong refactor integration
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from typing import Any
|
||||
from .featurescript_lexer import Token, lex
|
||||
from .ir import Call, FeatureIR, ModelIR, SketchIR
|
||||
@@ -130,7 +131,18 @@ def _arg_map(call: Call) -> dict[str, Any]:
|
||||
|
||||
|
||||
def parse_featurescript(source: str, sample_id: str = "unknown") -> ModelIR:
|
||||
parser = Parser(source); calls = parser.statements(); model = ModelIR(sample_id, raw_source=source)
|
||||
parser = Parser(source); calls = parser.statements()
|
||||
version = re.search(r"\bFeatureScript\s+(\d+(?:\.\d+)*)\s*;", source)
|
||||
standard_library = re.search(
|
||||
r"\bimport\s*\(\s*path\s*:\s*[\"']([^\"']*onshape/std/[^\"']*)[\"']",
|
||||
source,
|
||||
)
|
||||
model = ModelIR(
|
||||
sample_id,
|
||||
raw_source=source,
|
||||
featurescript_version=version.group(1) if version else None,
|
||||
standard_library=standard_library.group(1) if standard_library else None,
|
||||
)
|
||||
for call in calls:
|
||||
if call.name == "newSketch":
|
||||
definition = _arg_map(call)
|
||||
|
||||
Reference in New Issue
Block a user