<pclass="commentary firstcommentary"><aid="SP1"class="paragraph-anchor"></a><b>§1. </b>The following handles sentences like
</p>
<blockquote>
<p>A container has a number called rating.</p>
</blockquote>
<pclass="commentary">in which the "number called rating" construction is a <spanclass="extract"><spanclass="extract-syntax">PROPERTYCALLED_NT</span></span>
subtree, and also sentences like
</p>
<blockquote>
<p>A fruit has a colour.</p>
</blockquote>
<pclass="commentary">in which there's only a leaf on the left-hand-side — in fact an <spanclass="extract"><spanclass="extract-syntax">PROPER_NOUN_NT</span></span>
node, though of course it's not an object. This is most neatly handled with
a recursive traverse of the left-hand subtree.
</p>
<pclass="commentary">(There's no sentence-handler here since "to have" has been implemented already.)
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">case</span><spanclass="plain-syntax"></span><spanclass="identifier-syntax">PROPERTYCALLED_NT:</span><spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-npa.html#SP1_2"class="named-paragraph-link"><spanclass="named-paragraph">This is a subtree citing a kind of value plus a name</span><spanclass="named-paragraph-number">1.2</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">case</span><spanclass="plain-syntax"></span><spanclass="identifier-syntax">UNPARSED_NOUN_NT:</span><spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-npa.html#SP1_1"class="named-paragraph-link"><spanclass="named-paragraph">This is a leaf containing just a property name</span><spanclass="named-paragraph-number">1.1</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="identifier-syntax">internal_error</span><spanclass="plain-syntax">(</span><spanclass="string-syntax">"NewPropertyAssertions::recursively_declare on a node of unknown type"</span><spanclass="plain-syntax">);</span>
<pclass="commentary firstcommentary"><aid="SP1_1"class="paragraph-anchor"></a><b>§1.1. </b>Note that the property name may not yet exist; in which case the following
automatically creates it.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">This is a leaf containing just a property name</span><spanclass="named-paragraph-number">1.1</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"this would create a property called 'number' or 'text'"</span><spanclass="plain-syntax">,</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"and although bare names of kinds are usually allowed as properties, "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"these aren't. Instead, try '... has a number called position.' or "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"something like that, to give the property a name."</span><spanclass="plain-syntax">);</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-npa.html#SP1_1_1"class="named-paragraph-link"><spanclass="named-paragraph">Disallow this kind as a new owner of a value property</span><spanclass="named-paragraph-number">1.1.1</span></a></span><spanclass="plain-syntax">;</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-npa.html#SP1">§1</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP1_1_1"class="paragraph-anchor"></a><b>§1.1.1. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Disallow this kind as a new owner of a value property</span><spanclass="named-paragraph-number">1.1.1</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"this is a kind of value which is not allowed to have properties of its own"</span><spanclass="plain-syntax">,</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"because this would cause confusion with variables, which are more useful in "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"most cases. (See the Kinds index for which kinds can have properties.)"</span><spanclass="plain-syntax">);</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"this is a kind of value which is not allowed to have properties of its own"</span><spanclass="plain-syntax">,</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"because this would be impossible to store in any sensible way. For instance, "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"'A scene has a number called difficulty.' is fine because there are not many "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"scenes and I know them all, but 'A number has a text called French translation.' "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"is not allowed, because storing something for every possible number takes an "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"impossible amount of space. (See the Kinds index for which kinds can have "</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-npa.html#SP1_1">§1.1</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP1_2"class="paragraph-anchor"></a><b>§1.2. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">This is a subtree citing a kind of value plus a name</span><spanclass="named-paragraph-number">1.2</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-npa.html#SP1">§1</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP2"class="paragraph-anchor"></a><b>§2. </b>The following handles a second kind of recursion: using "and" to divide
several property names, e.g., in
</p>
<blockquote>
<p>A door has numbers called length and width.</p>
<spanclass="reserved-syntax">void</span><spanclass="plain-syntax"></span><spanclass="function-syntax">NewPropertyAssertions::recursively_call</span><buttonclass="popup"onclick="togglePopup('usagePopup2')"><spanclass="comment-syntax">?</span><spanclass="popuptext"id="usagePopup2">Usage of <spanclass="code-font"><spanclass="function-syntax">NewPropertyAssertions::recursively_call</span></span>:<br/><ahref="4-npa.html#SP1_2">§1.2</a></span></button><spanclass="plain-syntax">(</span><spanclass="identifier-syntax">parse_node</span><spanclass="plain-syntax"> *</span><spanclass="identifier-syntax">owner_ref</span><spanclass="plain-syntax">,</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-npa.html#SP2_1"class="named-paragraph-link"><spanclass="named-paragraph">Deal with an individual property being declared</span><spanclass="named-paragraph-number">2.1</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"> }</span>
<spanclass="plain-syntax">}</span>
</pre>
<pclass="commentary firstcommentary"><aid="SP2_1"class="paragraph-anchor"></a><b>§2.1. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Deal with an individual property being declared</span><spanclass="named-paragraph-number">2.1</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-npa.html#SP2_1_1"class="named-paragraph-link"><spanclass="named-paragraph">Find the kind of value being asked for</span><spanclass="named-paragraph-number">2.1.1</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-npa.html#SP2_1_2"class="named-paragraph-link"><spanclass="named-paragraph">Issue a problem message if the property kind is just "value"</span><spanclass="named-paragraph-number">2.1.2</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-npa.html#SP2_1_3"class="named-paragraph-link"><spanclass="named-paragraph">Issue a problem message for giving the wrong kind of an existing property</span><spanclass="named-paragraph-number">2.1.3</span></a></span><spanclass="plain-syntax">;</span>
</pre>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-npa.html#SP2">§2</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP2_1_1"class="paragraph-anchor"></a><b>§2.1.1. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Find the kind of value being asked for</span><spanclass="named-paragraph-number">2.1.1</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">else</span><spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-npa.html#SP2_1_1_1"class="named-paragraph-link"><spanclass="named-paragraph">Issue a problem message for a non-kind as the property kind</span><spanclass="named-paragraph-number">2.1.1.1</span></a></span><spanclass="plain-syntax">;</span>
</pre>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-npa.html#SP2_1">§2.1</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP2_1_1_1"class="paragraph-anchor"></a><b>§2.1.1.1. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Issue a problem message for a non-kind as the property kind</span><spanclass="named-paragraph-number">2.1.1.1</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"You wrote %1, which I am reading as a request to make a new named property - "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"a value associated with an object and which has a name. But you write this "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"as if it were a variable, which is not allowed because it would confuse "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"things. For example, 'A scene has a number that varies called the completion "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"bonus.' is not allowed - it should just be 'A scene has a number called "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"the completion bonus.', that is, without the 'that varies'."</span><spanclass="plain-syntax">);</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-npa.html#SP2_1_1">§2.1.1</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP2_1_2"class="paragraph-anchor"></a><b>§2.1.2. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Issue a problem message if the property kind is just "value"</span><spanclass="named-paragraph-number">2.1.2</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-npa.html#SP2_1">§2.1</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP2_1_3"class="paragraph-anchor"></a><b>§2.1.3. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Issue a problem message for giving the wrong kind of an existing property</span><spanclass="named-paragraph-number">2.1.3</span></span><spanclass="comment-syntax"> =</span>