Long Comments and Long Strings

-4

I would like an appropriate explanation of what Long and Long Strings are, even though they may be small resources.

    
asked by anonymous 27.01.2017 / 22:33

1 answer

2

Long Comments are comments using Long Format . Long Strings represent strings, but also using Long Format.

Long Format

Long Format is a format that differentiates between versions -5.1 and +5.2.

Version 5.1

In this version, the format starts with the string [[ and ends with the sequence ]] related (the same pairs can be repeated inside).

Version 5.2

In this version the format receives a lock level. The format only starts if its start is valid. The beginning starts with [ and counts the = symbols until ] appears to finalize itself. If there was any character outside = and [ , then the format does not start.

The lock level will be the amount of assigns ( = ).

The end of the format is similar to the start, it only changes [ to ] and requires the same amount of assigns.

Long Comment

Nothing special about your format, other than the format should be declared after -- .

Long String

The format of the long string does not interpret escape ( \ ), requires an end, and has two background actions:

  • Converts the string of bytes 0D 0A (carriage return and new line, \ r \ n) and byte 0D (\ r) to 0A (\ n) li>

  • Ignores the first line break ( 0D 0A , 0A or 0D ) followed by its start

The language interpreter assumes that the bytes of the target code are character codes, so any future problems relate to the encoding of their characters.

    
27.01.2017 / 22:33