This document proposes several backslash-escape sequences for the NFO format.
In literal strings, the backslash functions mostly as it does in C:
\\, \n, and \" function as in C; inserting a single backslash, a line feed (0D), and a double quote (22), respectively.
\<hex> (up to two hex characters) inserts the byte <hex>
\U<hex> (up to four hex characters) inserts the UTF-8 encoding of the Unicode character U+<hex>.
An unrecognized extension is an error.
Outside of literal strings, the backslash is followed by two or more
characters of the basic formats <action><operator> or <width><data>.
The <action><width> format constructs the one-byte <operation> values. <action> indicates which action this extention is for, and <operator> is a C operator related to the function of the extension's byte value, or something vaguely related to a C operator. Or something else.
The <width><data> format constructs fields of the specified width from the corresponding data.
Again, an unrecognized extension is an error.
The extension strings and their meanings are as follows:
|\2+ addition||\2- subtraction||\2< signed min||\2> signed max||\2u< unsigned min||\2u> unsigned max|
|\2/ signed division||\2% signed modulo||\2u/ unsigned division||\2u% unsigned modulo||\2* multiplication||\2& bitwise and|
|\2| bitwise or||\2^ bitwise xor|
|\71 bit set||\70 bit clear||\7= equal||\7! not equal||\7< less than||\7> greater than|
|\7G GRF active||\7g GRF inactive|
|\7gG GRF is not active but will be||\7GG GRF is or will be active||\7gg GRF is not and will not be active|
|\7C cargo available||\7c cargo not available|
The capital/small pairs in here attempt to follow the logic of NFORenum's -W/-w: capital means enabled/available, small means disabled/not available.
|\D= assign||\D+ addition||\D- subtraction||\D* signed multiply||\Du* unsigned multiply||\D<< signed left-shift|
|\Du<< unsigned left-shift||\D| bitwise or||\D& bitwise and||\D/ signed division||\Du/ unsigned division||\D% signed modulo|
|\Du% unsigned modulo|
|\DR reserve||\DF find||\DM mark||\DC check|
|\DnF no-fail find||\DnC no-fail check||\DO get owner|
<dec> is any decimal number, <hex> is any hexadecimal number, limited to four or eight characters depend on whether it's in a \w or a \d.
<year> is any number 1920..2175, which will be converted to the corresponding 00..FF byte.
<YMD> is <YYYY>/<MM>/<DD> or <YYYY>-<MM>-<DD>, <DMY> is <DD>/<MM>/<YYYY> or <DD>-<MM>-<YYYY>
<YYYY> is a two or four digit year, <MM> is a one or two digit month, and <DD> is a one or two digit day. If <YYYY> is 1932..2000, the first two digits may be dropped, otherwise all four digits are required.
Although the escape sequences have certain logical usages, they may be used anywhere their associated byte(s) appear(s). Although not recomended, it is perfectly valid to, for example, start an action 0 with a \2+ or an action 1 with a \70.