Skip to content

Commit 452155b

Browse files
committed
More updates to istring spec. Renumber chapters
1 parent 8f1b0ea commit 452155b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+109
-62
lines changed

posix.mak

+2-2
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ PREMADE=fetch-issue-cnt.php robots.txt .htaccess .dpl_rewrite_map.txt ads.txt \
317317
# and .html in the generated HTML. These are also used for the mobi
318318
# book generation, for which reason the list is sorted by chapter.
319319
SPEC_ROOT=$(addprefix spec/, \
320-
spec intro lex grammar module declaration type property attribute pragma \
321-
expression statement arrays hash-map struct class interface enum \
320+
spec intro lex istring grammar module declaration type property attribute \
321+
pragma expression statement arrays hash-map struct class interface enum \
322322
const3 function operatoroverloading template template-mixin contracts \
323323
version traits errors unittest garbage float iasm ddoc \
324324
interfaceToC cpp_interface objc_interface portability entity memory-safe-d \

spec/abi.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1077,5 +1077,5 @@ $(SPEC_SUBNAV_PREV_NEXT memory-safe-d, Memory Safety, simd, Vector Extensions)
10771077
)
10781078

10791079
Macros:
1080-
CHAPTER=38
1080+
CHAPTER=39
10811081
TITLE=Application Binary Interface

spec/arrays.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,6 @@ $(SPEC_SUBNAV_PREV_NEXT statement, Statements, hash-map, Associative Arrays)
13861386
)
13871387

13881388
Macros:
1389-
CHAPTER=12
1389+
CHAPTER=13
13901390
TITLE=Arrays
13911391
_=

spec/attribute.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1192,5 +1192,5 @@ $(SPEC_SUBNAV_PREV_NEXT property, Properties, pragma, Pragmas)
11921192
)
11931193

11941194
Macros:
1195-
CHAPTER=8
1195+
CHAPTER=9
11961196
TITLE=Attributes

spec/betterc.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,5 @@ $(SPEC_SUBNAV_PREV_NEXT simd, Vector Extensions, importc, ImportC)
143143
)
144144

145145
Macros:
146-
CHAPTER=40
146+
CHAPTER=41
147147
TITLE=Better C

spec/class.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,6 @@ $(SPEC_SUBNAV_PREV_NEXT struct, Structs and Unions, interface, Interfaces)
14641464
)
14651465

14661466
Macros:
1467-
CHAPTER=15
1467+
CHAPTER=16
14681468
TITLE=Classes
14691469
_=

spec/const3.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ $(SPEC_SUBNAV_PREV_NEXT enum, Enums, function, Functions)
784784
)
785785

786786
Macros:
787-
CHAPTER=18
787+
CHAPTER=19
788788
TH1=<th class="nobr">$(CODE $0)</th>
789789
TD1=<td class="nobr">$(CODE $0)</td>
790790
TDE=<td class="nobr">$(GREEN $(CODE $0))</td>

spec/contracts.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ $(SPEC_SUBNAV_PREV_NEXT template-mixin, Template Mixins, version, Conditional Co
5151
)
5252

5353
Macros:
54-
CHAPTER=23
54+
CHAPTER=24
5555
TITLE=Contract Programming

spec/cpp_interface.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1117,5 +1117,5 @@ $(SPEC_SUBNAV_PREV_NEXT interfaceToC, Interfacing to C, objc_interface, Interfac
11171117
)
11181118

11191119
Macros:
1120-
CHAPTER=33
1120+
CHAPTER=34
11211121
TITLE=Interfacing to C++

spec/ddoc.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1345,5 +1345,5 @@ $(SPEC_SUBNAV_PREV_NEXT iasm, D x86 Inline Assembler, interfaceToC, Interfacing
13451345
)
13461346

13471347
Macros:
1348-
CHAPTER=31
1348+
CHAPTER=32
13491349
TITLE=Documentation Generator

spec/declaration.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -889,5 +889,5 @@ $(SPEC_SUBNAV_PREV_NEXT module, Modules, type, Types)
889889

890890

891891
Macros:
892-
CHAPTER=5
892+
CHAPTER=6
893893
TITLE=Declarations

spec/entity.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,5 +291,5 @@ $(SPEC_SUBNAV_PREV_NEXT portability, Portability Guide, memory-safe-d, Memory Sa
291291
)
292292

293293
Macros:
294-
CHAPTER=36
294+
CHAPTER=37
295295
TITLE=Named Character Entities

spec/enum.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,6 @@ $(SPEC_SUBNAV_PREV_NEXT interface, Interfaces, const3, Type Qualifiers)
402402
)
403403

404404
Macros:
405-
CHAPTER=17
405+
CHAPTER=18
406406
TITLE=Enums
407407
CATEGORY_SPEC=$0

spec/errors.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,5 +212,5 @@ $(SPEC_SUBNAV_PREV_NEXT traits, Traits, unittest, Unit Tests)
212212
)
213213

214214
Macros:
215-
CHAPTER=26
215+
CHAPTER=27
216216
TITLE=Errors

spec/expression.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -3399,7 +3399,7 @@ $(SPEC_SUBNAV_PREV_NEXT pragma, Pragmas, statement, Statements)
33993399
)
34003400

34013401
Macros:
3402-
CHAPTER=10
3402+
CHAPTER=11
34033403
TITLE=Expressions
34043404
IDENTIFIER=$(GLINK_LEX Identifier)
34053405
USUAL_ARITHMETIC_CONVERSIONS=$(DDSUBLINK spec/type, usual-arithmetic-conversions, Usual Arithmetic Conversions)

spec/float.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,5 @@ $(SPEC_SUBNAV_PREV_NEXT garbage, Garbage Collection, iasm, D x86 Inline Assemble
159159
)
160160

161161
Macros:
162-
CHAPTER=29
162+
CHAPTER=30
163163
TITLE=Floating-Point

spec/function.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -4309,7 +4309,7 @@ $(SPEC_SUBNAV_PREV_NEXT const3, Type Qualifiers, operatoroverloading, Operator O
43094309
)
43104310

43114311
Macros:
4312-
CHAPTER=19
4312+
CHAPTER=20
43134313
TITLE=Functions
43144314
ASSIGNEXPRESSION=$(GLINK2 expression, AssignExpression)
43154315
CHECK=&#10004;

spec/garbage.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -587,5 +587,5 @@ $(SPEC_SUBNAV_PREV_NEXT unittest, Unit Tests, float, Floating Point)
587587
)
588588

589589
Macros:
590-
CHAPTER=28
590+
CHAPTER=29
591591
TITLE=Garbage Collection

spec/glossary.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,6 @@ $(SPEC_SUBNAV_PREV_NEXT windows, Windows Programming, legacy, Legacy Code)
276276
)
277277

278278
Macros:
279-
CHAPTER=44
279+
CHAPTER=45
280280
TITLE=Glossary
281281
D=<span class="d_inlinecode">$0</span>

spec/grammar.dd

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ $(H2 Lexical Syntax)
1010

1111
$(GRAMMAR_SUMMARY)
1212

13-
$(SPEC_SUBNAV_PREV_NEXT lex, Lexical, module, Modules)
13+
$(SPEC_SUBNAV_PREV_NEXT istring, Interpolation Expression Sequence, module, Modules)
1414
)
1515

1616
Macros:
17-
CHAPTER=3
17+
CHAPTER=4
1818
TITLE=D Grammar
1919
IDENTIFIER=$(GLINK Identifier)
2020
EXPRESSION=$(GLINK Expression)

spec/hash-map.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -556,5 +556,5 @@ key: AG, value: 2
556556
$(SPEC_SUBNAV_PREV_NEXT arrays, Arrays, struct, Structs and Unions)
557557

558558
Macros:
559-
CHAPTER=13
559+
CHAPTER=14
560560
TITLE=Associative Arrays

spec/iasm.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1378,5 +1378,5 @@ $(SPEC_SUBNAV_PREV_NEXT float, Floating Point, ddoc, Embedded Documentation)
13781378
)
13791379

13801380
Macros:
1381-
CHAPTER=30
1381+
CHAPTER=31
13821382
TITLE=Inline Assembler

spec/importc.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1010,5 +1010,5 @@ $(SPEC_SUBNAV_PREV_NEXT betterc, Better C, ob, Live Functions)
10101010
)
10111011

