Supporting empty programs in datalog languages, fixes pr11140
This commit is contained in:
parent
36c2eea571
commit
c24d6f94e7
|
@ -31,7 +31,7 @@
|
||||||
(datum->syntax #f tok-value (make-srcloc start-pos end-pos)))))
|
(datum->syntax #f tok-value (make-srcloc start-pos end-pos)))))
|
||||||
(grammar
|
(grammar
|
||||||
(program [(statements) $1])
|
(program [(statements) $1])
|
||||||
(statements [(statement) (list $1)]
|
(statements [() empty]
|
||||||
[(statement statements) (list* $1 $2)])
|
[(statement statements) (list* $1 $2)])
|
||||||
(statement [(assertion) $1]
|
(statement [(assertion) $1]
|
||||||
[(query) $1]
|
[(query) $1]
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
[(_ thy-expr stmt ...)
|
[(_ thy-expr stmt ...)
|
||||||
(syntax/loc stx
|
(syntax/loc stx
|
||||||
(parameterize ([current-theory thy-expr])
|
(parameterize ([current-theory thy-expr])
|
||||||
|
(void)
|
||||||
(->substitutions
|
(->substitutions
|
||||||
(datalog-stmt-var-selector stmt)
|
(datalog-stmt-var-selector stmt)
|
||||||
(eval-statement (datalog-stmt stmt)))
|
(eval-statement (datalog-stmt stmt)))
|
||||||
|
@ -48,6 +49,7 @@
|
||||||
[(_ thy-expr stmt ...)
|
[(_ thy-expr stmt ...)
|
||||||
(syntax/loc stx
|
(syntax/loc stx
|
||||||
(parameterize ([current-theory thy-expr])
|
(parameterize ([current-theory thy-expr])
|
||||||
|
(void)
|
||||||
(eval-top-level-statement (datalog-stmt stmt))
|
(eval-top-level-statement (datalog-stmt stmt))
|
||||||
...))]))
|
...))]))
|
||||||
|
|
||||||
|
|
1
collects/tests/datalog/examples/empty.rkt
Normal file
1
collects/tests/datalog/examples/empty.rkt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#lang datalog
|
0
collects/tests/datalog/examples/empty.txt
Normal file
0
collects/tests/datalog/examples/empty.txt
Normal file
1
collects/tests/datalog/paren-examples/empty.rkt
Normal file
1
collects/tests/datalog/paren-examples/empty.rkt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#lang datalog/sexp
|
0
collects/tests/datalog/paren-examples/empty.txt
Normal file
0
collects/tests/datalog/paren-examples/empty.txt
Normal file
Loading…
Reference in New Issue
Block a user