Re: OK what does ` mean - seriously seems to be not documented.

new topic     » goto parent     » topic index » view thread      » older message » newer message
gimlet said...

Derek,

Well say you have a string like:

.."crlf" = `\r\n`.. 
- this is a very contrived example but ..

The idea is you would read in lines like this and using value() or a user-defined function put them into key-value pairs.

You remain confused. Text like that is illegal in source code. If you are reading lines, then you need to read the text file in as input.

As Derek just said,

DerekParnell said...

And this is where we might have been confused. The back-tick and double-quote notation is only applicable to string LITERALS in your source code text, not in text files in general.

...

you need to open the file ... and process the incoming bytes yourself.

gimlet said...

It would be a major inconvenience to have to parse the string to get this functionality.

It seems perfectly reasonable that someone (given the functionality of value() may want to be able to read in multi-line strings and raw byte-strings.

Of course it is a slippery slope.

Incidently, I just tested this, and it seems that if you are using get() with a text file opened in binary mode, or you are using value() with a sequence, then any heredoc strings are read in preserving the carriage return. So the behavior of the heredoc strings in get.e and the raw strings handled by the Euphoria parser differs.

So if you are using get() to handle string literals, then the behavior you desire is already there.

gimlet said...

It would be nice to also be able to refer to the binary value \r\n but the \r is stripped.

Just use {13, 10}

gimlet said...

In this particular case you should end up with a key which refers to the regex \r\n.

Unless you are just checking for CRLF, that's not actually a regex. A regex should be more like ".*\r\n.*" or something, depending on what exactly you are trying to do.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu