From cf91c081404cc2fc06677840a02b1bb84cffacbe Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 17 Dec 2025 21:37:57 +0000 Subject: 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. --- ravanan/javascript.scm | 15 +++------------ 1 file 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. -- cgit 1.4.1