Fix parser escape ordering and prim_get for non-dict objects
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m37s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m37s
Parser: chained .replace() calls processed \n before \\, causing \\n to become a real newline. Replaced with character-by-character _unescape_string. Fixes 2 parser spec test failures. Primitives: prim_get only handled dict and list. Objects with .get() methods (like PageDef) returned None. Added hasattr fallback. Fixes 9 defpage spec test failures. All 259 spec tests now pass (was 244/259). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -374,6 +374,8 @@ def prim_get(coll: Any, key: Any, default: Any = None) -> Any:
|
||||
return default
|
||||
if isinstance(coll, list):
|
||||
return coll[key] if 0 <= key < len(coll) else default
|
||||
if hasattr(coll, "get"):
|
||||
return coll.get(key, default)
|
||||
return default
|
||||
|
||||
@register_primitive("len")
|
||||
|
||||
Reference in New Issue
Block a user