-
Made a set of changes to improve library-wide validation.
- Out-of-range integer fields now cause file parse to fail. (Previously, such fields were silently clipped.)
- The behavior of the string split function was made consistent between the stdc++ and Qt builds.
- The bounds of numeric values are now checked more strictly in the Qt build, consistent with the stdc++ build.
-
Made a set of changes to standardize the PGE-X file format:
- Sections:
-
Ignore section names that are all spaces. Fail to parse on section names including nul.
-
Remove old, unused subsection syntax.
This means that the file
A B B_END FIELD:VALUE; A_END
now treats "A" as a text section with contents
B\nB_END\nFIELD_VALUE;
, instead of as a data section with a subsectionB
and a single item.
-
- Data lines:
-
Data lines must end with a semicolon.
This invalidates lines
F1:V1;F2:V2?
(previously parsed asF1:V1;F2:V2;
) andF1:V1;F2
(previously parsed asF1:V1;
). -
If a data line embeds a nul byte, the file is malformed and behavior is undefined. (For now, the remainder of the line is silently ignored, but there must still be a semicolon immediately before the line ending. This behavior may arbitrarily change in the future.)
-
Markers (tags) in data lines may not include the characters
\
,:
, or;
. (As before, values in data lines must escape the characters:
and;
with a backslash.)This invalidates lines
F1\::V1;
,F1\\:V1;
andF1\;:V1;
, but does not invalidate linesF1:V1\:;
,F1:V1\\;
orF1:V1\;;
.
-
- Markers (tags) in data lines may be repeated. If they are repeated, only the data from the last marker will be kept. However, all values, even the ones that will be overwritten, must be validly formatted.
- Previously, invalid substructure arrays preceding valid ones were silently ignored.
- This invalidates (for example),
ET:"Event Name";SSS:["F1;V1;"];SSS:["F1:V1;"];
(previously parsed asET:"Event Name";SSS:["F1:V1;"];
).
- Strings:
-
A string may not comprise of a single
"
character. This invalidates lineSTR:";
(previously parsed asSTR:"";
). -
If a string includes a
\
followed by a non-escape character, the\
is now silently ignored. (Previously, the\
was included in the unescaped string.)This means that
STR:"\a";
(previously parsed asSTR:"\\a";
) is now parsed asSTR:"a";
.
-
- Arrays:
-
An array may include no entries. This makes
ARR:[];
valid.(Such arrays match the default array, so they will not be saved by any future tooling.)
-
An array may not reopened after it has been closed. This invalidates
ARR:["A"]["B"];
(previously parsed asARR:["A","B"];
). -
An array must be closed. This invalidates
ARR:["A";
andARR:["A",;
(previously parsed asARR:["A"];
). -
Array items do not need to escape the characters
[
,]
, or,
.This makes
ARR["[,]"];
valid, and it parses identically toARR["\[\,\]"];
.(For compatibility, the save routines will continue to escape these characters in strings indefinitely.)
-
Escape characters are passed to the array item's parser. This fixes the parse of
LS:["a\nd"];
(previously parsed asLS:["and"];
).
-
- Numeric types:
-
An unsigned int must not be empty. This invalidates
UINT:;
(previously parsed asUINT:0;
). -
Floating point values must not use
,
as the decimal separator. This invalidatesDBL:1,2;
(previously parsed asDBL:1.2;
). -
Floating point values must not use
E
as the exponent separator. This invalidatesDBL:1E2;
(previously parsed asDBL:1e2;
). -
Floating point values must not use the sign character
+
. This invalidatesDBL:+1;
(previously parsed asDBL:1;
).- (As always, the floating point exponent may use the sign character
+
.DBL:1e+1
andDBL:1e1
have the same meaning.)
- (As always, the floating point exponent may use the sign character
-
Floating point values may end with
.
, but must have at least 1 digit. The exponent must have at least 1 and at most 4 digits.This invalidates
DBL:1e12345;
, and makesDBL:1.;
valid. -
Floating point values may not overflow to infinity. This invalidates
DBL:1e999;
.- (As always, they may leave the underlying type's range of integer precision.)
-
- Sections:
-
LVLX:
SECTION
:SC
: section index must be >= 0 and <= 1000. Any other value will cause a parse failure. This invalidatesSC:-1;
(previously crashed parser) andSC:1000000;
(previously caused hang and/or allocation failure).
EVENTS_CLASSIC
:SSS
(section settings):ID
: section index must be >= 0 and <= 1000. Any other value will cause a parse failure. This invalidatesID:-1;
(previously crashed parser) andID:1000000;
(previously caused hang and/or allocation failure).AST
: autoscroll type must not exceed the maximum 32-bit signed integer,2 147 483 647
. This invalidatesAST:3000000000;
(previously silently parsed in an undefined way).SHX
: load section height expression from field with markerSHX
(was previously incorrectly saved toSHX
but loaded fromSWH
).
ML
(move layers):SXX
: load x speed expression from field with markerSXX
(was previously incorrectly saved toSXX
but loaded fromAXX
).SYX
: load y speed expression from field with markerSYX
(was previously incorrectly saved toSYX
but loaded fromAYX
).
CUSTOM_ITEMS_38A
:-
Field
T
(type) is required and must be 0 (block), 1 (bgo), or 2 (effect). This invalidatesT:3;ID:0;D:["1=2"];
andID:0;D:["1=2"];
(previously interpreted in an unspecified way). -
D
: data keys must not exceed the maximum 32-bit signed integer,2 147 483 647
. This invalidatesT:0;ID:0;D:["3000000000=0"];
(previously silently parsed in an undefined way). -
Each item in
D
must be exactly of the formINT=LONG
. This invalidatesD:["1=2=..."];
(previously interpreted asD:["1=2"];
).(Note also that the stdc++ build previously interpreted
==1==2==
as1=2
, ignoring any empty segments of the string when split by=
. This error did not affect the Qt build used in the Moondust Editor.)
-
-
WLDX:
-
META_BOOKMARKS
: fixed the types of fieldsX
andY
(float
, wasint
).This makes
BM:"Name";X:128.0;Y:128.0;
valid. -
AREARECTS
: fixed the type of fieldTP
(unsigned int
, wasint
).This invalidates
TP:-1;
(which previously set the touch policy to an indeterminate value).
-