diff --git a/brag/brag/codegen/codegen.rkt b/brag/brag/codegen/codegen.rkt index b58f8df..75837c9 100755 --- a/brag/brag/codegen/codegen.rkt +++ b/brag/brag/codegen/codegen.rkt @@ -247,7 +247,8 @@ (with-syntax ([$1-start-pos (datum->syntax (first translated-patterns) '$1-start-pos)] [$n-end-pos (format-id (last translated-patterns) "$~a-end-pos" (length translated-patterns))]) #`(positions->srcloc $1-start-pos $n-end-pos)))) - + + ;; move 'splice property into function because name is datum-ized (with-syntax ([(translated-pattern ...) translated-patterns] [(translated-action ...) translated-actions]) #`[(translated-pattern ...) diff --git a/brag/brag/codegen/runtime.rkt b/brag/brag/codegen/runtime.rkt index ebb8902..12212ca 100755 --- a/brag/brag/codegen/runtime.rkt +++ b/brag/brag/codegen/runtime.rkt @@ -163,15 +163,15 @@ This would be the place to check a syntax property for hiding. ;; Creates an stx out of the rule name and its components. ;; The location information of the rule spans that of its components. (define (rule-components->syntax rule-name/false #:srcloc [srcloc #f] #:splice? [splice #f] . componentss) - (let ([componentss (append-map (λ(cs) + (let ([spliced-componentss (append-map (λ(cs) (if (and (pair? cs) (syntax-property (car cs) 'splice)) - (list (cdr (syntax->list (car cs)))) + (list (cdr (syntax->list (car cs)))) ; pop off the rule name and splice its components into this rule (list cs))) componentss)]) (syntax-property (datum->syntax #f (cons (datum->syntax #f rule-name/false srcloc stx-with-original?-property) - (apply append componentss)) + (apply append spliced-componentss)) srcloc stx-with-original?-property) 'splice splice))) \ No newline at end of file diff --git a/brag/brag/elider/json-elider-toy.rkt b/brag/brag/elider/json-elider-toy.rkt deleted file mode 100644 index 8eed9e8..0000000 --- a/brag/brag/elider/json-elider-toy.rkt +++ /dev/null @@ -1,4 +0,0 @@ -#lang brag - -thing : foo -foo : <"bar"> diff --git a/brag/brag/elider/test-json-elider-toy.rkt b/brag/brag/elider/test-json-elider-toy.rkt deleted file mode 100644 index c3072c3..0000000 --- a/brag/brag/elider/test-json-elider-toy.rkt +++ /dev/null @@ -1,9 +0,0 @@ -#lang br -(require "json-elider-toy.rkt" - brag/support - rackunit) - -(check-equal? - (syntax->datum - (parse (list "bar"))) - '(thing)) diff --git a/brag/brag/elider/json-elider.rkt b/brag/brag/examples/baby-json-hider.rkt similarity index 78% rename from brag/brag/elider/json-elider.rkt rename to brag/brag/examples/baby-json-hider.rkt index 677a02d..eb2097f 100755 --- a/brag/brag/elider/json-elider.rkt +++ b/brag/brag/examples/baby-json-hider.rkt @@ -1,8 +1,7 @@ #lang brag ;; Simple baby example of JSON structure -json: number - | string +json: number | string | array | object @@ -14,4 +13,4 @@ array: "[" [json ("," json)*] "]" object: <"{"> [kvpair ("," kvpair)*] <"}"> - : ":" +: ":" diff --git a/brag/brag/elider/test-json-elider.rkt b/brag/brag/test/test-baby-json-hider.rkt similarity index 90% rename from brag/brag/elider/test-json-elider.rkt rename to brag/brag/test/test-baby-json-hider.rkt index c7e48d0..81af1a1 100755 --- a/brag/brag/elider/test-json-elider.rkt +++ b/brag/brag/test/test-baby-json-hider.rkt @@ -1,5 +1,5 @@ -#lang br -(require "json-elider.rkt" +#lang racket/base +(require brag/examples/baby-json-hider brag/support rackunit)