Skip to content

Commit 6adccdc

Browse files
committed
Integrate proofreading for Chapter 9
1 parent 267ce20 commit 6adccdc

File tree

5 files changed

+30
-21
lines changed

5 files changed

+30
-21
lines changed

02_program_structure.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ a function call is an expression, and may produce a value.
864864
== Exercises ==
865865

866866
(((exercises)))If you are unsure how to try your solutions to
867-
exercises, refer to the link:00_into.html#intro[introduction].
867+
exercises, refer to the link:00_intro.html#intro[introduction].
868868

869869
Each exercise starts with a problem description. Read that and try to
870870
solve the exercise. If you run into problems, consider reading the

09_regexp.txt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ endif::interactive_target[]
2828
Jamie)))(((evolution)))(((adoption)))(((integration)))Programming
2929
((tool))s and techniques survive and spread in a chaotic, evolutionary
3030
way. It's not always the pretty or brilliant ones that win but rather
31-
the ones that function well enough within the right niche—for example
31+
the ones that function well enough within the right niche—for example,
3232
by being integrated with another successful piece of technology.
3333

3434
(((domain-specific language)))In this chapter, I will discuss one such
@@ -48,7 +48,7 @@ programmer.
4848

4949
(((regular expression,creation)))(((RegExp constructor)))(((literal
5050
expression)))(((slash character)))A regular expression is a type of
51-
object. It can be either constructed with the `RegExp` constructor or
51+
object. It can either be constructed with the `RegExp` constructor or
5252
written as a literal value by enclosing the pattern in forward slash
5353
(`/`) characters.
5454

@@ -166,7 +166,7 @@ console.log(dateTime.test("30-jan-2003 15:20"));
166166
----
167167

168168
(((backslash character)))That looks completely awful, doesn't it? It has way too
169-
many backslashes, producing a background noise that makes it hard to
169+
many backslashes, producing background noise that makes it hard to
170170
spot the actual ((pattern)) expressed. We'll see a slightly improved
171171
version of this expression
172172
link:09_regexp.html#date_regexp_counted[later].
@@ -222,7 +222,7 @@ match zero instances if it can't find any suitable text to match.
222222

223223
(((British English)))(((American English)))(((question mark)))A
224224
question mark makes a part of a pattern “((optional))”, meaning it may
225-
occur zero or one times. In the following example, the _u_ character
225+
occur zero or one time. In the following example, the _u_ character
226226
is allowed to occur, but the pattern also matches when it is missing.
227227

228228
[source,javascript]
@@ -260,7 +260,7 @@ braces)) by omitting the number on either side of the comma. So
260260

261261
(((regular expression,grouping)))(((grouping)))To use an operator like `*` or
262262
`+` on more than one element at a time, you can use ((parentheses)). A
263-
part of a regular expression that is surrounded in parentheses counts
263+
part of a regular expression that is enclosed in parentheses counts
264264
as a single element as far as the operators following it are
265265
concerned.
266266

@@ -275,9 +275,9 @@ console.log(cartoonCrying.test("Boohoooohoohooo"));
275275
second _o_ in _boo_ and _hoo_, respectively. The third `+` applies to
276276
the whole group `(hoo+)`, matching one or more sequences like that.
277277

