replikativ / datalog-parser

Generic datalog parser compliant to datomic, datascript and datahike queries.
Eclipse Public License 2.0
71 stars 11 forks source link

allow symbols(not starting with ?) as constants #21

Closed zoren closed 2 years ago

zoren commented 2 years ago

This is a port of: https://github.com/tonsky/datascript/pull/417

This PR allows using symbols(not starting with ?) as constants in data patterns. This is consistent with Datomic's behaviour.

Notes:

I changed the order of parsers in parse-fn-arg otherwise $x would parse as a constant, and it shouldn't for function arguments.

I believe the unit test saying (friends something) should throw is wrong. I've changed it to a positive test where something parses as a constant argument instead.

zoren commented 2 years ago

Interesting to note that "Cannot parse rule-expr arguments" in parse-rule-expr can no longer be hit as arguments are either variables, placeholders or constants.

zoren commented 2 years ago

Hi @zoren. Thanks for improving the datalog-parser! Would you want to increment the patch-version in project.clj? Then we can release a new version right away.

Sure, done!