Improved handling of syntax errors in `reduction-relation'
svn: r18431
This commit is contained in:
parent
ef9de6517a
commit
d82fdbc317
|
@ -485,6 +485,20 @@
|
||||||
[withs (make-module-identifier-mapping)])
|
[withs (make-module-identifier-mapping)])
|
||||||
(for-each (λ (shortcut)
|
(for-each (λ (shortcut)
|
||||||
(syntax-case shortcut ()
|
(syntax-case shortcut ()
|
||||||
|
[((rhs-arrow rhs-from rhs-to)
|
||||||
|
(lhs-arrow a b))
|
||||||
|
(not (identifier? #'a))
|
||||||
|
(raise-syntax-error
|
||||||
|
orig-name
|
||||||
|
"malformed shortcut, expected identifier"
|
||||||
|
shortcut #'a)]
|
||||||
|
[((rhs-arrow rhs-from rhs-to)
|
||||||
|
(lhs-arrow a b))
|
||||||
|
(not (identifier? #'b))
|
||||||
|
(raise-syntax-error
|
||||||
|
orig-name
|
||||||
|
"malformed shortcut, expected identifier"
|
||||||
|
shortcut #'b)]
|
||||||
[((rhs-arrow rhs-from rhs-to)
|
[((rhs-arrow rhs-from rhs-to)
|
||||||
(lhs-arrow lhs-from lhs-to))
|
(lhs-arrow lhs-from lhs-to))
|
||||||
(begin
|
(begin
|
||||||
|
|
|
@ -1090,6 +1090,22 @@
|
||||||
[(~> a b) (==> a b)])
|
[(~> a b) (==> a b)])
|
||||||
#rx"~> relation is not defined")
|
#rx"~> relation is not defined")
|
||||||
|
|
||||||
|
(test-syn-err (reduction-relation
|
||||||
|
grammar
|
||||||
|
(==> 1 2)
|
||||||
|
with
|
||||||
|
[(--> a b)
|
||||||
|
(==> a (+ 3 b))])
|
||||||
|
#rx"expected identifier")
|
||||||
|
|
||||||
|
(test-syn-err (reduction-relation
|
||||||
|
grammar
|
||||||
|
(==> 1 2)
|
||||||
|
with
|
||||||
|
[(--> a b)
|
||||||
|
(==> (+ 3 a) b)])
|
||||||
|
#rx"expected identifier")
|
||||||
|
|
||||||
(test-syn-err (define-language bad-lang1 (e name)) #rx"name")
|
(test-syn-err (define-language bad-lang1 (e name)) #rx"name")
|
||||||
(test-syn-err (define-language bad-lang2 (name x)) #rx"name")
|
(test-syn-err (define-language bad-lang2 (name x)) #rx"name")
|
||||||
(test-syn-err (define-language bad-lang3 (x_y x)) #rx"cannot have _")
|
(test-syn-err (define-language bad-lang3 (x_y x)) #rx"cannot have _")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user