Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CVT_WRITEQ doesn't quote at the outermost level #1241

Open
kamahen opened this issue Feb 20, 2024 · 1 comment
Open

CVT_WRITEQ doesn't quote at the outermost level #1241

kamahen opened this issue Feb 20, 2024 · 1 comment

Comments

@kamahen
Copy link
Member

kamahen commented Feb 20, 2024

PL_get_nchars() with CVT_WRITEQ does the right thing with f('a b') or f("a b") but not for a b or "a b" -- the latter result in strings without surrounding quotes. (I have test cases in an upcoming PR)

Is this expected behaviour?

@kamahen
Copy link
Member Author

kamahen commented Feb 21, 2024

Test cases for these are in test_cpp.cpp (predicate get_nchars_string/4) and test_cpp.pl (tests nchars). (Requires SWI-Prolog/packages-cpp#68)
You can replicate this by the following (the test code outputs its interpretation of the flags - I do this to make sure that my flags handling is correct):

~/src/swipl-devel/build.debug/src/swipl -l ~/src/swipl-devel/packages/cpp/test_cpp.pl 
Welcome to SWI-Prolog (threaded, 64 bits, version 9.3.1-3-gac96195a7-DIRTY)

?- get_nchars_string("a b", [all,writeq,variable], S, F).
S = "a b",
F = "all,variable,writeq".

?- get_nchars_string(f("a b"), [all,writeq,variable], S, F).
S = "f(\"a b\")",
F = "all,variable,writeq".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant