about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2025-12-17 21:37:57 +0000
committerArun Isaac2025-12-17 22:26:38 +0000
commitcf91c081404cc2fc06677840a02b1bb84cffacbe (patch)
tree73bd0639dd5cc692dbcce864a5ec7be2b958a70e
parent72d0fa2f7e5e1fe77e506533ccfd880fd0f23b6f (diff)
downloadravanan-cf91c081404cc2fc06677840a02b1bb84cffacbe.tar.gz
ravanan-cf91c081404cc2fc06677840a02b1bb84cffacbe.tar.lz
ravanan-cf91c081404cc2fc06677840a02b1bb84cffacbe.zip
javascript: Do not treat null as a special case.
Restrict parameter reference symbol at the parser level. Do not treat
null as a special case. Let it drop to node as a javascript
expression.
-rw-r--r--ravanan/javascript.scm15
1 files changed, 3 insertions, 12 deletions
diff --git a/ravanan/javascript.scm b/ravanan/javascript.scm
index eebf082..5061085 100644
--- a/ravanan/javascript.scm
+++ b/ravanan/javascript.scm
@@ -70,7 +70,9 @@
   (and (or (and (ignore ".") symbol) singleq doubleq index)))
 
 (define-peg-pattern parameter-reference all
-  (and (ignore "$(") symbol (* segment) (ignore ")")))
+  (and (ignore "$(")
+       (or "inputs" "self" "runtime")
+       (* segment) (ignore ")")))
 
 (define-peg-pattern javascript-subexpression body
   (and "("
@@ -118,17 +120,6 @@ keys @code{\"inputs\"}, @code{\"self\"} and @code{\"runtime\"}.
     ;; String literal
     ((? string? str)
      str)
-    ;; Special case for null
-    (('parameter-reference "null")
-     (if context
-         'null
-         #~'null))
-    ;; Disallow referencing anything other than inputs, self or runtime.
-    (('parameter-reference (and (not (or "inputs" "self" "runtime"))
-                                symbol)
-                           _ ...)
-     (user-error "Invalid parameter reference; `~a' unknown"
-                 symbol))
     ;; Parse parameter reference. The strange and complex matching pattern for
     ;; segments accounts for how (ice-9 peg) adds an additional layer of
     ;; parentheses to the tree when there are 2 or more segments.