Skip to content

Commit d8e6268

Browse files
authored
[spec/expression] Tweak Slicing formatting (#4282)
Use GRAMMAR_INLINE macro. Use a list for different kinds of base expression. Add link to pointers.
1 parent 82d0bb7 commit d8e6268

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

spec/expression.dd

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,29 +1898,26 @@ $(GNAME Slice):
18981898
The special variable `$` is declared and set to be the number
18991899
of elements in the $(I PostfixExpression) (when available).
19001900
A new declaration scope is created for the evaluation of the
1901-
$(I AssignExpression)`..`$(I AssignExpression) and `$` appears in
1901+
$(GRAMMAR_INLINE *AssignExpression* .. *AssignExpression*) and `$` appears in
19021902
that scope only.
19031903
)
19041904

1905-
$(P If the base $(I PostfixExpression) is a static or dynamic
1905+
* If the base $(I PostfixExpression) is a static or dynamic
19061906
array `a`, the result of the slice is a dynamic array
19071907
referencing elements `a[i]` to `a[j-1]` inclusive, where `i`
19081908
and `j` are integers evaluated from the first and second $(I
19091909
AssignExpression) respectively.
1910-
)
19111910

1912-
$(P If the base $(I PostfixExpression) is a pointer `p`, the result
1911+
* If the base $(I PostfixExpression) is a $(DDSUBLINK spec/type, pointers, pointer) `p`, the result
19131912
will be a dynamic array referencing elements from `p[i]` to `p[j-1]`
19141913
inclusive, where `i` and `j` are integers evaluated from the
19151914
first and second $(I AssignExpression) respectively.
1916-
)
19171915

1918-
$(P If the base $(I PostfixExpression) is a $(DDSUBLINK spec/template, variadic-templates, $(I ValueSeq)), then
1916+
* If the base $(I PostfixExpression) is a $(DDSUBLINK spec/template, variadic-templates, $(I ValueSeq)), then
19191917
the result of the slice is a new $(I ValueSeq) formed
19201918
from the upper and lower bounds, which must statically evaluate
19211919
to integral constants.
19221920
It is an error if those bounds are out of range.
1923-
)
19241921

19251922
$(P The first $(I AssignExpression) is taken to be the inclusive
19261923
lower bound

0 commit comments

Comments
 (0)