Fix make-rule-parser (#28)
When using `make-rule-parser` for any rule that is not the start rule, and applying the resulting parser while giving it a source-path it would just use the entire grammar from the start rule.pull/33/head
parent
d3405dd0ab
commit
6983208426
@ -0,0 +1,4 @@
|
||||
#lang brag
|
||||
|
||||
start: next
|
||||
next: "0"
|
@ -0,0 +1,17 @@
|
||||
#lang racket/base
|
||||
(require rackunit
|
||||
brag/support
|
||||
brag/examples/subrule)
|
||||
|
||||
(define parse-next (make-rule-parser next))
|
||||
(define parse-start (make-rule-parser start))
|
||||
|
||||
(check-equal? (syntax->datum (parse #f "0")) '(start (next "0")))
|
||||
(check-equal? (syntax->datum (parse #f "0")) (syntax->datum (parse "0")))
|
||||
|
||||
(check-equal? (syntax->datum (parse-start #f "0")) '(start (next "0")))
|
||||
(check-equal? (syntax->datum (parse-start #f "0")) (syntax->datum (parse-start "0")))
|
||||
|
||||
(check-equal? (syntax->datum (parse-next #f "0")) '(next "0"))
|
||||
(check-equal? (syntax->datum (parse-next #f "0")) (syntax->datum (parse-next "0")))
|
||||
|
Loading…
Reference in New Issue