Replies: 4 comments 6 replies
-
(I am not a Wind- ows user) but maybe this helps. It seems that the syntax in general needs to be extended. There, just allow all control characters as layout characters. In 6.4.3 Layout characters there is:
So at first sight, there must not be any further layout character. On the other hand, the actual PCS (6.5) may also contain extended characters and in fact, note that the control escape sequences "\a\b\r\f" are not necessarily in the PCS (with ASCII and Unicode they are present). Only "\t\n" have to be in the PCS and thus the rather restricted definition of
SICStus, GNU, Trealla all give Scryer already accepts So for regular syntax this could solve the problem. The other one that still persists are linebreaks within single quoted or double quoted characters. Thus an atom like:
Here,
could be extended to accept also layout characters in between. This would solve also the 3270 (and similar devise) issue with spaces at the end of lines. |
Beta Was this translation helpful? Give feedback.
-
(Scryer already supports both |
Beta Was this translation helpful? Give feedback.
-
Thanks for the examples! I'll start writing up test cases to help me figure out how to address the above issues. I'm not sure what you meant by "6.4.3" or "PCS" though, may you clarify please? |
Beta Was this translation helpful? Give feedback.
-
6.4.3 is a section number from
It is never free and the price seems to have jumped in the last few years. UWN can correct me on this but I think each member nation is allowed to set the price and the U.S. site usually has the best prices. https://webstore.ansi.org/Standards/INCITS/INCITSISOIEC132111995R2017 Currently $116 It is nice to have when the discussions reference it but not strictly necessary as many Prolog programmers who visit these sites have a copy and can answer questions about it. Here is a bit more and the notes might be of benefit.
also
as for PCS, it seems to be processor character set (PCS) which is noted in the ISO standard. I don't plan to keep quoting more as it eventually leads to quoting the entire document. It is an interesting read but I don't know of anyone who has followed the standard to the letter. It seems to boil down to this. If you want to know what the standard states and be able to defend what you write with quotes from the standard then you will have to get a copy of the standard. |
Beta Was this translation helpful? Give feedback.
-
Hello, I recently compiled Scryer under msys64 on my Windows machine and ran into an issue that is already documented in #553 and #543. The implementation doesn't handle Windows EOL
CRLF
correctly. I stepped through the Rust code in my debugger and tracked the issue to thenext_token
function in lexer.rs. The actual error that is generated when Scryer tries to read a file (either .scryerrc when saved withCRLF
) or any file loaded via[<filename>]
is coming fromget_back_quoted_string
which initially caused me some confusion since my test file doesn't have back quoted strings. Eventually I realized whyget_back_quoted_string
is being called is because it's the last clause in the series ofif
statements inname_token
so whennext_token
doesn't recognize the\r
character of aCRLF
marker, it delegates toname_token
to figure out\r
, the since theif
conditions don't match\r
the last clause, namelyget_back_quoted_string
gets executed which is what generates the ultimate error.While I can work around this issue by saving my files using the Unix convention, I thought I'd take a crack at fixing this problem and opening a pull request. But I'd like some advice on the best way to fix this.
I can see two possible ways here;
Fix
next_token
so when it sees a\r
it needs to skip it and check the next character to see if it's a\n
then it's recognized as end of line and proceeds from there.Arrange it so whenever a file is read into memory, all
CRLF
markers are converted toLF
so the lexer processes it correctly.Fix no. 1 seems better to me, but do you have any preferences or a better idea?
Beta Was this translation helpful? Give feedback.
All reactions