10121012
Macros:
1013-
CHAPTER=41
1013+
CHAPTER=42
10141014
TITLE=ImportC

spec/interface.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,5 +360,5 @@ $(SPEC_SUBNAV_PREV_NEXT class, Classes, enum, Enums)
360360
)
361361

362362
Macros:
363-
CHAPTER=16
363+
CHAPTER=17
364364
TITLE=Interfaces

spec/interfaceToC.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ $(SPEC_SUBNAV_PREV_NEXT ddoc, Embedded Documentation, cpp_interface, Interfacing
411411
)
412412

413413
Macros:
414-
CHAPTER=32
414+
CHAPTER=33
415415
TROW2=$(TR2 $(TD $(D $1)), $(TD2 $(D $2) $(TAIL $+)))
416416
TROW3=$(TR3 $(TD $(D $1)), $(TD $(D $2)), $(TD $(D $3)))
417417
TROW3PLUS=$(TR3 $(TD $(D $1)), $(TD $(D $2)), $(TD $(D $3) $4))

spec/istring.dd

+58-15
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ $(SPEC_S Interpolation Expression Sequence,
44

55
$(HEADERNAV_TOC)
66

7-
$(P Interpolation Expression Sequences (IES) are expressions that intersperse string literal data, and values. An interpolation expression is written like a string, but can contain values that are passed directly to a function that is able to accept them. It is transformed into a $(I Sequence) of expressions that can be overloaded or handled by template functions.)
7+
$(P Interpolation Expression Sequences (IES) are expressions that intersperse
8+
string literal data, and values. An interpolation expression is written like a
9+
string, but can contain values that are passed directly to a function that is
10+
able to accept them. It is transformed into a $(I Sequence) of expressions that
11+
can be overloaded or handled by template functions.)
812

913
$(GRAMMAR
1014
$(GNAME InterpolationExpressionSequence):
@@ -51,11 +55,18 @@ $(GNAME InterpolationExpression):
5155

5256
$(H2 $(LNAME2 expression_translation Expression Translation)
5357

54-
$(P When the lexer encounters an Interpolation Expression Sequence, the token is translated into a sequence of expressions, which replaces the single token. The sequence always starts with the expression $(D core.interpolation.InterpolationHeader()) and always ends with $(D core.interpolation.InterpolationFooter()))
58+
$(P When the lexer encounters an Interpolation Expression Sequence, the token
59+
is translated into a sequence of expressions, which replaces the single token.
60+
The sequence always starts with the expression
61+
$(D core.interpolation.InterpolationHeader()) and always ends with
62+
$(D core.interpolation.InterpolationFooter()))
5563

56-
$(P Each part $(D str) of the token which is literal string data is translated into the expression $(D core.interpolation.InterpolatedLiteral!(str)))
64+
$(P Each part $(D str) of the token which is literal string data is translated
65+
into the expression $(D core.interpolation.InterpolatedLiteral!(str)))
5766

58-
$(P Each part $(D $$(LPAREN)expr$(RPAREN)) of the token which is an $(GLINK InterpolationExpression) is translated into the sequence $(D core.interpolation.InterpolatedExpression!(expr), expr).)
67+
$(P Each part $(D $$(LPAREN)expr$(RPAREN)) of the token which is an $(GLINK
68+
InterpolationExpression) is translated into the sequence $(D
69+
core.interpolation.InterpolatedExpression!(expr)$(COMMA) expr).)
5970

6071
------
6172
// simple version of std.typecons.Tuple
@@ -74,36 +85,62 @@ assert(items == tuple(
7485
InterpolationFooter())); // denotes the end of an IES
7586
------
7687

77-
$(H2 $(LNAME2 core_interpolation core.interpolation Header Types)
88+
$(H2 $(LNAME2 core_interpolation core.interpolation Types)
7889

79-
$(P Types defined in $(D core.interpolation) need not be imported to use IES. These are automatically imported when an IES is used. The types are defined so as to make it easy to introspect the IES for processing at compile-time.)
90+
$(P Types defined in $(D core.interpolation) need not be imported to use IES.
91+
These are automatically imported when an IES is used. The types are defined so
92+
as to make it easy to introspect the IES for processing at compile-time.)
8093

8194
$(H3 $(LNAME2 interp_header, InterpolationHeader and InterpolationFooter))
8295

83-
$(P The $(D InterpolationHeader) and $(InterpolationFooter) type are empty structs that allow easy overloading of functions to handle IES. They also can be used to understand which parts of a expression list were passed via IES.)
96+
$(P The $(D InterpolationHeader) and $(InterpolationFooter) type are empty
97+
structs that allow easy overloading of functions to handle IES. They also can
98+
be used to understand which parts of a expression list were passed via IES.)
8499

85-
$(P These types have a $(D toString) definition that returns an empty string, to allow for processing by functions which intend to convert IES to text, such as $(D std.stdio.writeln) or $(D std.conv.text).)
100+
$(P These types have a $(D toString) definition that returns an empty string,
101+
to allow for processing by functions which intend to convert IES to text, such
102+
as $(D std.stdio.writeln) or $(D std.conv.text).)
86103

87104
$(H3 $(LNAME2 interp_literal, InterpolatedLiteral))
88105

89-
$(P The $(D InterpolatedLiteral) type is an empty struct that provides compile-time access to the string literal portion of an IES. This type also provides a $(D toString) member function which returns the literal that is used to construct the type.)
106+
$(P The $(D InterpolatedLiteral) type is an empty struct that provides
107+
compile-time access to the string literal portion of an IES. This type also
108+
provides a $(D toString) member function which returns the part of the
109+
sequence that this value replaced.)
90110

91111
$(H3 $(LNAME2 interp_literal, InterpolatedExpression))
92112

93-
$(P The $(D InterpolatedExpression) type is an empty struct that provides compile-time access to the literal that was used to form the following expression. It provides a $(D toString) member function which returns the empty string. It also has an $(D enum expression) member, which is assigned the text that is used to construct the type.)
113+
$(P The $(D InterpolatedExpression) type is an empty struct that provides
114+
compile-time access to the literal that was used to form the following
115+
expression. It provides a $(D toString) member function which returns the empty
116+
string. It also has an $(D enum expression) member, which is equal to the
117+
template parameter used to construct the type.)
118+
119+
------
120+
string name = "John Doe";
121+
auto ies = i"Hello, $(name)";
122+
static assert(is(typeof(ies[0]) == InterpolationHeader));
123+
static assert(ies[1].toString() == "Hello, ");
124+
static assert(ies[2].expression == "name");
125+
assert(ies[3] == name);
126+
static assert(is(typeof(ies[4]) == InterpolationFooter));
127+
------
94128

95129
$(H2 $(LNAME2 accepting, Accepting and Processing IES))
96130

97-
$(P The recommended mechanism to accept IES is to provide a variadic template function to match the various parameters inside the sequence, surrounded by explicit $(D InterpolationHEader) and $(InterpolationFooter) parameters.)
131+
$(P The recommended mechanism to accept IES is to provide a variadic template
132+
function to match the various parameters inside the sequence, surrounded by
133+
explicit $(D InterpolationHEader) and $(InterpolationFooter) parameters.)
98134

99135
-------
100136
void processIES(Sequence...)(InterpolationHeader, Sequence data, InterpolationFooter)
101137
{
102-
// process data here
138+
// process `data` here
103139
}
104140
-------
105141

106-
$(P An IES can also contain types as interpolation expressions. This can be used by passing to a variadic template parameter.)
142+
$(P An IES can also contain types as interpolation expressions. This can be
143+
used by passing to a variadic template parameter.)
107144

108145
-------
109146
template processIESAtCompileTime(InterpolationHeader header, Sequence...)
@@ -116,7 +153,10 @@ alias result = processIES!i"Here is a type: $(int)";
116153

117154
$(H2 $(LNAME2 tostring, Converting to a String))
118155

119-
$(P In many cases, it is desirable to convert an IES to a $(D string). In these cases, it is recommended to use the Phobos function $(D std.conv.text) to convert the IES to a $(D string) before passing to the function.)
156+
$(P In many cases, it is desirable to convert an IES to a $(D string). The
157+
Phobos function $(D std.conv.text) can convert the IES to a $(D string) for use
158+
in any context where a string is needed, for instance to assign to a string
159+
variable, or call a function that accepts a string.)
120160

121161
-------
122162
import std.conv : text;
@@ -127,7 +167,10 @@ string greeting = i"Hello, $(name)".text; // OK
127167
assert(greeting == "Hello, John Doe");
128168
-------
129169

130-
$(P It is highly recommended for library authors who wish to accept IES to provide an overload that accepts them, rather than rely on $(D std.conv), as this incurs unnecessary allocations. This is especially important where certain types of injection attacks are possible from malicious user-provided data.)
170+
$(P It is highly recommended for library authors who wish to accept IES to
171+
provide an overload that accepts them, rather than rely on $(D std.conv), as
172+
this incurs unnecessary allocations. This is especially important where certain
173+
types of injection attacks are possible from malicious user-provided data.)
131174

132175
$(SPEC_SUBNAV_PREV_NEXT lex, Lexical, grammar, Grammar)
133176
)

spec/legacy.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ $(SPEC_SUBNAV_PREV glossary, Glossary)
5959
)
6060

6161
Macros:
62-
CHAPTER=45
62+
CHAPTER=46
6363
TITLE=Legacy Code

spec/lex.dd

+4-1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ $(GNAME Token):
193193
$(GNAME TokenNoBraces):
194194
$(MULTICOLS 4, $(GLINK Identifier)
195195
$(GLINK StringLiteral)
196+
$(GLINK2 istring, InterpolationExpressionSequence)
196197
$(GLINK CharacterLiteral)
197198
$(GLINK IntegerLiteral)
198199
$(GLINK FloatLiteral)
@@ -654,6 +655,8 @@ $(UL
654655
$(P Otherwise, it resolves to the type with the smallest size it
655656
will fit into.)
656657

658+
$(P For Interpolation Expression Sequences, see $(GLINK2 istring, InterpolationExpressionSequence).)
659+
657660
$(H2 $(LNAME2 integerliteral, Integer Literals))
658661

659662
$(GRAMMAR_LEX
@@ -1206,7 +1209,7 @@ x; // this is now line 6 of file pkg/mod.d
12061209
debugging output.
12071210
)
12081211

1209-
$(SPEC_SUBNAV_PREV_NEXT intro, Introduction, grammar, Grammar)
1212+
$(SPEC_SUBNAV_PREV_NEXT intro, Introduction, istring, Interpolation Expression Sequence)
12101213
)
12111214

12121215
Macros:

spec/memory-safe-d.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,5 @@ $(SPEC_SUBNAV_PREV_NEXT entity, Named Character Entities, abi, Application Binar
8787
)
8888

8989
Macros:
90-
CHAPTER=37
90+
CHAPTER=38
9191
TITLE=Memory-Safe-D-Spec

spec/module.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,6 @@ $(SPEC_SUBNAV_PREV_NEXT grammar, Grammar, declaration, Declarations)
731731
)
732732

733733
Macros:
734-
CHAPTER=4
734+
CHAPTER=5
735735
TITLE=Modules
736736
_=

spec/ob.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,5 +378,5 @@ $(SPEC_SUBNAV_PREV_NEXT importc, ImportC, windows, Windows Programming)
378378
)
379379

380380
Macros:
381-
CHAPTER=42
381+
CHAPTER=43
382382
TITLE=Live Functions

spec/objc_interface.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -596,5 +596,5 @@ $(SPEC_SUBNAV_PREV_NEXT cpp_interface, Interfacing to C++, portability, Portabil
596596
)
597597

598598
Macros:
599-
CHAPTER=34
599+
CHAPTER=35
600600
TITLE=Interfacing to Objective-C

spec/operatoroverloading.dd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ $(SPEC_SUBNAV_PREV_NEXT function, Functions, template, Templates)
12591259
)
12601260

12611261
Macros:
1262-
CHAPTER=20
1262+
CHAPTER=21
12631263
TITLE=Operator Overloading
12641264
ARGUMENTS=$(I b)$(SUBSCRIPT 1), $(I b)$(SUBSCRIPT 2), ... $(I b)$(SUBSCRIPT n)
12651265
ARGUMENTS2=$(I c)$(SUBSCRIPT 1), $(I c)$(SUBSCRIPT 2), ... $(I c)$(SUBSCRIPT n)

0 commit comments

Comments
 (0)