问题描述
我之前问过如何做正则表达式之类的匹配:
DCG : zero-or-more,zero-or-one,one-or-more occurrences?
我用它来匹配令牌:
heroku run python manage.py createsuperuser
**You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin,auth,contenttypes,sessions.
Run 'python manage.py migrate' to apply them.**
Username:
我目前的问题是如何修改它们,使它们不仅适用于令牌,还适用于规则,即将规则目标作为参数传递。
我最初的想法是:
%zero or one
zo(_) --> [].
zo(W) --> [W].
%one or more
omo(W) --> [W].
omo(W) --> [W],omo(W).
%zero or more
zmo(_) --> [].
zmo(W) --> [W],zmo(W).
但它看起来很可疑;\
f.e.这简化了:
zo(G) --> {\+ atomic(G),call(G)}.
那些:
create(Ctx) --> ([create];[make]),zo(new),[Ctx].
想象一下:
create(Ctx) --> [create,Ctx].
create(Ctx) --> [make,new,Ctx].
create(Ctx) --> [create,Ctx].
将解析:
multiple(Ctx) :- omo(create(Ctx)),....
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)