278-
(((case-sensitivity)))(((capitalization)))(((regular
278+
(((case sensitivity)))(((capitalization)))(((regular
279279
expression,flags)))The `i` at the end of the expression in the
280-
previous example makes this regular expression case-insensitive, allowing it to
280+
previous example makes this regular expression case insensitive, allowing it to
281281
match the uppercase _B_ in the input string, even though the pattern
282282
is itself all lowercase.
283283

@@ -330,7 +330,7 @@ console.log(quotedText.exec("she said 'hello'"));
330330
----
331331

332332
(((capture group)))When a group does not end up being matched at all
333-
(for example when followed by a question mark), its position in the
333+
(for example, when followed by a question mark), its position in the
334334
output array will hold `undefined`. Similarly, when a group is matched
335335
multiple times, only the last match ends up in the array.
336336

@@ -435,7 +435,7 @@ console.log(findDate("30-1-2003"));
435435
(((matching)))(((regular expression,boundary)))Unfortunately,
436436
`findDate` will also happily extract the nonsensical date 00-1-3000
437437
from the string `"100-1-30000"`. A match may happen anywhere in the
438-
string, so in this case it'll just start at the second character and
438+
string, so in this case, it'll just start at the second character and
439439
end at the second-to-last character.
440440

441441
(((boundary)))(((caret character)))(((dollar sign)))If we want to
@@ -524,7 +524,7 @@ our progress through the flow chart would look like this:
524524
do see “pig”, so we take that branch.
525525

526526
- At position 9, after the three-way branch, one path skips
527-
the _s_ box and go straight to the final word boundary, while the other path
527+
the _s_ box and goes straight to the final word boundary, while the other path
528528
matches an _s_. There is an _s_ character here, not a word boundary,
529529
so we go through the _s_ box.
530530

@@ -585,12 +585,12 @@ of the string, the star operator tries to match one character less.
585585
But the matcher doesn't find an _x_ after `abcx` either, so it
586586
backtracks again, matching the star operator to just `abc`. _Now_ it
587587
finds an _x_ where it needs it and reports a successful match from
588-
position 0 to 4.
588+
positions 0 to 4.
589589

590590
(((performance)))(((complexity)))It is possible to write regular
591591
expressions that will do a _lot_ of backtracking. This problem occurs
592592
when a pattern can match a piece of input in many different ways. For
593-
example, if we get confused while writing a binary-number regexp, we
593+
example, if we get confused while writing a binary-number regular expression, we
594594
might accidentally write something like `/([01]+)+b/`.
595595

596596
image::img/re_slow.svg[alt="Visualization of /([01]+)+b/",width="6cm"]
@@ -620,7 +620,7 @@ console.log("papa".replace("p", "m"));
620620
(((regular expression,flags)))(((regular expression,global)))The first
621621
argument can also be a regular expression, in which case the first
622622
match of the regular expression is replaced. When a `g` option (for
623-
“global”) is added to the regular expression, _all_ matches in the
623+
_global_) is added to the regular expression, _all_ matches in the
624624
string will be replaced, not just the first.
625625

626626
[source,javascript]
@@ -860,7 +860,7 @@ will start.
860860

861861
(((interface,design)))(((exec method)))(((regular
862862
expression,global)))Those circumstances are that the regular
863-
expression must have the global (`g`) option enabled, and the match
863+
expression must have the global (`g`) option enabled, and the match
864864
must happen through the `exec` method. Again, a more sane solution
865865
would have been to just allow an extra argument to be passed to
866866
`exec`, but sanity is not a defining characteristic of JavaScript's
@@ -1025,7 +1025,7 @@ function parseINI(string) {
10251025

10261026
(((parseINI function)))(((parsing)))This code goes over every line in
10271027
the file, updating the “current section” object as it goes along.
1028-
First it checks whether the line can be ignored, using the expression
1028+
First, it checks whether the line can be ignored, using the expression
10291029
`/^\s*(;.*)?$/`. Do you see how it works? The part between the
10301030
((parentheses)) will match comments, and the `?` will make sure it
10311031
also matches lines containing only whitespace.
@@ -1078,8 +1078,8 @@ Unicode standard considers whitespace, including things like the
10781078
((implementation))s in other programming languages have syntax to
10791079
match specific ((Unicode)) character categories, such as “all
10801080
uppercase letters”, “all punctuation”, or “control characters”. There
1081-
are plans to add support for such categories JavaScript, but they
1082-
unfortunately look like they won't be realized in the near ((future)).
1081+
are plans to add support for such categories JavaScript, but it
1082+
unfortunately looks like they won't be realized in the near ((future)).
10831083

10841084
[[summary_regexp]]
10851085
== Summary ==
@@ -1122,7 +1122,7 @@ pass a function to `replace`, which will be used to build up a
11221122
replacement string based on the match text and matched groups.
11231123

11241124
Regular expressions can have options, which are written after
1125-
the closing slash. The `i` option makes the match case-insensitive,
1125+
the closing slash. The `i` option makes the match case insensitive,
11261126
while the `g` option makes the expression _global_, which, among other
11271127
things, causes the `replace` method to replace all instances instead
11281128
of just the first.
@@ -1316,7 +1316,7 @@ separate the two cases—either one or more digits optionally followed
13161316
by a dot and zero or more digits _or_ a dot followed by one or more
13171317
digits.
13181318

1319-
(((exponent)))(((case-sensitivity)))(((regular
1319+
(((exponent)))(((case sensitivity)))(((regular
13201320
expression,flags)))Finally, to make the _e_ case-insensitive, either
13211321
add an `i` option to the regular expression or use `[eE]`.
13221322

17_http.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ console.log(req.getResponseHeader("content-type"));
319319
// → text/plain
320320
----
321321

322-
(((case-sensitivity)))(((capitalization)))Header names are
322+
(((case sensitivity)))(((capitalization)))Header names are
323323
case-insensitive. They are usually written with a capital letter at
324324
the start of each word, such as “Content-Type”, but “content-type” and
325325
“cOnTeNt-TyPe” refer to the same header.

bin/check_links.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ fs.readdirSync(".").forEach(function(name) {
66
if (m) files[m[1]] = fs.readFileSync(name, "utf8");
77
});
88
files["22_fast"] = "[[fast]]"; // Kludge to recognize bonus chapter
9+
files["hints"] = "[[hints]]";
910

1011
var fail = 0;
1112
function error(file, msg) {

html/errata.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ <h2>Introduction</h2>
2222
<p><strong>Page 4</strong>: The sentence “You can probably imagine
2323
how how tedious…” duplicates the word <em>how</em>.</p>
2424

25+
<h2>Chapter 9</h2>
26+
27+
<p><strong>Page 159</strong> (The Date Type):
28+
The <code>findDate</code> function produces the wrong months. The
29+
second argument given to <code>new Date</code> should
30+
be <code>Number(match[2]) - 1</code>, subtracting one to compensate
31+
for the fact that months start at zero in this interface.</p>
32+
2533
<h2>Chapter 10</h2>
2634

2735
<p><strong>Page 185</strong> (Slow-Loading Modules): In the code

0 commit comments

Comments
 (0)