Puny Abbreviations

This is from the inform 6 FAQs:

[ BeforeParsing x;
for (wn=2 : wn<parse->1 : wn++)
if (buffer->(parse->(4*wn + 1)) == '.' &&
parse-->(2*wn - 3) == 'dr' or 'mr' or 'mrs' or 'prof' or
'rev' or 'st' && parse-->(2*wn + 1) == 'jekyll' or 'hyde') {
buffer->(parse->(4*wn + 1)) = ' ';
x++;
}
if (x) @tokenise buffer parse;
];

But it doesn’t seem to work in punyinform. i get a compiler error indicating that it doesn’t like using --> to access a -> or string array. i’ve tried changing all the --> to -> as well as various other combinations. this pleases the compiler but the code doesn’t work.

is there a workaround for this?

sorry, i can’t seem to get the site to quit automatically replacing my dash>arrows to simply an arrow…

Copy the value of parse to a local variable, and use the local variable instead of parse.

Also, it’s not a compiler error, it’s a warning. Big difference. If you only get a warning, it means compiler has managed to compiled the source code, but it wants to warn you that something you did in the code may have been a mistake.

works perfectly. thx!

Gotta put a backslash before the last - in the arrow. It’s annoying!

1 Like

The reason this is a problem is that Inform requires you to declare an array as having either byte-sized elements or word-sized elements, but the parse array is special, as it has a mix of both. The structure of the parse array is hard-wired into the Z-machine.

To write code elements in text, surround them with single backticks/backquotes. This should avoid unwanted character replacements.