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