Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions python_actr/pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,18 @@ def callfunc(x,b,name=name,p=p):
namedSlots=True
else:
if namedSlots!=False:
raise PatternException("Found unnamed slot '%s' after named slot in pattern '%s'"%(text,pattern))
if text=='?': continue
raise PatternException("Found unnamed slot '%s' after named slot in pattern '%s'"%(text,pattern))
#
# fixes the problem with matching to ?
# condition: wildcard value that doesn't assign a name (i.e. pattern 'chunkname:?' or just '?')
if text == '?':
# returns true if *either* x (the chunk, a UserDict) contains a key (slot name) that matches the
# name (key) of the wildcarded slot in our pattern (if there is no name, the slot is numbered,
# and key is the corresponding number)
funcs.append(lambda x, b, key=key: key in x.keys())
continue
#
#
while len(text)>0:
m=re.match('([\w\.-]+)',text)
#print("2m", m)#sterling
Expand Down