10 lines
2.4 KiB
XML
10 lines
2.4 KiB
XML
|
<?xml version="1.0"?>
|
||
|
<clause number="14.5" title="Primary expressions">
|
||
|
<paragraph>Primary expressions include the simplest forms of expressions. <grammar_production><name><non_terminal where="14.5">primary-expression</non_terminal></name> : <rhs><non_terminal where="14.5.10.2">array-creation-expression</non_terminal></rhs><rhs><non_terminal where="14.5">primary-no-array-creation-expression</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="14.5">primary-no-array-creation-expression</non_terminal></name> : <rhs><non_terminal where="9.4.4">literal</non_terminal></rhs><rhs><non_terminal where="14.5.2">simple-name</non_terminal></rhs><rhs><non_terminal where="14.5.3">parenthesized-expression</non_terminal></rhs><rhs><non_terminal where="14.5.4">member-access</non_terminal></rhs><rhs><non_terminal where="14.5.5">invocation-expression</non_terminal></rhs><rhs><non_terminal where="14.5.6">element-access</non_terminal></rhs><rhs><non_terminal where="14.5.7">this-access</non_terminal></rhs><rhs><non_terminal where="14.5.8">base-access</non_terminal></rhs><rhs><non_terminal where="14.5.9">post-increment-expression</non_terminal></rhs><rhs><non_terminal where="14.5.9">post-decrement-expression</non_terminal></rhs><rhs><non_terminal where="14.5.10.1">object-creation-expression</non_terminal></rhs><rhs><non_terminal where="14.5.10.3">delegate-creation-expression</non_terminal></rhs><rhs><non_terminal where="14.5.11">typeof-expression</non_terminal></rhs><rhs><non_terminal where="25.5.8">sizeof-expression</non_terminal></rhs><rhs><non_terminal where="14.5.12">checked-expression</non_terminal></rhs><rhs><non_terminal where="14.5.12">unchecked-expression</non_terminal></rhs></grammar_production></paragraph>
|
||
|
<paragraph>Primary expressions are divided between <non_terminal where="14.5.10.2">array-creation-expression</non_terminal>s and <non_terminal where="14.5">primary-no-array-creation-expression</non_terminal>s. Treating <non_terminal where="14.5.10.2">array-creation-expression</non_terminal> in this way, rather than listing it along with the other simple expression forms, enables the grammar to disallow potentially confusing code such as <code_example><![CDATA[
|
||
|
object o = new int[3][1];
|
||
|
]]></code_example>which would otherwise be interpreted as <code_example><![CDATA[
|
||
|
object o = (new int[3])[1];
|
||
|
]]></code_example></paragraph>
|
||
|
</clause>
|