|
|
|
@ -216,29 +216,29 @@
|
|
|
|
|
(for/list ([translated-pattern (in-list translated-patterns)]
|
|
|
|
|
[primitive-pattern (syntax->list a-clause)]
|
|
|
|
|
[pos (in-naturals 1)])
|
|
|
|
|
(with-syntax ([$X
|
|
|
|
|
(format-id translated-pattern "$~a" pos)]
|
|
|
|
|
[$X-start-pos
|
|
|
|
|
(format-id translated-pattern "$~a-start-pos" pos)]
|
|
|
|
|
[$X-end-pos
|
|
|
|
|
(format-id translated-pattern "$~a-end-pos" pos)])
|
|
|
|
|
(syntax-case primitive-pattern (id lit token inferred-id)
|
|
|
|
|
|
|
|
|
|
;; When a rule usage is inferred, the value of $X is a syntax object
|
|
|
|
|
;; whose head is the name of the inferred rule . We strip that out,
|
|
|
|
|
;; leaving the residue to be absorbed.
|
|
|
|
|
[(inferred-id val reason)
|
|
|
|
|
#'(syntax-case $X ()
|
|
|
|
|
[(inferred-rule-name . rest)
|
|
|
|
|
(syntax->list #'rest)])]
|
|
|
|
|
[(id val)
|
|
|
|
|
#'(list $X)]
|
|
|
|
|
;; move the 'hide syntax property into the translated-action
|
|
|
|
|
;; because syntax gets datum-ized
|
|
|
|
|
[(lit val)
|
|
|
|
|
#`(list (atomic-datum->syntax $X $X-start-pos $X-end-pos #,(syntax-property primitive-pattern 'hide)))]
|
|
|
|
|
[(token val)
|
|
|
|
|
#`(list (atomic-datum->syntax $X $X-start-pos $X-end-pos #,(syntax-property primitive-pattern 'hide)))]))))
|
|
|
|
|
(if (syntax-property primitive-pattern 'hide)
|
|
|
|
|
#'null
|
|
|
|
|
(with-syntax ([$X
|
|
|
|
|
(format-id translated-pattern "$~a" pos)]
|
|
|
|
|
[$X-start-pos
|
|
|
|
|
(format-id translated-pattern "$~a-start-pos" pos)]
|
|
|
|
|
[$X-end-pos
|
|
|
|
|
(format-id translated-pattern "$~a-end-pos" pos)])
|
|
|
|
|
(syntax-case primitive-pattern (id lit token inferred-id)
|
|
|
|
|
|
|
|
|
|
;; When a rule usage is inferred, the value of $X is a syntax object
|
|
|
|
|
;; whose head is the name of the inferred rule . We strip that out,
|
|
|
|
|
;; leaving the residue to be absorbed.
|
|
|
|
|
[(inferred-id val reason)
|
|
|
|
|
#'(syntax-case $X ()
|
|
|
|
|
[(inferred-rule-name . rest)
|
|
|
|
|
(syntax->list #'rest)])]
|
|
|
|
|
[(id val)
|
|
|
|
|
#'(list $X)]
|
|
|
|
|
[(lit val)
|
|
|
|
|
#'(list (atomic-datum->syntax $X $X-start-pos $X-end-pos))]
|
|
|
|
|
[(token val)
|
|
|
|
|
#'(list (atomic-datum->syntax $X $X-start-pos $X-end-pos))])))))
|
|
|
|
|
|
|
|
|
|
(define whole-rule-loc
|
|
|
|
|
(if (empty? translated-patterns)
|
|
|
|
|