Phase 7a: affinity annotations + fix parser escape sequences
Add :affinity :client/:server/:auto annotations to defcomp, with render-target function combining affinity + IO analysis. Includes spec (eval.sx, deps.sx), tests, Python evaluator, and demo page. Fix critical bug: Python SX parser _ESCAPE_MAP was missing \r and \0, causing bootstrapped JS parser to treat 'r' as whitespace — breaking all client-side SX parsing. Also add \0 to JS string emitter and fix serializer round-tripping for \r and \0. Reserved word escaping: bootstrappers now auto-append _ to identifiers colliding with JS/Python reserved words (e.g. default → default_, final → final_), so the spec never needs to avoid host language keywords. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -184,6 +184,8 @@ env = {
|
||||
"dict-get": "_deferred",
|
||||
"append!": "_deferred",
|
||||
"inc": lambda n: n + 1,
|
||||
# Component accessor for affinity (Phase 7)
|
||||
"component-affinity": lambda c: getattr(c, 'affinity', 'auto'),
|
||||
}
|
||||
|
||||
|
||||
@@ -286,6 +288,7 @@ def _load_deps_from_bootstrap(env):
|
||||
transitive_io_refs,
|
||||
compute_all_io_refs,
|
||||
component_pure_p,
|
||||
render_target,
|
||||
)
|
||||
env["scan-refs"] = scan_refs
|
||||
env["scan-components-from-source"] = scan_components_from_source
|
||||
@@ -298,6 +301,7 @@ def _load_deps_from_bootstrap(env):
|
||||
env["transitive-io-refs"] = transitive_io_refs
|
||||
env["compute-all-io-refs"] = compute_all_io_refs
|
||||
env["component-pure?"] = component_pure_p
|
||||
env["render-target"] = render_target
|
||||
env["test-env"] = lambda: env
|
||||
except ImportError:
|
||||
eval_file("deps.sx", env)
|
||||
|
||||
Reference in New Issue
Block a user