DavidKinder / Inform6

The latest version of the Inform 6 compiler, used for generating interactive fiction games.
http://inform-fiction.org/
Other
204 stars 34 forks source link

Separate Global and Array directives; accept "Global glob val" #195

Closed erkyrath closed 2 years ago

erkyrath commented 2 years ago

This change removes the (extremely deprecated) forms

Global array --> size;
Global array data ...;
Global array initial ...;
Global array initstr ...;

...and other uses of the Global directive to define arrays. (I don't even remember what data, initial, or initstr meant.) That is, the Global and Array directives no longer overlap at all.

I have therefore divided the make_global(array_flag) function into separate functions make_global() and make_array(), to the considerable simplification of both.

(Git's diffs are not very informative, mind you. Compare the original function side-by-side with the new ones.)

With that change in place, I was able to make the = sign in the Global directive optional, just as it is in the Constant directive. So all of these are now legal:

Constant c1 11;
Constant c2 = 22;
Global g1 33;
Global g2 = 44;

Fixes https://github.com/DavidKinder/Inform6/issues/190 .

I also fixed https://github.com/DavidKinder/Inform6/issues/194 while I was at it.

erkyrath commented 2 years ago

See https://github.com/erkyrath/Inform6-Testing/blob/globalsplit/src/globalarray.inf for tests. The ifdefed-out blocks are syntax errors.