Skip to content

Commit 553d1bd

Browse files
ntreldlang-bot
authored andcommitted
[spec] Improve PrimaryExpression docs
Refactor PrimaryExpression with LiteralExpression. This makes it easier to read the other rules. Add table showing key unnamed multiple-token rules.
1 parent 0723b37 commit 553d1bd

File tree

1 file changed

+33
-17
lines changed

1 file changed

+33
-17
lines changed

spec/expression.dd

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,20 +1861,8 @@ $(GNAME PrimaryExpression):
18611861
$(D .) $(IDENTIFIER)
18621862
$(GLINK2 template, TemplateInstance)
18631863
$(D .) $(GLINK2 template, TemplateInstance)
1864-
$(RELATIVE_LINK2 this, $(D this))
1865-
$(RELATIVE_LINK2 super, $(D super))
1866-
$(RELATIVE_LINK2 null, $(D null))
1867-
$(LEGACY_LNAME2 true_false)$(DDSUBLINK spec/type, bool, `true`)
1868-
$(DDSUBLINK spec/type, bool, `false`)
18691864
$(RELATIVE_LINK2 IndexOperation, `$`)
1870-
$(GLINK_LEX IntegerLiteral)
1871-
$(GLINK_LEX FloatLiteral)
1872-
$(LEGACY_LNAME2 CharacterLiteral)$(LEGACY_LNAME2 character-literal)$(GLINK_LEX CharacterLiteral)
1873-
$(RELATIVE_LINK2 string_literals, *StringLiteral*)
1874-
$(GLINK2 istring, InterpolationExpressionSequence)
1875-
$(GLINK ArrayLiteral)
1876-
$(GLINK AssocArrayLiteral)
1877-
$(GLINK FunctionLiteral)
1865+
$(GLINK LiteralExpression)
18781866
$(GLINK AssertExpression)
18791867
$(GLINK MixinExpression)
18801868
$(GLINK ImportExpression)
@@ -1890,12 +1878,40 @@ $(GNAME PrimaryExpression):
18901878
$(D $(LPAREN)) $(GLINK Expression) $(D $(RPAREN))
18911879
$(GLINK SpecialKeyword)
18921880
$(GLINK2 traits, TraitsExpression)
1893-
)
18941881

1895-
$(H3 $(LNAME2 identifier, .Identifier))
1882+
$(GNAME LiteralExpression):
1883+
$(RELATIVE_LINK2 this, $(D this))
1884+
$(RELATIVE_LINK2 super, $(D super))
1885+
$(RELATIVE_LINK2 null, $(D null))
1886+
$(LEGACY_LNAME2 true_false)$(DDSUBLINK spec/type, bool, `true`)
1887+
$(DDSUBLINK spec/type, bool, `false`)
1888+
$(GLINK_LEX IntegerLiteral)
1889+
$(GLINK_LEX FloatLiteral)
1890+
$(LEGACY_LNAME2 CharacterLiteral)$(LEGACY_LNAME2 character-literal)$(GLINK_LEX CharacterLiteral)
1891+
$(RELATIVE_LINK2 string_literals, *StringLiteral*)
1892+
$(GLINK2 istring, InterpolationExpressionSequence)
1893+
$(GLINK ArrayLiteral)
1894+
$(GLINK AssocArrayLiteral)
1895+
$(GLINK FunctionLiteral)
1896+
)
18961897

1897-
$(P See $(DDSUBLINK spec/module, module_scope_operators, Module Scope
1898-
Operator).)
1898+
$(TABLE
1899+
$(THEAD Expression, Description)
1900+
$(TROW $(LNAME2 identifier, `.` *Identifier*),
1901+
$(DDSUBLINK spec/module, module_scope_operators, Module Scope Operator))
1902+
$(TROW `$`, Number of elements in an object $(RELATIVE_LINK2 IndexOperation,
1903+
being indexed/sliced).)
1904+
$(TROW `(` *Type* `).` *Identifier*,
1905+
Access a $(DDLINK spec/property, Properties, type property) or a
1906+
$(DDSUBLINK spec/attribute, static, static member) of a type.)
1907+
$(TROW *FundamentalType* `(arg)`,
1908+
$(RELATIVE_LINK2 uniform_construction_syntax, Uniform construction) of scalar
1909+
type with optional argument.)
1910+
$(TROW `(` *Type* `)(args)`,
1911+
Construct a type with optional arguments.)
1912+
$(TROW `(` *Expression* `)`, Evaluate an expression - useful as a
1913+
$(RELATIVE_LINK2 .define-full-expression, subexpression).)
1914+
)
18991915

19001916
$(H3 $(LNAME2 this, this))
19011917

0 commit comments

Comments
 (0)