Closed Necr0x0Der closed 1 month ago
The issue seems that
"system Ping
user Pong"
is not converted into Python String by
r"^\".*\"$": lambda token: ValueAtom(str(token[1:-1]), 'String'),
and is parsed as Rust string. An attempt to write:
m = MeTTa()
x = m.run('''
! "A
B"
''')
print(x[0][0].get_object().content == '''A
B''')
results in
Cannot get_object of unsupported non-C "A
B"
Basically, the corresponding regex in Python is not invoked in this case. While if we return the old one
"\"[^\"]*\"": lambda token: ValueAtom(str(token[1:-1]), 'String')
it works here.
Interesting, probably, because $
matches end of line.
First guess was correct: .
inside regex doesn't recognize \n
and because of this te\nst
is parsed as a symbol atom. Fixed in #783
Describe the bug After this PR: https://github.com/trueagi-io/hyperon-experimental/pull/777/ unit tests in metta-motto became broken.
To Reproduce Run the test in metta-motto:
While
echo-agent
returnswhich is composed as
'\n'.join("system Ping", "user Pong")
, it cannot be matched with the string formed by parsing in MettaThis:
also doesn't work.
Expected behavior There should be a way to specify multi-line strings in metta scripts, which could be matched against corresponding strings formed in Python.