feat: add native Tomie adapter and strict import compatibility checks
This commit is contained in:
1 parent
c8d83b3fe7
commit
57a4edcbfd
45 files changed
+2985
-71
No files matched your search
@@ -64,6 +64,7 @@ class ScriptData:
|
||||
modules: dict[str, list[Node]] = field(default_factory=dict) # file -> labels
|
||||
warnings: Counter = field(default_factory=Counter)
|
||||
blockers: Counter = field(default_factory=Counter)
|
||||
blocker_examples: dict[str, str] = field(default_factory=dict)
|
||||
warning_examples: dict[str, str] = field(default_factory=dict)
|
||||
stats: Counter = field(default_factory=Counter)
|
||||
|
||||
@@ -71,6 +72,8 @@ class ScriptData:
|
||||
self.warnings[kind] += 1
|
||||
if blocking:
|
||||
self.blockers[kind] += 1
|
||||
if where:
|
||||
self.blocker_examples.setdefault(kind, where)
|
||||
if where and kind not in self.warning_examples:
|
||||
self.warning_examples[kind] = where
|
||||
|
||||
@@ -591,10 +594,14 @@ class RpyParser:
|
||||
c = self.cursor(child)
|
||||
word = c.peek_word()
|
||||
if word in ("contains", "block", "parallel", "choice"):
|
||||
if word != "block":
|
||||
self.d.warn(f"Не поддерживается ATL: {word}", self.where(child))
|
||||
if not frames or word == "block":
|
||||
repeat = self.atl_frames(child.block, frames, props) or repeat
|
||||
continue
|
||||
if word == "repeat":
|
||||
if child.text.strip() != "repeat":
|
||||
self.d.warn("Не поддерживается ATL: конечное число повторов", self.where(child))
|
||||
repeat = True
|
||||
continue
|
||||
if word in ("pause",) or _NUMBER_LINE.match(child.text):
|
||||
@@ -604,6 +611,7 @@ class RpyParser:
|
||||
frames[-1]["d"] = frames[-1].get("d", 0) + d
|
||||
continue
|
||||
if word in ("function", "on", "event", "time", "transform"):
|
||||
self.d.warn(f"Не поддерживается ATL: {word}", self.where(child))
|
||||
continue
|
||||
s = c.string()
|
||||
if s is not None:
|
||||
@@ -626,7 +634,7 @@ class RpyParser:
|
||||
frames.append({"img": {"expr": e}})
|
||||
continue
|
||||
if not frames or not frames[-1].get("d"):
|
||||
props.update(_atl_props(child.text))
|
||||
props.update(self.static_atl(child))
|
||||
return repeat
|
||||
|
||||
def st_layeredimage(self, line: Line) -> list[Node]:
|
||||
@@ -754,11 +762,18 @@ class RpyParser:
|
||||
name = c.word()
|
||||
props: dict[str, Any] = {}
|
||||
for child in line.block:
|
||||
props.update(_atl_props(child.text))
|
||||
props.update(self.static_atl(child))
|
||||
if name:
|
||||
self.d.transforms[name] = props
|
||||
return []
|
||||
|
||||
def static_atl(self, line: Line) -> dict[str, Any]:
|
||||
props = _atl_props(line.text)
|
||||
first = Cursor(line.text).peek_word()
|
||||
if first not in POSITION_PROPS or not props or line.block:
|
||||
self.d.warn(f"Не поддерживается динамическая ATL-трансформация: {first or line.text}", self.where(line))
|
||||
return props
|
||||
|
||||
# visual statements -------------------------------------------------------------
|
||||
|
||||
def image_spec(self, c: Cursor, line: Line) -> dict[str, Any]:
|
||||
@@ -799,7 +814,7 @@ class RpyParser:
|
||||
elif c.char(":"):
|
||||
props: dict[str, Any] = {}
|
||||
for child in line.block:
|
||||
props.update(_atl_props(child.text))
|
||||
props.update(self.static_atl(child))
|
||||
if props:
|
||||
node["at"].append({"props": props})
|
||||
else:
|
||||
|
||||
Reference in new issue
Block a user