Dict flags (for dict_par1) now include //p, //n, //~p, //~n. These are handled consistently:
//p sets the PLURAL flag (bit 2)
//n sets the NOUN flag (bit 7)
//~p means don't set the PLURAL flag (this time)
//~n means don't set the NOUN flag (this time)
Note that //~p or //~n does not clear a flag. If a word appears with both //p and //~p, the flag winds up set; //p wins. Similarly for //n and //~n.
Dict words used in most contexts default to //n. So only the //p and //~n flags are useful. The others are implemented for the sake of consistency.
You can chain them: //p~n if you really want. //~ with no letter is invalid. Letters other than p and n are invalid. // with nothing after it means "this is a dict word", as it always has.
Motivation:
Existing I6 code will compile exactly as it used to.
The //~n flag is meant to be used in library routines like LanguageVerbMayBeName() and LanguageVerbLikesAdverb(), to avoid giving common library verbs the NOUN flag. I don't expect game authors to use or care about it.
I thought about adding //v for VERB. But setting the VERB flag without creating a grammar table entry (in dict_par2) will only screw up the parser.
Remember that you can set any dict flag on any word with the Dictionary directive. (But not clear.)
Details:
The compiler used to ignore the //p flag in Verb directives. I guess that was intended as a safety check. But I can't imagine it ever came up, and it complicated the logic unnecessarily. I removed that check.
I renamed the number_and_case global to prepared_dictflags_pos, and added prepared_dictflags_neg. These values are set up by the dictionary_prepare_z/g() routines.
I tidied up the dictionary_add() code considerably. I also fixed a place where the flags were being treated as 8-bit values in Glulx. (We only use the low eight bits, but they are 16-bit values in Glulx. The dictionary_add() routine might as well handle that consistently.)
I also renamed the x, y, z arguments of dictionary_add() to flag1, flag2, flag3.
Handles https://github.com/DavidKinder/Inform6/issues/259 .
This PR is on top of (and includes) https://github.com/DavidKinder/Inform6/pull/261 . It'll be easier to read the changes here if you merge that one first.
Dict flags (for dict_par1) now include
//p
,//n
,//~p
,//~n
. These are handled consistently://p
sets the PLURAL flag (bit 2)//n
sets the NOUN flag (bit 7)//~p
means don't set the PLURAL flag (this time)//~n
means don't set the NOUN flag (this time)Note that
//~p
or//~n
does not clear a flag. If a word appears with both//p
and//~p
, the flag winds up set;//p
wins. Similarly for//n
and//~n
.Dict words used in most contexts default to
//n
. So only the//p
and//~n
flags are useful. The others are implemented for the sake of consistency.You can chain them:
//p~n
if you really want.//~
with no letter is invalid. Letters other thanp
andn
are invalid.//
with nothing after it means "this is a dict word", as it always has.Motivation:
Existing I6 code will compile exactly as it used to.
The
//~n
flag is meant to be used in library routines like LanguageVerbMayBeName() and LanguageVerbLikesAdverb(), to avoid giving common library verbs the NOUN flag. I don't expect game authors to use or care about it.I thought about adding
//v
for VERB. But setting the VERB flag without creating a grammar table entry (in dict_par2) will only screw up the parser.Remember that you can set any dict flag on any word with the
Dictionary
directive. (But not clear.)Details:
The compiler used to ignore the
//p
flag inVerb
directives. I guess that was intended as a safety check. But I can't imagine it ever came up, and it complicated the logic unnecessarily. I removed that check.I renamed the
number_and_case
global toprepared_dictflags_pos
, and addedprepared_dictflags_neg
. These values are set up by the dictionary_prepare_z/g() routines.I tidied up the dictionary_add() code considerably. I also fixed a place where the flags were being treated as 8-bit values in Glulx. (We only use the low eight bits, but they are 16-bit values in Glulx. The dictionary_add() routine might as well handle that consistently.)
I also renamed the
x
,y
,z
arguments of dictionary_add() toflag1
,flag2
,flag3
.The test file https://github.com/erkyrath/Inform6-Testing/blob/antinoun/src/dictnewflagtest.inf goes through a bunch of cases. I also created https://github.com/erkyrath/Inform6-Testing/blob/antinoun/i6lib-611w/English.h , a modified version of the i6lib-611/English.h, which uses
//~n
in the recommended way.